Class: Taskrabbit::Api

Inherits:
Object
  • Object
show all
Includes:
Association, Client
Defined in:
lib/taskrabbit/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Association

included

Methods included from Client

included

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.options.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_tokenObject

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

#accountObject



13
14
15
# File 'lib/taskrabbit/api.rb', line 13

def 
  @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, options = {})
  send(method, path, request_params(transformer, options))
end