Class: Zferral::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/zferral/client.rb

Overview

The Client holds the API credentials and orchestrates access to the Resources.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash) (defaults to: {})

    API credentials, passed as a hash with ‘subdomain’ and ‘api_token’ keys



8
9
10
11
# File 'lib/zferral/client.rb', line 8

def initialize(options = {})
  self.subdomain = options[:subdomain] || options['subdomain']
  self.api_token = options[:api_token] || options['api_token']
end

Instance Attribute Details

#api_tokenObject

Returns the value of attribute api_token.



5
6
7
# File 'lib/zferral/client.rb', line 5

def api_token
  @api_token
end

#subdomainObject

Returns the value of attribute subdomain.



4
5
6
# File 'lib/zferral/client.rb', line 4

def subdomain
  @subdomain
end

Instance Method Details

#campaignZferral::Campaign

A Zferral::Campaign resource for this Client

Returns:



16
17
18
# File 'lib/zferral/client.rb', line 16

def campaign
  Zferral::Campaign.connect(self)
end

#eventZferral::Event

A Event resource for this Client

Returns:



30
31
32
# File 'lib/zferral/client.rb', line 30

def event
  Zferral::Event.connect(self)
end