supersaas-api-client 1.1.1 → 2.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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/actions.yaml +21 -0
  3. data/.gitignore +3 -1
  4. data/.rubocop.yml +1 -0
  5. data/.rubocop_todo.yml +296 -0
  6. data/Gemfile +5 -3
  7. data/Gemfile.lock +31 -4
  8. data/README.md +108 -54
  9. data/Rakefile +8 -6
  10. data/bin/console +4 -3
  11. data/examples/appointments.rb +70 -42
  12. data/examples/forms.rb +20 -22
  13. data/examples/groups.rb +20 -0
  14. data/examples/promotions.rb +32 -0
  15. data/examples/schedules.rb +23 -11
  16. data/examples/users.rb +31 -23
  17. data/lib/supersaas-api-client/api/appointments.rb +37 -25
  18. data/lib/supersaas-api-client/api/base_api.rb +69 -23
  19. data/lib/supersaas-api-client/api/forms.rb +16 -9
  20. data/lib/supersaas-api-client/api/groups.rb +12 -0
  21. data/lib/supersaas-api-client/api/promotions.rb +29 -0
  22. data/lib/supersaas-api-client/api/schedules.rb +14 -4
  23. data/lib/supersaas-api-client/api/users.rb +28 -15
  24. data/lib/supersaas-api-client/client.rb +101 -35
  25. data/lib/supersaas-api-client/exception.rb +3 -1
  26. data/lib/supersaas-api-client/models/appointment.rb +9 -12
  27. data/lib/supersaas-api-client/models/base_model.rb +4 -1
  28. data/lib/supersaas-api-client/models/field_list.rb +12 -0
  29. data/lib/supersaas-api-client/models/form.rb +5 -2
  30. data/lib/supersaas-api-client/models/group.rb +7 -0
  31. data/lib/supersaas-api-client/models/promotion.rb +7 -0
  32. data/lib/supersaas-api-client/models/resource.rb +3 -1
  33. data/lib/supersaas-api-client/models/schedule.rb +3 -1
  34. data/lib/supersaas-api-client/models/slot.rb +4 -6
  35. data/lib/supersaas-api-client/models/super_form.rb +7 -0
  36. data/lib/supersaas-api-client/models/user.rb +5 -8
  37. data/lib/supersaas-api-client/version.rb +4 -2
  38. data/lib/supersaas-api-client.rb +3 -1
  39. data/lib/supersaas.rb +23 -15
  40. data/supersaas-api-client.gemspec +19 -18
  41. metadata +40 -26
  42. data/test/appointments_test.rb +0 -99
  43. data/test/client_test.rb +0 -46
  44. data/test/forms_test.rb +0 -22
  45. data/test/schedules_test.rb +0 -19
  46. data/test/test_helper.rb +0 -23
  47. data/test/users_test.rb +0 -68
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Supersaas
2
4
  class Schedule < BaseModel
3
5
  attr_accessor :id, :name
4
6
  end
5
- end
7
+ end
@@ -1,14 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Supersaas
2
4
  class Slot < BaseModel
3
5
  attr_accessor :count, :description, :finish, :id, :location, :name, :start, :title
4
6
  attr_reader :bookings
5
7
 
6
8
  def bookings=(value)
7
- if value.is_a?(Array)
8
- @bookings = value.map {|attributes| Supersaas::Appointment.new(attributes) }
9
- else
10
- @bookings = value
11
- end
9
+ @bookings = value.is_a?(Array) ? value.map { |attributes| Supersaas::Appointment.new(attributes) } : value
12
10
  end
13
11
  end
14
- end
12
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Supersaas
4
+ class SuperForm < BaseModel
5
+ attr_accessor :id, :name
6
+ end
7
+ end
@@ -1,16 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Supersaas
2
4
  class User < BaseModel
3
- ROLES = [3, 4, -1]
5
+ ROLES = [3, 4, -1].freeze
4
6
 
5
- attr_accessor :address, :country, :created_on, :credit, :email, :field_1, :field_2, :fk, :full_name, :id, :mobile, :name, :phone, :role, :super_field
6
7
  attr_reader :form
7
8
 
8
9
  def form=(value)
9
- if value.is_a?(Hash)
10
- @form = Supersaas::Form.new(value)
11
- else
12
- @form = value
13
- end
10
+ @form = value.is_a?(Hash) ? Supersaas::Form.new(value) : value
14
11
  end
15
12
  end
16
- end
13
+ end
@@ -1,4 +1,6 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Supersaas
2
- API_VERSION = '2'
3
- VERSION = '1.1.1'
4
+ API_VERSION = '3'
5
+ VERSION = '2.0.0'
4
6
  end
