Class: Mirror::Api::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/mirror-api/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials, options = {raise_errors: false}) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
# File 'lib/mirror-api/client.rb', line 9

def initialize(credentials, options={raise_errors: false})
  self.credentials = credentials
  self.options = options
  raise "Invalid credentials. Missing token" unless (self.credentials && self.credentials[:token])
end

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



7
8
9
# File 'lib/mirror-api/client.rb', line 7

def credentials
  @credentials
end

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/mirror-api/client.rb', line 7

def options
  @options
end

Instance Method Details

#contactsObject



35
36
37
# File 'lib/mirror-api/client.rb', line 35

def contacts
  @contacts ||= Resource.new(credentials, Request::CONTACTS, options)
end

#locationsObject



31
32
33
# File 'lib/mirror-api/client.rb', line 31

def locations
  @locations ||= Resource.new(credentials, Request::LOCATIONS, options)
end

#subscriptionsObject



27
28
29
# File 'lib/mirror-api/client.rb', line 27

def subscriptions
  @subscriptions ||= Resource.new(credentials, Request::SUBSCRIPTIONS, options)
end

#timelineObject



23
24
25
# File 'lib/mirror-api/client.rb', line 23

def timeline
  @timeline ||= Resource.new(credentials, Request::TIMELINE, options)
end