Class: Supersaas::Client
- Inherits:
-
Object
- Object
- Supersaas::Client
- Defined in:
- lib/supersaas-api-client/client.rb
Defined Under Namespace
Classes: Configuration
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Instance Attribute Summary collapse
-
#account_name ⇒ Object
Returns the value of attribute account_name.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
-
#host ⇒ Object
Returns the value of attribute host.
-
#last_request ⇒ Object
readonly
Returns the value of attribute last_request.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
- #appointments ⇒ Object
- #delete(path, params = {}, query = {}) ⇒ Object
- #forms ⇒ Object
- #get(path, query = {}) ⇒ Object
- #groups ⇒ Object
-
#initialize(configuration = nil) ⇒ Client
constructor
A new instance of Client.
- #post(path, params = {}, query = {}) ⇒ Object
- #promotions ⇒ Object
- #put(path, params = {}, query = {}) ⇒ Object
- #schedules ⇒ Object
- #users ⇒ Object
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.account_name @api_key = configuration.api_key @host = configuration.host @dry_run = configuration.dry_run @verbose = configuration.verbose end |
Class Attribute Details
.configuration ⇒ Object
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_name ⇒ Object
Returns the value of attribute account_name.
26 27 28 |
# File 'lib/supersaas-api-client/client.rb', line 26 def account_name @account_name end |
#api_key ⇒ Object
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_run ⇒ Object
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 |
#host ⇒ Object
Returns the value of attribute host.
26 27 28 |
# File 'lib/supersaas-api-client/client.rb', line 26 def host @host end |
#last_request ⇒ Object (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 |
#verbose ⇒ Object
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
12 13 14 15 |
# File 'lib/supersaas-api-client/client.rb', line 12 def configure self.configuration ||= Configuration.new yield(configuration) end |
.instance ⇒ Object
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_agent ⇒ Object
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
#appointments ⇒ Object
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 |
#forms ⇒ Object
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 |
#groups ⇒ Object
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 |
#promotions ⇒ Object
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 |