Class: Supersaas::Client

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

Defined Under Namespace

Classes: Configuration

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration = nil) ⇒ Client

Returns a new instance of Client.



29
30
31
32
33
34
35
36
# File 'lib/supersaas-api-client/client.rb', line 29

def initialize(configuration = nil)
  configuration ||= Configuration.new
  @account_name = configuration.
  @api_key = configuration.api_key
  @host = configuration.host
  @dry_run = configuration.dry_run
  @verbose = configuration.verbose
end

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



10
11
12
# File 'lib/supersaas-api-client/client.rb', line 10

def configuration
  @configuration
end

Instance Attribute Details

#account_nameObject

Returns the value of attribute account_name.



26
27
28
# File 'lib/supersaas-api-client/client.rb', line 26

def 
  @account_name
end

#api_keyObject

Returns the value of attribute api_key.



26
27
28
# File 'lib/supersaas-api-client/client.rb', line 26

def api_key
  @api_key
end

#dry_runObject

Returns the value of attribute dry_run.



26
27
28
# File 'lib/supersaas-api-client/client.rb', line 26

def dry_run
  @dry_run
end

#hostObject

Returns the value of attribute host.



26
27
28
# File 'lib/supersaas-api-client/client.rb', line 26

def host
  @host
end

#last_requestObject (readonly)

Returns the value of attribute last_request.



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

def last_request
  @last_request
end

#verboseObject

Returns the value of attribute verbose.



26
27
28
# File 'lib/supersaas-api-client/client.rb', line 26

def verbose
  @verbose
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



12
13
14
15
# File 'lib/supersaas-api-client/client.rb', line 12

def configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

.instanceObject



17
18
19
# File 'lib/supersaas-api-client/client.rb', line 17

def instance
  Thread.current['SUPER_SAAS_CLIENT'] ||= new(configuration || Configuration.new)
end

.user_agentObject



21
22
23
# File 'lib/supersaas-api-client/client.rb', line 21

def user_agent
  "SSS/#{VERSION} Ruby/#{RUBY_VERSION} API/#{API_VERSION}"
end

Instance Method Details

#appointmentsObject



38
39
40
# File 'lib/supersaas-api-client/client.rb', line 38

def appointments
  @appointments ||= Appointments.new(self)
end

#delete(path, params = {}, query = {}) ⇒ Object



74
75
76
# File 'lib/supersaas-api-client/client.rb', line 74

def delete(path, params = {}, query = {})
  request(:delete, path, params, query)
end

#formsObject



42
43
44
# File 'lib/supersaas-api-client/client.rb', line 42

def forms
  @forms ||= Forms.new(self)
end

#get(path, query = {}) ⇒ Object



62
63
64
# File 'lib/supersaas-api-client/client.rb', line 62

def get(path, query = {})
  request(:get, path, {}, query)
end

#groupsObject



58
59
60
# File 'lib/supersaas-api-client/client.rb', line 58

def groups
  @groups ||= Groups.new(self)
end

#post(path, params = {}, query = {}) ⇒ Object



66
67
68
# File 'lib/supersaas-api-client/client.rb', line 66

def post(path, params = {}, query = {})
  request(:post, path, params, query)
end

#promotionsObject



54
55
56
# File 'lib/supersaas-api-client/client.rb', line 54

def promotions
  @promotions ||= Promotions.new(self)
end

#put(path, params = {}, query = {}) ⇒ Object



70
71
72
# File 'lib/supersaas-api-client/client.rb', line 70

def put(path, params = {}, query = {})
  request(:put, path, params, query)
end

#schedulesObject



46
47
48
# File 'lib/supersaas-api-client/client.rb', line 46

def schedules
  @schedules ||= Schedules.new(self)
end

#usersObject



50
51
52
# File 'lib/supersaas-api-client/client.rb', line 50

def users
  @users ||= Users.new(self)
end