class Asana::Client

Attributes

token[RW]

Public Class Methods

authenticate(token) click to toggle source
# File lib/asana/client.rb, line 8
def self.authenticate(token)
  @token = token
  self.base_uri 'https://app.asana.com/api/1.0'
  self.headers 'Authorization' => "Bearer #{@token}"
end
format(uri, params) click to toggle source
# File lib/asana/client.rb, line 14
def self.format(uri, params)
  options = {}
  options = self.prefix_engine(params)
  self.getresponse(uri, options)
end

Private Class Methods

getresponse(uri, options) click to toggle source
# File lib/asana/client.rb, line 28
def self.getresponse(uri, options)
  hash = self.get(uri, options)
  hash = OpenStruct.new(hash['data'])
end
prefix_engine(params) click to toggle source
# File lib/asana/client.rb, line 21
def self.prefix_engine(params)
  temphash = {}
  mappings = {fields: 'opt_fields', assignee: 'assignee'}
  temphash[:query] = Hash[params.map {|k,v| [mappings[k]|| k, v] }]
  temphash
end