Class: HyvesOAuth::Client
- Inherits:
-
Object
- Object
- HyvesOAuth::Client
- Defined in:
- lib/hyves_oauth/client.rb
Instance Method Summary collapse
- #authorize(token, secret, options = {}) ⇒ Object
- #authorize_url ⇒ Object
- #get_logged_in ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #request_token(options = {}) ⇒ Object
- #update(message, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
3 4 5 6 7 8 9 |
# File 'lib/hyves_oauth/client.rb', line 3 def initialize( = {}) @consumer_key = [:consumer_key] @consumer_secret = [:consumer_secret] @token = [:token] @secret = [:secret] end |
Instance Method Details
#authorize(token, secret, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/hyves_oauth/client.rb', line 19 def (token, secret, = {}) request_token = OAuth::RequestToken.new(consumer, token, secret) @access_token = request_token.get_access_token(, {"strict_oauth_spec_response" => "true", "ha_method" => "auth.accesstoken"}) @token = @access_token.token @secret = @access_token.secret @access_token end |
#authorize_url ⇒ Object
15 16 17 |
# File 'lib/hyves_oauth/client.rb', line 15 def @request_token..gsub("http://data.hyves-api.nl/oauth/", "http://www.hyves.nl/api/") end |
#get_logged_in ⇒ Object
31 32 33 |
# File 'lib/hyves_oauth/client.rb', line 31 def get_logged_in post "/", {"ha_method" => "users.getLoggedin"} end |
#request_token(options = {}) ⇒ Object
11 12 13 |
# File 'lib/hyves_oauth/client.rb', line 11 def request_token( = {}) @request_token = consumer.get_request_token(, {"strict_oauth_spec_response" => "true", "ha_method" => "auth.requesttoken", "methods" => "wwws.create,users.getLoggedin"}) end |
#update(message, options = {}) ⇒ Object
27 28 29 |
# File 'lib/hyves_oauth/client.rb', line 27 def update(, = {}) post("/", {"ha_method" => "wwws.create", "emotion" => , "visibility" => "default"}.merge()) end |