Class: Distimo::Client

Inherits:
Object
  • Object
show all
Includes:
API, HTTParty
Defined in:
lib/distimo/client.rb

Constant Summary

Constants included from API

API::METHODS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Client

Returns a new instance of Client.



12
13
14
# File 'lib/distimo/client.rb', line 12

def initialize opts
  opts.each {|k,v| send("#{k}=",v)}
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



10
11
12
# File 'lib/distimo/client.rb', line 10

def password
  @password
end

#private_keyObject

Returns the value of attribute private_key.



10
11
12
# File 'lib/distimo/client.rb', line 10

def private_key
  @private_key
end

#public_keyObject

Returns the value of attribute public_key.



10
11
12
# File 'lib/distimo/client.rb', line 10

def public_key
  @public_key
end

#tokenObject

Returns the value of attribute token.



10
11
12
# File 'lib/distimo/client.rb', line 10

def token
  @token
end

#usernameObject

Returns the value of attribute username.



10
11
12
# File 'lib/distimo/client.rb', line 10

def username
  @username
end

Instance Method Details

#get(path, query) ⇒ Object



16
17
18
19
20
21
# File 'lib/distimo/client.rb', line 16

def get path, query
  options = prepare(query)
  response = self.class.get path, options
  raise Error.from_response(response) if response.code >= 400
  response
end