@@ -1 +1,3 @@
1
- require_relative './supersaas'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'supersaas'
data/lib/supersaas.rb CHANGED
@@ -1,15 +1,23 @@
1
- require "supersaas-api-client/version"
2
- require "supersaas-api-client/exception"
3
- require "supersaas-api-client/models/base_model"
4
- require "supersaas-api-client/models/appointment"
5
- require "supersaas-api-client/models/form"
6
- require "supersaas-api-client/models/resource"
7
- require "supersaas-api-client/models/schedule"
8
- require "supersaas-api-client/models/slot"
9
- require "supersaas-api-client/models/user"
10
- require "supersaas-api-client/api/base_api"
11
- require "supersaas-api-client/api/appointments"
12
- require "supersaas-api-client/api/forms"
13
- require "supersaas-api-client/api/schedules"
14
- require "supersaas-api-client/api/users"
15
- require "supersaas-api-client/client"
1
+ # frozen_string_literal: true
2
+
3
+ require 'supersaas-api-client/version'
4
+ require 'supersaas-api-client/exception'
5
+ require 'supersaas-api-client/models/base_model'
6
+ require 'supersaas-api-client/models/appointment'
7
+ require 'supersaas-api-client/models/field_list'
8
+ require 'supersaas-api-client/models/form'
9
+ require 'supersaas-api-client/models/super_form'
10
+ require 'supersaas-api-client/models/group'
11
+ require 'supersaas-api-client/models/resource'
12
+ require 'supersaas-api-client/models/schedule'
13
+ require 'supersaas-api-client/models/promotion'
14
+ require 'supersaas-api-client/models/slot'
15
+ require 'supersaas-api-client/models/user'
16
+ require 'supersaas-api-client/api/base_api'
17
+ require 'supersaas-api-client/api/appointments'
18
+ require 'supersaas-api-client/api/forms'
19
+ require 'supersaas-api-client/api/schedules'
20
+ require 'supersaas-api-client/api/groups'
21
+ require 'supersaas-api-client/api/promotions'
22
+ require 'supersaas-api-client/api/users'
23
+ require 'supersaas-api-client/client'
@@ -1,27 +1,28 @@
1
- $:.push File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
2
 
3
- require "supersaas-api-client/version"
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'supersaas-api-client/version'
4
6
 
5
7
  Gem::Specification.new do |spec|
6
- spec.name = "supersaas-api-client"
8
+ spec.name = 'supersaas-api-client'
7
9
  spec.version = Supersaas::VERSION
8
- spec.authors = ["Travis Dunn"]
9
- spec.email = ["travis@supersaas.com"]
10
+ spec.authors = ['Kaarle Kulvik']
11
+ spec.email = ['kaarle@supersaas.com']
10
12
 
11
- spec.summary = %q{Online bookings/appointments/calendars using the SuperSaaS scheduling platform.}
12
- spec.description = %q{Online appointment scheduler for any type of business. Flexible and affordable booking software that can be integrated into any site. Free basic version.}
13
- spec.homepage = "https://www.supersaas.com"
14
- spec.license = "MIT"
13
+ spec.summary = 'Manage appointments and users on the SuperSaaS scheduling platform'
14
+ spec.description = 'Online appointment scheduling for any type of business. Flexible and affordable booking software that can be integrated into any site. Free basic version.'
15
+ spec.homepage = 'https://www.supersaas.com'
16
+ spec.license = 'MIT'
15
17
 
16
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
- f.match(%r{^(test)/})
18
- end
19
- spec.test_files = Dir['test/**/*']
20
- spec.bindir = "bin"
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^test/}) }
19
+ spec.bindir = 'bin'
21
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
21
+ spec.require_paths = ['lib']
23
22
 
24
- spec.add_development_dependency "bundler"
25
- spec.add_development_dependency "rake"
26
- spec.add_development_dependency "minitest"
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'minitest'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rubocop'
27
+ spec.metadata['rubygems_mfa_required'] = 'true'
27
28
  end
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: 1.1.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Travis Dunn
8
- autorequire:
7
+ - Kaarle Kulvik
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-29 00:00:00.000000000 Z
11
+ date: 2024-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: rake
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +53,7 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: minitest
56
+ name: rubocop
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
@@ -52,17 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
- description: Online appointment scheduler for any type of business. Flexible and affordable
56
- booking software that can be integrated into any site. Free basic version.
69
+ description: Online appointment scheduling for any type of business. Flexible and
70
+ affordable booking software that can be integrated into any site. Free basic version.
57
71
  email:
