supersaas-api-client 0.10.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8eab1cbc42e58b7936550c6881205c8869f75631b2e0f7f5e45bb7a06a721f7b
4
- data.tar.gz: 72d8368d4e60895872bf2d7ebe8b4b45a887626cd0c01abbbb6817c469d7cfcf
3
+ metadata.gz: 4cd91008c369ed81daba9f3b18bf00e4d05ec9dd0e9251a1b3784b2a2c733c2e
4
+ data.tar.gz: 2f6140acf5eafe80cd6a393c9e1213c23702589fd9e83a1b0e715aca9ae16398
5
5
  SHA512:
6
- metadata.gz: ae1672d2a6e704a401170f0b34022c441448cb092920ecce186f27eff0cf8dd04abe884cd4009fa93e421ada49a7f1f4697f0c41732920f92103bf5e2698710d
7
- data.tar.gz: 9f0e4efd6c65482a762d18e7fe1adc3215456f965bf7fca80b503834a54a37d3aa658d81966bbd0ad8dbb54af2198ec94883ff2fa8d5b97e2c6e3d0b7052a25b
6
+ metadata.gz: d3fd7377e8aca4df5bd47ea3dc26211fd4eecc2c2406cfb55c4d914804b589c899ad5f0d2d8764f70de36f1a9d3646a9839219d9ae688bfa40dff905652dd793
7
+ data.tar.gz: 0ae95b465f2b6c48c07e9125be5a740483b268e23e9262805d3b63fd8971c6f4fd546128cc276fdae1e94549b2b15840f44018abb17c35e7257da3e3a29e75cb
data/README.md CHANGED
@@ -7,7 +7,7 @@ The SuperSaaS API provides services that can be used to add online booking and s
7
7
  ## Prerequisites
8
8
 
