Class: Taskrabbit::Api
- Inherits:
-
Object
- Object
- Taskrabbit::Api
- Includes:
- Association, Client
- Defined in:
- lib/taskrabbit/api.rb
Instance Attribute Summary collapse
-
#user_token ⇒ Object
Returns the value of attribute user_token.
Instance Method Summary collapse
- #account ⇒ Object
-
#initialize(user_token = nil, attrs = {}) ⇒ Api
constructor
A new instance of Api.
- #request(method, path, transformer, options = {}) ⇒ Object
Methods included from Association
Methods included from Client
Constructor Details
#initialize(user_token = nil, attrs = {}) ⇒ Api
Returns a new instance of Api.
17 18 19 20 21 22 23 24 |
# File 'lib/taskrabbit/api.rb', line 17 def initialize(user_token = nil, attrs = {}) attrs = Taskrabbit..merge(attrs) # set the configuration for the api Config::VALID_OPTIONS_KEYS.each do |key| instance_variable_set("@#{key}".to_sym, attrs[key]) end self.user_token = user_token if user_token end |
Instance Attribute Details
#user_token ⇒ Object
Returns the value of attribute user_token.
6 7 8 |
# File 'lib/taskrabbit/api.rb', line 6 def user_token @user_token end |
Instance Method Details
#account ⇒ Object
13 14 15 |
# File 'lib/taskrabbit/api.rb', line 13 def account @account ||= Account.new({}, self) end |
#request(method, path, transformer, options = {}) ⇒ Object
26 27 28 |
# File 'lib/taskrabbit/api.rb', line 26 def request(method, path, transformer, = {}) send(method, path, request_params(transformer, )) end |