58
- - travis@supersaas.com
72
+ - kaarle@supersaas.com
59
73
  executables:
60
74
  - console
61
75
  - setup
62
76
  extensions: []
63
77
  extra_rdoc_files: []
64
78
  files:
79
+ - ".github/workflows/actions.yaml"
65
80
  - ".gitignore"
81
+ - ".rubocop.yml"
82
+ - ".rubocop_todo.yml"
66
83
  - Gemfile
67
84
  - Gemfile.lock
68
85
  - LICENSE
@@ -72,37 +89,40 @@ files:
72
89
  - bin/setup
73
90
  - examples/appointments.rb
74
91
  - examples/forms.rb
92
+ - examples/groups.rb
93
+ - examples/promotions.rb
75
94
  - examples/schedules.rb
76
95
  - examples/users.rb
77
96
  - lib/supersaas-api-client.rb
78
97
  - lib/supersaas-api-client/api/appointments.rb
79
98
  - lib/supersaas-api-client/api/base_api.rb
80
99
  - lib/supersaas-api-client/api/forms.rb
100
+ - lib/supersaas-api-client/api/groups.rb
101
+ - lib/supersaas-api-client/api/promotions.rb
81
102
  - lib/supersaas-api-client/api/schedules.rb
82
103
  - lib/supersaas-api-client/api/users.rb
83
104
  - lib/supersaas-api-client/client.rb
84
105
  - lib/supersaas-api-client/exception.rb
85
106
  - lib/supersaas-api-client/models/appointment.rb
86
107
  - lib/supersaas-api-client/models/base_model.rb
108
+ - lib/supersaas-api-client/models/field_list.rb
87
109
  - lib/supersaas-api-client/models/form.rb
110
+ - lib/supersaas-api-client/models/group.rb
111
+ - lib/supersaas-api-client/models/promotion.rb
88
112
  - lib/supersaas-api-client/models/resource.rb
89
113
  - lib/supersaas-api-client/models/schedule.rb
90
114
  - lib/supersaas-api-client/models/slot.rb
115
+ - lib/supersaas-api-client/models/super_form.rb
91
116
  - lib/supersaas-api-client/models/user.rb
92
117
  - lib/supersaas-api-client/version.rb
93
118
  - lib/supersaas.rb
94
119
  - supersaas-api-client.gemspec
95
- - test/appointments_test.rb
96
- - test/client_test.rb
97
- - test/forms_test.rb
98
- - test/schedules_test.rb
99
- - test/test_helper.rb
100
- - test/users_test.rb
101
120
  homepage: https://www.supersaas.com
102
121
  licenses:
103
122
  - MIT
104
- metadata: {}
105
- post_install_message:
123
+ metadata:
124
+ rubygems_mfa_required: 'true'
125
+ post_install_message:
106
126
  rdoc_options: []
107
127
  require_paths:
108
128
  - lib
@@ -117,14 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
137
  - !ruby/object:Gem::Version
118
138
  version: '0'
119
139
  requirements: []
120
- rubygems_version: 3.0.4
121
- signing_key:
140
+ rubygems_version: 3.4.22
141
+ signing_key:
122
142
  specification_version: 4
