Class: EventfulApi::Client
- Inherits:
-
Object
- Object
- EventfulApi::Client
- Defined in:
- lib/eventful_api/client.rb
Constant Summary collapse
- API_URL =
'http://api.eventful.com'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#oauth_consumer ⇒ Object
readonly
Returns the value of attribute oauth_consumer.
Instance Method Summary collapse
- #get(method, params) ⇒ Object
-
#initialize(params) ⇒ Client
constructor
A new instance of Client.
- #post(method, params) ⇒ Object
Constructor Details
#initialize(params) ⇒ Client
Returns a new instance of Client.
9 10 11 12 |
# File 'lib/eventful_api/client.rb', line 9 def initialize(params) @oauth_consumer = OAuth::Consumer.new(EventfulApi.consumer_key, EventfulApi.consumer_secret, :site => API_URL, :scheme => EventfulApi::SCHEME) @access_token = OAuth::AccessToken.new(oauth_consumer, params[:oauth_token], params[:oauth_secret]) end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
7 8 9 |
# File 'lib/eventful_api/client.rb', line 7 def access_token @access_token end |
#oauth_consumer ⇒ Object (readonly)
Returns the value of attribute oauth_consumer.
7 8 9 |
# File 'lib/eventful_api/client.rb', line 7 def oauth_consumer @oauth_consumer end |
Instance Method Details
#get(method, params) ⇒ Object
14 15 16 17 |
# File 'lib/eventful_api/client.rb', line 14 def get(method, params) response = access_token.get get_path(method, params) MultiJson.load response.body end |
#post(method, params) ⇒ Object
19 20 21 22 |
# File 'lib/eventful_api/client.rb', line 19 def post(method, params) response = access_token.post(json_path(method), api_params(params)) MultiJson.load response.body end |