Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: pasberth/Myoack
base: 793ce62ac6
...
head fork: pasberth/Myoack
compare: 9e849d3860
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
3  .bundle/config
@@ -1,3 +0,0 @@
----
-BUNDLE_PATH: .bundler
-BUNDLE_DISABLE_SHARED_GEMS: '1'
View
1  .gitignore
@@ -1 +1,2 @@
.bundler
+.bundle
View
2  README.rdoc
@@ -21,7 +21,7 @@ Set the consumer key into "$HOME/.myoack/keys.yml".
Run command "myoack-local-authorization-server.rb". this command will use 13480 port.
-Run command "myoack.rb authorize <ID>"
+Run command "myoack.rb --auth <ID>"
$ myoack.rb authorize twitter
View
13 examples/get_gists_from_github.rb
@@ -0,0 +1,13 @@
+require 'myoack'
+require 'oauth2'
+require 'json'
+require 'pp'
+
+cfg = Myoack::Config.require_config(:github)
+client = OAuth2::Client.new( cfg.client_id,
+ cfg.client_secret,
+ :site => cfg.site,
+ :authorize_url => cfg.authorize_url,
+ :token_url => cfg.access_token_url )
+acs = OAuth2::AccessToken.new( client, cfg.access_token )
+pp JSON.parse(acs.get('/gists').body)
View
3  example.rb → examples/get_mentions_from_twitter.rb
@@ -1,11 +1,8 @@
-$:.unshift File.dirname(__FILE__) + '/lib'
-require 'rubygems'
require 'myoack'
require 'oauth'
require 'json'
require 'pp'
-
cfg = Myoack::Config.require_config(:twitter)
consumer = OAuth::Consumer.new(
cfg.consumer_key,
View
18 examples/get_posts_from_tumblr.rb
@@ -0,0 +1,18 @@
+require 'tumblife'
+require 'myoack'
+require 'oauth'
+require 'json'
+require 'pp'
+
+cfg = Myoack::Config.require_config(:tumblr)
+consumer = OAuth::Consumer.new(
+ cfg.consumer_key,
+ cfg.consumer_secret,
+ :site => cfg.site)
+acs = OAuth::AccessToken.new(
+ consumer,
+ cfg.access_token,
+ cfg.access_token_secret)
+
+tumb = Tumblife.new acs
+pp tumb.dashboard.posts
View
23 lib/myoack/config_manager.rb
@@ -1,9 +1,11 @@
-module Myoack
+require 'optparse'
+module Myoack
+
MYOACK_HOME = File.join(ENV["HOME"], '.myoack')
class ConfigManager
-
+
def initialize home=MYOACK_HOME
@home = home
@init_file_path = File.join(@home, 'init.rb')
@@ -13,18 +15,15 @@ def initialize home=MYOACK_HOME
@config_classes = {}
end
+ def option_parser
+ OptionParser.new.tap do |opts|
+ opts.on('--authorize ID', 'Try authorize me on the <ID> which is in "$HOME/.myoack/keys.yml".') { |id| authorize(id) }
+ end
+ end
+
def main *argv
init_as_cli
- if File.exist? argv[0]
- load argv[0]
- return
- end
-
- case cmd = argv.shift
- when "authorize!" then authorize!(*argv)
- when "authorize" then authorize(*argv)
- else raise "Unknown command: #{cmd}"
- end
+ option_parser.parse! argv
end
def init_as_cli

No commit comments for this range

Something went wrong with that request. Please try again.