9
9
  1. [Register for a (free) SuperSaaS account](https://www.supersaas.com/accounts/new), and
10
- 2. get your account name and password.
10
+ 2. get your account name and API key on the [Account Info](https://www.supersaas.com/accounts/edit) page.
11
11
 
12
12
  ##### Dependencies
13
13
 
@@ -43,21 +43,21 @@ Initialize the SuperSaaS `Client` with authorization credentials:
43
43
 
44
44
  Supersaas::Client.configure do |config|
45
45
  config.account_name = 'accnt'
46
- config.password = 'pwd'
46
+ config.api_key = 'xxxxxxxxxxxxxxxxxxxxxx'
47
47
  end
48
48
 
49
49
  > Note, ensure that `configure` is called before `instance` or `new`, otherwise the client will be initialized with configuration defaults.
50
50
 
51
- If the client isn't configured explicitly, it will use default `ENV` variables for the account name and password.
51
+ If the client isn't configured explicitly, it will use default `ENV` variables for the account name and api key.
52
52
 
53
53
  ENV['SSS_API_ACCOUNT_NAME'] = 'your-env-supersaas-account-name'
54
- ENV['SSS_API_PASSWORD'] = 'your-env-supersaas-account-name'
54
+ ENV['SSS_API_KEY'] = 'your-env-supersaas-account-name'
55
55
  Supersaas::Client.instance.account_name #=> 'your-env-supersaas-account-name'
56
- Supersaas::Client.instance.password #=> 'your-env-supersaas-account-name'
56
+ Supersaas::Client.instance.api_key #=> 'your-env-supersaas-account-name'
57
57
 
58
58
  All configuration options can be individually set on the client.
59
59
 
60
- Supersaas::Client.instance.password = 'pwd'
60
+ Supersaas::Client.instance.api_key = 'xxxxxxxxxxxxxxxxxxxxxx'
61
61
  Supersaas::Client.instance.verbose = true
62
62
  ...
63
63
 
@@ -189,12 +189,12 @@ Get a single form by `form_id`:
189
189
 
190
190
  The ./examples folder contains several executable Ruby scripts demonstrating how to use the API Client for common requests.
191
191
 
192
- The examples will require your account name, password, and some of the examples a schedule id and/or user id and/or form id. These can be set as environment variables. e.g.
192
+ The examples will require your account name, api key, and some of the examples a schedule id and/or user id and/or form id. These can be set as environment variables. e.g.
193
193
 
194
194
  $ gem install supersaas-api-client
195
- $ SSS_API_UID=myuserid SSS_API_SCHEDULE=myscheduleid SSS_API_ACCOUNT_NAME=myaccountname SSS_API_PASSWORD=mypassword ./examples/appointments.rb
196
- $ SSS_API_FORM=myuserid SSS_API_ACCOUNT_NAME=myaccountname SSS_API_PASSWORD=mypassword ./examples/forms.rb
197
- $ SSS_API_ACCOUNT_NAME=myaccountname SSS_API_PASSWORD=mypassword ./examples/users.rb
195
+ $ SSS_API_UID=myuserid SSS_API_SCHEDULE=myscheduleid SSS_API_ACCOUNT_NAME=myaccountname SSS_API_KEY=xxxxxxxxxxxxxxxxxxxxxx ./examples/appointments.rb
196
+ $ SSS_API_FORM=myuserid SSS_API_ACCOUNT_NAME=myaccountname SSS_API_KEY=xxxxxxxxxxxxxxxxxxxxxx ./examples/forms.rb
197
+ $ SSS_API_ACCOUNT_NAME=myaccountname SSS_API_KEY=xxxxxxxxxxxxxxxxxxxxxx ./examples/users.rb
198
198
 
199
199
  ## Testing
200
200
 
@@ -6,14 +6,14 @@ require "supersaas-api-client"
6
6
 
7
7
  puts "\n\r# SuperSaaS Appointments Example\n\r"
8
8
 
9
- unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.password
9
+ unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.api_key
10
10
  puts "ERROR! Missing account credentials. Rerun the script with your credentials, e.g.\n\r"
11
- puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_PASSWORD=<mypassword> ./examples/appointments.rb\n\r"
11
+ puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_KEY=<api_key> ./examples/appointments.rb\n\r"
12
12
  return
13
13
  end
14
14
 
15
15
  puts "## Account: #{Supersaas::Client.instance.account_name}"
16
- puts "## Password: #{'*' * Supersaas::Client.instance.password.size}\n\r"
16
+ puts "## API Key: #{'*' * Supersaas::Client.instance.api_key.size}\n\r"
17
17
 
18
18
  Supersaas::Client.instance.verbose = true
19
19
 
@@ -5,14 +5,14 @@ require "supersaas-api-client"
5
5
 
6
6
  puts "\n\r# SuperSaaS Forms Example\n\r"
7
7
 
8
- unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.password
8
+ unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.api_key
9
9
  puts "ERROR! Missing account credentials. Rerun the script with your credentials, e.g.\n\r"
10
- puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_PASSWORD=<mypassword> ./examples/appointments.rb\n\r"
10
+ puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_KEY=<xxxxxxxxxxxxxxxxxxxxxx> ./examples/appointments.rb\n\r"
11
11
  return
12
12
  end
13
13
 
14
14
  puts "## Account: #{Supersaas::Client.instance.account_name}"
15
- puts "## Password: #{'*' * Supersaas::Client.instance.password.size}\n\r"
15
+ puts "## API Key: #{'*' * Supersaas::Client.instance.api_key.size}\n\r"
16
16
 
17
17
  Supersaas::Client.instance.verbose = true
18
18
 
@@ -4,14 +4,14 @@ require "supersaas-api-client"
4
4
 
5
5
  puts "\n\r# SuperSaaS Schedules Example\n\r"
6
6
 
7
- unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.password
7
+ unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.api_key
8
8
  puts "ERROR! Missing account credentials. Rerun the script with your credentials, e.g.\n\r"
9
- puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_PASSWORD=<mypassword> ./examples/users.rb\n\r"
9
+ puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_KEY=<xxxxxxxxxxxxxxxxxxxxxx> ./examples/users.rb\n\r"
10
10
  return
11
11
  end
12
12
 
13
13
  puts "## Account: #{Supersaas::Client.instance.account_name}"
14
- puts "## Password: #{'*' * Supersaas::Client.instance.password.size}\n\r"
14
+ puts "## API KEY: #{'*' * Supersaas::Client.instance.api_key.size}\n\r"
15
15
 
16
16
  Supersaas::Client.instance.verbose = true
17
17
 
@@ -4,20 +4,20 @@ require "supersaas-api-client"
4
4
 
5
5
  puts "\n\r# SuperSaaS Users Example\n\r"
6
6
 
7
- unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.password
7
+ unless Supersaas::Client.instance.account_name && Supersaas::Client.instance.api_key
8
8
  puts "ERROR! Missing account credentials. Rerun the script with your credentials, e.g.\n\r"
9
- puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_PASSWORD=<mypassword> ./examples/users.rb\n\r"
9
+ puts " SSS_API_ACCOUNT_NAME=<myaccountname> SSS_API_KEY=<xxxxxxxxxxxxxxxxxxxxxx> ./examples/users.rb\n\r"
10
10
  return
11
11
  end
12
12
 
13
13
  puts "## Account: #{Supersaas::Client.instance.account_name}"
14
- puts "## Password: #{'*' * Supersaas::Client.instance.password.size}\n\r"
14
+ puts "## API Key: #{'*' * Supersaas::Client.instance.api_key.size}\n\r"
15
15
 
16
16
  Supersaas::Client.instance.verbose = true
17
17
 
18
18
  puts "creating new user..."
19
19
  puts "\n\r#### Supersaas::Client.instance.users.create({...})\n\r"
20
- params = {full_name: 'Example', name: 'example@example.com', email: 'example@example.com', password: 'example'}
20
+ params = {full_name: 'Example', name: 'example@example.com', email: 'example@example.com', api_key: 'example'}
21
21
  Supersaas::Client.instance.users.create(params)
22
22
  new_user_id = nil
23
23
 
@@ -21,13 +21,13 @@ module Supersaas
21
21
  end
22
22
  end
23
23
 
24
- attr_accessor :account_name, :password, :host, :dry_run, :verbose
24
+ attr_accessor :account_name, :api_key, :host, :dry_run, :verbose
25
25
  attr_reader :last_request
26
26
 
27
27
  def initialize(configuration=nil)
28
28
  configuration = configuration || Configuration.new
29
29
  @account_name = configuration.account_name
30
- @password = configuration.password
30
+ @api_key = configuration.api_key
31
31
  @host = configuration.host
32
32
  @dry_run = configuration.dry_run
33
33
  @verbose = configuration.verbose
@@ -58,7 +58,7 @@ module Supersaas
58
58
 
59
59
  def request(http_method, path, params={}, query={})
60
60
  raise Supersaas::Exception.new("Account name not configured. Call `Supersaas::Client.configure`.") unless account_name && account_name.size
61
- raise Supersaas::Exception.new("Account password not configured. Call `Supersaas::Client.configure`.") unless password && password.size
61
+ raise Supersaas::Exception.new("Account api key not configured. Call `Supersaas::Client.configure`.") unless api_key && api_key.size
62
62
 
63
63
  uri = URI.parse(host)
64
64
  http = Net::HTTP.new(uri.host, uri.port)
@@ -86,7 +86,7 @@ module Supersaas
86
86
  raise Supersaas::Exception.new("Invalid HTTP Method: #{http_method}. Only `:get`, `:post`, `:put`, `:delete` supported.")
87
87
  end
88
88
 
89
- req.basic_auth account_name, password
89
+ req.basic_auth account_name, api_key
90
90
 
91
91
  req['Accept'] = 'application/json'
92
92
  req['Content-Type'] = 'application/json'
@@ -145,11 +145,11 @@ module Supersaas
145
145
  class Configuration
146
146
  DEFAULT_HOST = 'https://www.supersaas.com'
147
147
 
148
- attr_accessor :account_name, :host, :password, :dry_run, :verbose
148
+ attr_accessor :account_name, :host, :api_key, :dry_run, :verbose
149
149
 
150
150
  def initialize
151
151
  @account_name = ENV['SSS_API_ACCOUNT_NAME']
152
- @password = ENV['SSS_API_PASSWORD']
152
+ @api_key = ENV['SSS_API_KEY']
153
153
  @host = DEFAULT_HOST
154
154
  @dry_run = false
155
155
  @verbose = false
@@ -1,4 +1,4 @@
1
1
  module Supersaas
2
- API_VERSION = '1'
3
- VERSION = '0.10.0'
2
+ API_VERSION = '2'
3
+ VERSION = '1.0.0'
4
4
  end
@@ -5,7 +5,7 @@ module Supersaas
5
5
  def setup
6
6
  @client = Supersaas::Client.instance
7
7
  @client.account_name = 'accnt'
8
- @client.password = 'pwd'
8
+ @client.api_key = 'xxxxxxxxxxxxxxxxxxxxxx'
9
9
  @client.dry_run = true
10
10
  @schedule_id = 12345
11
11
  @appointment_id = 67890
@@ -17,7 +17,7 @@ module Supersaas
17
17
 
18
18
  def test_request_methods
19
19
  @client.account_name = 'Test'
20
- @client.password = 'testing123'
20
+ @client.api_key = 'testing123'
21
21
  [:get,:put,:post,:delete].each do |method|
22
22
  refute_nil @client.send(method, '/test')
23
23
  assert_equal method.to_s.upcase, @client.last_request.method
@@ -31,13 +31,13 @@ module Supersaas
31
31
  def test_instance_configuration
32
32
  Supersaas::Client.configure do |config|
33
33
  config.account_name = 'account'
34
- config.password = 'password'
34
+ config.api_key = 'api_key'
35
35
  config.host = 'http://test'
36
36
  config.dry_run = true
37
37
  config.verbose = true
38
38
  end
39
39
  assert_equal 'account', Supersaas::Client.configuration.account_name
40
- assert_equal 'password', Supersaas::Client.configuration.password
40
+ assert_equal 'api_key', Supersaas::Client.configuration.api_key
41
41
  assert_equal 'http://test', Supersaas::Client.configuration.host
42
42
  assert_equal true, Supersaas::Client.configuration.dry_run
43
43
  assert_equal true, Supersaas::Client.configuration.verbose
@@ -15,7 +15,7 @@ class SupersaasTest < Minitest::Test
15
15
  if !defined? @client
16
16
  @client = Supersaas::Client.instance
17
17
  @client.account_name = 'accnt'
18
- @client.password = 'pwd'
18
+ @client.api_key = 'xxxxxxxxxxxxxxxxxxxxxx'
19
19
  @client.dry_run = true
20
20
  end
21
21
  @client
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supersaas-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-05 00:00:00.000000000 Z
11
+ date: 2019-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -117,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  - !ruby/object:Gem::Version
118
118
  version: '0'
119
119
  requirements: []
120
- rubyforge_project:
121
- rubygems_version: 2.7.6
120
+ rubygems_version: 3.0.1
122
121
  signing_key:
123
122
  specification_version: 4
124
123
  summary: Online bookings/appointments/calendars using the SuperSaaS scheduling platform.