Class: SaasRunner::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



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

def initialize(options = {})
  @api_key = options.fetch(:api_key)
  @api_host = options.fetch(:api_host, 'api.saasrunner.com')
end

Instance Attribute Details

#api_hostObject (readonly)

Returns the value of attribute api_host.



3
4
5
# File 'lib/saas_runner/client.rb', line 3

def api_host
  @api_host
end

#api_keyObject (readonly)

Returns the value of attribute api_key.



3
4
5
# File 'lib/saas_runner/client.rb', line 3

def api_key
  @api_key
end

Instance Method Details

#activationsObject



21
22
23
# File 'lib/saas_runner/client.rb', line 21

def activations
  @activations ||= Resource::Activation.new(self)
end

#delete(path, params) ⇒ Object



37
38
39
# File 'lib/saas_runner/client.rb', line 37

def delete(path, params)
  request(:delete, path, params)
end

#eventsObject



25
26
27
# File 'lib/saas_runner/client.rb', line 25

def events
  @events ||= Resource::Event.new(self)
end

#get(path, params) ⇒ Object



29
30
31
# File 'lib/saas_runner/client.rb', line 29

def get(path, params)
  request(:get, path, params)
end

#post(path, body) ⇒ Object



33
34
35
# File 'lib/saas_runner/client.rb', line 33

def post(path, body)
  request(:post, path, {}, body)
end

#subscribersObject

Public: Access the subscribers resource

Returns a Resource::Subscriber



13
14
15
# File 'lib/saas_runner/client.rb', line 13

def subscribers
  @subscribers ||= Resource::Subscriber.new(self)
end

#transactionsObject



17
18
19
# File 'lib/saas_runner/client.rb', line 17

def transactions
  @transactions ||= Resource::Transaction.new(self)
end