123
- summary: Online bookings/appointments/calendars using the SuperSaaS scheduling platform.
124
- test_files:
125
- - test/forms_test.rb
126
- - test/client_test.rb
127
- - test/test_helper.rb
128
- - test/users_test.rb
129
- - test/schedules_test.rb
130
- - test/appointments_test.rb
143
+ summary: Manage appointments and users on the SuperSaaS scheduling platform
144
+ test_files: []
@@ -1,99 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Supersaas
4
- class AppointmentsTest < SupersaasTest
5
- def setup
6
- @client = Supersaas::Client.instance
7
- @client.account_name = 'accnt'
8
- @client.api_key = 'xxxxxxxxxxxxxxxxxxxxxx'
9
- @client.dry_run = true
10
- @schedule_id = 12345
11
- @appointment_id = 67890
12
- @user_id = 9876
13
- end
14
-
15
- def test_get
16
- refute_nil @client.appointments.get(@schedule_id, @appointment_id)
17
- assert_last_request_path "/api/bookings/#{@appointment_id}.json?schedule_id=#{@schedule_id}"
18
- end
19
-
20
- def test_list
21
- start_time = Time.now
22
- limit = 10
23
- form = true
24
- refute_nil @client.appointments.list(@schedule_id, form, start_time, limit)
25
- assert_last_request_path "/api/bookings.json?schedule_id=#{@schedule_id}&form=true&#{URI.encode_www_form(start: start_time.strftime("%Y-%m-%d %H:%M:%S"))}&limit=#{limit}"
26
- end
27
-
28
- def test_create
29
- refute_nil @client.appointments.create(@schedule_id, @user_id, appointment_attributes, true, true)
30
- assert_last_request_path "/api/bookings.json"
31
- end
32
-
33
- def test_update
34
- refute_nil @client.appointments.update(@schedule_id, @appointment_id, appointment_attributes)
35
- assert_last_request_path "/api/bookings/#{@appointment_id}.json"
36
- end
37
-
38
- def test_agenda
39
- refute_nil @client.appointments.agenda(@schedule_id, @user_id).inspect
40
- assert_last_request_path "/api/agenda/#{@schedule_id}.json?user=#{@user_id}"
41
- end
42
-
43
- def test_agenda_slots
44
- refute_nil @client.appointments.agenda_slots(@schedule_id, @user_id).inspect
45
- assert_last_request_path "/api/agenda/#{@schedule_id}.json?user=#{@user_id}&slot=true"
46
- end
47
-
48
- def test_available
49
- from_time = Time.now
50
- refute_nil @client.appointments.available(@schedule_id, from_time)
51
- assert_last_request_path "/api/free/#{@schedule_id}.json?#{URI.encode_www_form(from: from_time.strftime("%Y-%m-%d %H:%M:%S"))}"
52
- end
53
-
54
- def test_available_full
55
- length_minutes = 15
56
- resource = 'MyResource'
57
- limit = 10
58
- refute_nil @client.appointments.available(@schedule_id, "2017-01-31 14:30:00", length_minutes, resource, true, limit)
59
- assert_last_request_path "/api/free/#{@schedule_id}.json?length=#{length_minutes}&#{URI.encode_www_form(from: "2017-01-31 14:30:00")}&resource=#{resource}&full=true&maxresults=#{limit}"
60
- end
61
-
62
- def test_changes
63
- from = "2017-01-31 14:30:00"
64
- refute_nil @client.appointments.changes(@schedule_id, from)
65
- assert_last_request_path "/api/changes/#{@schedule_id}.json?#{URI.encode_www_form(from: from)}"
66
- end
67
-
68
- def test_range
69
- from = "2017-01-31 14:30:00"
70
- refute_nil @client.appointments.range(@schedule_id, false, from)
71
- assert_last_request_path "/api/range/#{@schedule_id}.json?#{URI.encode_www_form(from: from)}"
72
- end
73
-
74
- def test_delete
75
- refute_nil @client.appointments.delete(@schedule_id, @appointment_id)
76
- assert_last_request_path "/api/bookings/#{@appointment_id}.json?schedule_id=#{@schedule_id}"
77
- end
78
-
79
- private
80
-
81
- def appointment_attributes
82
- {
83
- description: 'Testing.',
84
- name: 'Test',
85
- email: 'test@example.com',
86
- full_name: 'Tester Test',
87
- address: '123 St, City',
88
- mobile: '555-5555',
89
- phone: '555-5555',
90
- country: 'FR',
91
- field_1: 'f 1',
92
- field_2: 'f 2',
93
- field_1_r: 'f 1 r',
94
- field_2_r: 'f 2 r',
95
- super_field: 'sf'
96
- }
97
- end
98
- end
99
- end
data/test/client_test.rb DELETED
@@ -1,46 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Supersaas
4
- class ClientTest < SupersaasTest
5
- def setup
6
- config = Supersaas::Client::Configuration.new
7
- @client = Supersaas::Client.new(config)
8
- @client.dry_run = true
9
- end
10
-
11
- def test_api
12
- refute_nil @client.appointments
13
- refute_nil @client.forms
14
- refute_nil @client.schedules
15
- refute_nil @client.users
16
- end
17
-
18
- def test_request_methods
19
- @client.account_name = 'Test'
20
- @client.api_key = 'testing123'
21
- [:get,:put,:post,:delete].each do |method|
22
- refute_nil @client.send(method, '/test')
23
- assert_equal method.to_s.upcase, @client.last_request.method
24
- assert_equal '/api/test.json', @client.last_request.path
25
- end
26
- assert_equal 'Basic VGVzdDp0ZXN0aW5nMTIz', @client.last_request['Authorization']
27
- assert_equal 'application/json', @client.last_request['Accept']
28
- assert_equal 'application/json', @client.last_request['Content-Type']
29
- end
30
-
31
- def test_instance_configuration
32
- Supersaas::Client.configure do |config|
33
- config.account_name = 'account'
34
- config.api_key = 'api_key'
35
- config.host = 'http://test'
36
- config.dry_run = true
37
- config.verbose = true
38
- end
39
- assert_equal 'account', Supersaas::Client.configuration.account_name
40
- assert_equal 'api_key', Supersaas::Client.configuration.api_key
41
- assert_equal 'http://test', Supersaas::Client.configuration.host
42
- assert_equal true, Supersaas::Client.configuration.dry_run
43
- assert_equal true, Supersaas::Client.configuration.verbose
44
- end
45
- end
46
- end
data/test/forms_test.rb DELETED
@@ -1,22 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Supersaas
4
- class FormsTest < SupersaasTest
5
- def setup
6
- @client = client_instance
7
- @super_form_id = 12345
8
- @form_id = 67890
9
- end
10
-
11
- def test_list
12
- from = Time.now
13
- refute_nil @client.forms.list(@super_form_id, from)
14
- assert_last_request_path "/api/forms.json?form_id=#{@super_form_id}&#{URI.encode_www_form(from: from.strftime("%Y-%m-%d %H:%M:%S"))}"
15
- end
16
-
17
- def test_get
18
- refute_nil @client.forms.get(@form_id)
19
- assert_last_request_path "/api/forms.json?id=#{@form_id}"
20
- end
21
- end
22
- end
@@ -1,19 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Supersaas
4
- class SchedulesTest < SupersaasTest
5
- def setup
6
- @client = client_instance
7
- end
8
-
9
- def test_list
10
- refute_nil @client.schedules.list
11
- assert_last_request_path "/api/schedules.json"
12
- end
13
-
14
- def test_resources
15
- refute_nil @client.schedules.resources(12345)
16
- assert_last_request_path "/api/resources.json?schedule_id=12345"
17
- end
18
- end
19
- end
data/test/test_helper.rb DELETED
@@ -1,23 +0,0 @@
1
- $:.push File.expand_path('../../lib', __FILE__)
2
-
3
- require "supersaas-api-client"
4
-
5
- require "minitest/autorun"
6
-
7
- class SupersaasTest < Minitest::Test
8
- def assert_last_request_path(path)
9
- assert_equal path, @client.last_request.path
10
- end
11
-
12
- protected
13
-
14
- def client_instance
15
- if !defined? @client
16
- @client = Supersaas::Client.instance
17
- @client.account_name = 'accnt'
18
- @client.api_key = 'xxxxxxxxxxxxxxxxxxxxxx'
19
- @client.dry_run = true
20
- end
21
- @client
22
- end
23
- end
data/test/users_test.rb DELETED
@@ -1,68 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Supersaas
4
- class UsersTest < SupersaasTest
5
- def setup
6
- @client = client_instance
7
- @user_id = 12345
8
- @user_fk = '6789fk'
9
- end
10
-
11
- def test_get
12
- refute_nil @client.users.get(@user_id)
13
- assert_last_request_path "/api/users/#{@user_id}.json"
14
- end
15
-
16
- def test_get_fk
17
- refute_nil @client.users.get(@user_fk)
18
- assert_last_request_path "/api/users/#{@user_fk}.json"
19
- end
20
-
21
- def test_list
22
- limit = 10
23
- offset = 0
24
- refute_nil @client.users.list(true, limit, offset)
25
- assert_last_request_path "/api/users.json?form=true&limit=#{limit}&offset=#{offset}"
26
- end
27
-
28
- def test_create
29
- refute_nil @client.users.create(user_attributes)
30
- assert_last_request_path "/api/users.json"
31
- end
32
-
33
- def test_create_fk
34
- refute_nil @client.users.create(user_attributes, @user_fk, true)
35
- assert_last_request_path "/api/users/#{@user_fk}.json?webhook=true"
36
- end
37
-
38
- def test_update
39
- refute_nil @client.users.update(@user_id, user_attributes, true)
40
- assert_last_request_path "/api/users/#{@user_id}.json?webhook=true"
41
- end
42
-
43
- def test_delete
44
- refute_nil @client.users.delete(@user_id)
45
- assert_last_request_path "/api/users/#{@user_id}.json"
46
- end
47
-
48
- private
49
-
50
- def user_attributes
51
- {
52
- name: 'Test',
53
- email: 'test@example.com',
54
- password: 'pass123',
55
- full_name: 'Tester Test',
56
- address: '123 St, City',
57
- mobile: '555-5555',
58
- phone: '555-5555',
59
- country: 'FR',
60
- field_1: 'f 1',
61
- field_2: 'f 2',
62
- super_field: 'sf',
63
- credit: 10,
64
- role: 3
65
- }
66
- end
67
- end
68
- end