Skip to content

Instantly share code, notes, and snippets.

@hSATAC
Forked from monde/.gitignore
Last active August 29, 2015 14:28
Show Gist options
  • Select an option

  • Save hSATAC/716c6f48e8425d399724 to your computer and use it in GitHub Desktop.

Select an option

Save hSATAC/716c6f48e8425d399724 to your computer and use it in GitHub Desktop.

Revisions

  1. @monde monde revised this gist Jan 26, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion generate-tumblr-oauth-token.rb
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@
    }
    )

    request_token = consumer.get_request_token
    request_token = consumer.get_request_token(:exclude_callback => true)
    puts <<WORDS
    Open the following authorization url in a web browser to fetch the oauth
  2. @monde monde revised this gist Jan 20, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion generate-tumblr-oauth-token.rb
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,8 @@
    require 'bundler/setup'
    require 'oauth'

    lines = open('README.md').readlines[14..32]
    readme = File.join(File.dirname(__FILE__), 'README.md')
    lines = open(readme).readlines[14..32]
    puts lines.join

    oauth_consumer_key = Readline.readline("enter your OAuth Consumer Key: ", true).strip
  3. @monde monde revised this gist Jan 20, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions generate-tumblr-oauth-token.gemspec
    Original file line number Diff line number Diff line change
    @@ -10,4 +10,5 @@ Gem::Specification.new do |s|
    s.require_path = '.'
    s.bindir = '.'
    s.executables << 'generate-token'
    s.post_install_message = "\nto generate a your Tumblr OAuth token run the following command:\n\nbundle exec generate-token"
    end
  4. @monde monde revised this gist Jan 20, 2013. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions generate-tumblr-oauth-token.gemspec
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@ Gem::Specification.new do |s|
    s.email = 'mikemondragon@gmail.com'
    s.summary = 'Generate a OAuth token and secret for the Tumblr.com API'
    s.description = 'This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.'
    s.files = ['generate-tumblr-oauth-token.rb', 'generate']
    s.files = ['generate-tumblr-oauth-token.rb', 'generate-token']
    s.require_path = '.'
    s.bindir = '.'
    s.executables << 'generate'
    end
    s.executables << 'generate-token'
    end
  5. @monde monde revised this gist Jan 20, 2013. 3 changed files with 64 additions and 10 deletions.
    1 change: 1 addition & 0 deletions .gitignore
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Gemfile.lock
    22 changes: 13 additions & 9 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,10 @@
    # Generate a OAuth token and secret for the Tumblr.com API

    This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.
    This is a micro Gem to get an OAuth token and secret for the Tumblr.com API
    allowing an external application to post Tumblr.com blog.

    Make a directory, cd into it, download the microgem's Gemfile and run bundle install
    Make a directory, cd into it, download the microgem's Gemfile and run bundle
    install

    ```shell
    mkdir /path/to/some/new/dir
    @@ -11,10 +13,12 @@ wget https://gist.github.com/raw/4577106/6bc9befedcd5238ce9f2ee562cace666dece460
    bundle install
    ```

    Go to the Tumblr OAuth Applications panel, http://www.tumblr.com/oauth/apps, log in if prompted.
    Go to the Tumblr OAuth Applications panel, http://www.tumblr.com/oauth/apps and
    log in if prompted.

    Click the "+ Register application" button to grant access to your application and fill in the following to
    register a new application. Unless you know otherwise, use this URL for the "Default callback URL"
    Click the "+ Register application" button to grant access to your application
    and fill in the following to register a new application. Unless you know
    otherwise, use this URL for the "Default callback URL"
    http://sasquatch.github.com/tumblr.html

    * Application name
    @@ -23,11 +27,11 @@ http://sasquatch.github.com/tumblr.html
    * Administrative contact email
    * Default callback URL

    Click "Register" and you'll be redirected back to http://www.tumblr.com/oauth/apps . Make
    note of your new "OAuth Consumer Key" and "Show secret key / Secret Key" for the application you've
    just registered.
    Click "Register" and you'll be redirected back to
    http://www.tumblr.com/oauth/apps Make note of your new "OAuth Consumer Key"
    and "Show secret key / Secret Key" for the application you've just registered.

    Now generate OAuth token and secret that your application will use to post to your tumblr in the following manner.
    Now generate an OAuth token and secret that your application will use to post to your tumblr in the following manner.

    ```shell
    bundle exec generate-token
    51 changes: 50 additions & 1 deletion generate-tumblr-oauth-token.rb
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,54 @@
    require 'pp'
    require 'readline'
    require 'rubygems'
    require 'bundler/setup'
    require 'oauth'
    puts "loaded generate-tumblr-oauth-token.rb"

    lines = open('README.md').readlines[14..32]
    puts lines.join

    oauth_consumer_key = Readline.readline("enter your OAuth Consumer Key: ", true).strip
    oauth_secret_key = Readline.readline(" enter your Secret Key: ", true).strip

    consumer =
    OAuth::Consumer.new(
    oauth_consumer_key,
    oauth_secret_key,
    { :site => 'http://www.tumblr.com',
    :request_token_path => '/oauth/request_token',
    :authorize_path => '/oauth/authorize',
    :access_token_path => '/oauth/access_token',
    :http_method => :get
    }
    )

    request_token = consumer.get_request_token
    puts <<WORDS
    Open the following authorization url in a web browser to fetch the oauth
    verification key. Select the "Allow" option if you would like to "Grant this
    application read and write access to your Tumblr account?". After you do so
    you will be redirected to the URL that was previously saved as the 'Default
    callback URL'. You are looking for a URL parameter named 'oauth_verifier'.
    Your authorization URL:\n\n#{request_token.authorize_url}
    WORDS

    verifier = Readline.readline("enter your oauth_verifier: ", true).strip
    access_token = request_token.get_access_token(:oauth_verifier => verifier)


    puts <<WORDS
    Save these OAuth values for the application that you have authorized to
    interact with your Tumblr account via their API.
    OAuth Consumer Key: #{oauth_consumer_key}
    OAuth Consumer Secret: #{oauth_secret_key}
    OAuth Token: #{access_token.token}
    OAuth Token Secret: #{access_token.secret}
    Bye, bye.
    WORDS
  6. @monde monde revised this gist Jan 20, 2013. 2 changed files with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,5 @@ just registered.
    Now generate OAuth token and secret that your application will use to post to your tumblr in the following manner.

    ```shell
    bundle exec generate
    bundle exec generate-token
    ```

    File renamed without changes.
  7. @monde monde revised this gist Jan 20, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -31,4 +31,5 @@ Now generate OAuth token and secret that your application will use to post to yo

    ```shell
    bundle exec generate
    ```
    ```

  8. @monde monde revised this gist Jan 20, 2013. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion generate-tumblr-oauth-token.gemspec
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,8 @@ Gem::Specification.new do |s|
    s.email = 'mikemondragon@gmail.com'
    s.summary = 'Generate a OAuth token and secret for the Tumblr.com API'
    s.description = 'This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.'
    s.executables << 'generate'
    s.files = ['generate-tumblr-oauth-token.rb', 'generate']
    s.require_path = '.'
    s.bindir = '.'
    s.executables << 'generate'
    end
  9. @monde monde revised this gist Jan 20, 2013. 3 changed files with 3 additions and 3 deletions.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -30,5 +30,5 @@ just registered.
    Now generate OAuth token and secret that your application will use to post to your tumblr in the following manner.

    ```shell
    bundle exec generate-tumblr-oauth-token.rb
    bundle exec generate
    ```
    2 changes: 1 addition & 1 deletion generate
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    #!/usr/bin/env ruby
    require 'generate-tumblr-oauth-token.rb'
    puts "running bin/generate"
    puts "running generate"
    2 changes: 1 addition & 1 deletion generate-tumblr-oauth-token.gemspec
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,6 @@ Gem::Specification.new do |s|
    s.summary = 'Generate a OAuth token and secret for the Tumblr.com API'
    s.description = 'This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.'
    s.executables << 'generate'
    s.files = ['generate-tumblr-oauth-token.rb', 'bin/generate']
    s.files = ['generate-tumblr-oauth-token.rb', 'generate']
    s.require_path = '.'
    end
  10. @monde monde revised this gist Jan 20, 2013. 2 changed files with 4 additions and 2 deletions.
    3 changes: 3 additions & 0 deletions generate
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    #!/usr/bin/env ruby
    require 'generate-tumblr-oauth-token.rb'
    puts "running bin/generate"
    3 changes: 1 addition & 2 deletions generate-tumblr-oauth-token.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    #!/usr/bin/env ruby
    require 'pp'
    require 'rubygems'
    require 'bundler/setup'
    require 'oauth'
    puts "hello"
    puts "loaded generate-tumblr-oauth-token.rb"
  11. @monde monde revised this gist Jan 20, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions generate-tumblr-oauth-token.gemspec
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Gem::Specification.new do |s|
    s.email = 'mikemondragon@gmail.com'
    s.summary = 'Generate a OAuth token and secret for the Tumblr.com API'
    s.description = 'This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.'
    s.executables << 'generate-tumblr-oauth-token.rb'
    s.files = ['generate-tumblr-oauth-token.rb']
    s.executables << 'generate'
    s.files = ['generate-tumblr-oauth-token.rb', 'bin/generate']
    s.require_path = '.'
    end
  12. @monde monde revised this gist Jan 20, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion generate-tumblr-oauth-token.rb
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/usr/bin/env ruby -w
    #!/usr/bin/env ruby
    require 'pp'
    require 'rubygems'
    require 'bundler/setup'
  13. @monde monde revised this gist Jan 20, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion generate-tumblr-oauth-token.gemspec
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ Gem::Specification.new do |s|
    s.email = 'mikemondragon@gmail.com'
    s.summary = 'Generate a OAuth token and secret for the Tumblr.com API'
    s.description = 'This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.'

    s.executables << 'generate-tumblr-oauth-token.rb'
    s.files = ['generate-tumblr-oauth-token.rb']
    s.require_path = '.'
    end
  14. @monde monde renamed this gist Jan 20, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt → generate-tumblr-oauth-token.gemspec
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Gem::Specification.new do |s|
    s.name = 'generate-tumblr-oauth-token.rb'
    s.name = 'generate-tumblr-oauth-token'
    s.version = '0.0.1'
    s.platform = Gem::Platform::RUBY
    s.author = 'Mike Mondragon'
  15. @monde monde revised this gist Jan 20, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Gem::Specification.new do |s|
    s.name = 'generate-tumblr-oauth-token'
    s.name = 'generate-tumblr-oauth-token.rb'
    s.version = '0.0.1'
    s.platform = Gem::Platform::RUBY
    s.author = 'Mike Mondragon'
  16. @monde monde revised this gist Jan 20, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Make a directory, cd into it, download the microgem's Gemfile and run bundle ins
    ```shell
    mkdir /path/to/some/new/dir
    cd /path/to/some/new/dir
    wget https://gist.github.com/raw/4577106/42ea3b90e0a111063e56cde9ddf74328df66dc91/Gemfile
    wget https://gist.github.com/raw/4577106/6bc9befedcd5238ce9f2ee562cace666dece460c/Gemfile
    bundle install
    ```

  17. @monde monde revised this gist Jan 20, 2013. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions generate-tumblr-oauth-token.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #!/usr/bin/env ruby -w
    require 'pp'
    require 'rubygems'
    require 'bundler/setup'
    require 'oauth'
    puts "hello"
  18. @monde monde revised this gist Jan 20, 2013. No changes.
  19. @monde monde revised this gist Jan 20, 2013. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion Gemfile
    Original file line number Diff line number Diff line change
    @@ -1 +1,4 @@
    gem "generate-tumblr-oauth-token", :git => "https://gist.github.com/4577106.git"
    source "http://rubygems.org"

    gem "generate-tumblr-oauth-token", :git => "https://gist.github.com/4577106.git"
    gem "oauth"
  20. @monde monde revised this gist Jan 20, 2013. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    Gem::Specification.new do |s|
    s.name = 'generate-tumblr-oauth-token'
    s.version = '0.0.1'
    s.platform = Gem::Platform::RUBY
    s.author = 'Mike Mondragon'
    s.email = 'mikemondragon@gmail.com'
    s.summary = 'Generate a OAuth token and secret for the Tumblr.com API'
    s.description = 'This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.'

    s.files = ['generate-tumblr-oauth-token.rb']
    s.require_path = '.'
    end
  21. @monde monde revised this gist Jan 20, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ Make a directory, cd into it, download the microgem's Gemfile and run bundle ins
    ```shell
    mkdir /path/to/some/new/dir
    cd /path/to/some/new/dir
    wget http://xxxxxxxxx/Gemfile
    wget https://gist.github.com/raw/4577106/42ea3b90e0a111063e56cde9ddf74328df66dc91/Gemfile
    bundle install
    ```

  22. @monde monde revised this gist Jan 20, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Gemfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    gem "generate-tumblr-oauth-token", :git => "https://gist.github.com/4577106.git"
  23. @monde monde created this gist Jan 20, 2013.
    34 changes: 34 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,34 @@
    # Generate a OAuth token and secret for the Tumblr.com API

    This is a micro Gem to get an OAuth token and secret for the Tumblr.com API allowing an external application to post Tumblr.com blog.

    Make a directory, cd into it, download the microgem's Gemfile and run bundle install

    ```shell
    mkdir /path/to/some/new/dir
    cd /path/to/some/new/dir
    wget http://xxxxxxxxx/Gemfile
    bundle install
    ```

    Go to the Tumblr OAuth Applications panel, http://www.tumblr.com/oauth/apps, log in if prompted.

    Click the "+ Register application" button to grant access to your application and fill in the following to
    register a new application. Unless you know otherwise, use this URL for the "Default callback URL"
    http://sasquatch.github.com/tumblr.html

    * Application name
    * Application website
    * Application description
    * Administrative contact email
    * Default callback URL

    Click "Register" and you'll be redirected back to http://www.tumblr.com/oauth/apps . Make
    note of your new "OAuth Consumer Key" and "Show secret key / Secret Key" for the application you've
    just registered.

    Now generate OAuth token and secret that your application will use to post to your tumblr in the following manner.

    ```shell
    bundle exec generate-tumblr-oauth-token.rb
    ```