Class: Pairzone::Api::Base

Inherits:
Object
  • Object
show all
Includes:
PartyResource
Defined in:
lib/pairzone/api/base.rb

Direct Known Subclasses

Pairzone, User

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/pairzone/api/base.rb', line 9

def initialize(data)
  Logger.debug("Received DATA: #{data}")
  populate_properties(data.values.first)
end

Class Method Details

.connect_to(host, options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/pairzone/api/base.rb', line 14

def self.connect_to(host, options)
  params = {
    base_uri: host,
    headers: {
      'Accept' => 'application/json',
      'User-agent' => 'pairzone-gem/' + VERSION
    }
  }.merge(options)
  Logger.debug("Connecting to API server with params: #{params.inspect}")
  PartyResource::Connector.add(:pairzone, params)
end