supersaas-api-client 1.0.0 → 1.1.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 +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +3 -3
- data/README.md +11 -9
- data/examples/appointments.rb +1 -1
- data/lib/supersaas-api-client/api/appointments.rb +14 -9
- data/lib/supersaas-api-client/client.rb +4 -0
- data/lib/supersaas-api-client/version.rb +1 -1
- data/supersaas-api-client.gemspec +1 -1
- data/test/appointments_test.rb +4 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0594cc1556a00fbce6efb522bc71f4aa359367a5523a6350661e127b2e4938b
|
4
|
+
data.tar.gz: 3c9f1d8520d2c631e560769d4d83e45f0b845a9f1e16d367baf69c8ae718d687
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e687af87475439d8759f7833723ff14d6d04e418b80c7857bc14dbbc1be6140ef6855e5fe4874abada6512fa9b71a95d755c2871613854610b14a03c7d44bdfe
|
7
|
+
data.tar.gz: 7042e08b1629897c493ce6edb88715cd5340c0f4325822540050eef8adc701416a94e2cd670a8d19332c7708416ef6480a150b0e80cc525001e26b766be0a236
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
supersaas-api-client (
|
4
|
+
supersaas-api-client (1.1.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -13,10 +13,10 @@ PLATFORMS
|
|
13
13
|
ruby
|
14
14
|
|
15
15
|
DEPENDENCIES
|
16
|
-
bundler (~> 1.
|
16
|
+
bundler (~> 1.17.3)
|
17
17
|
minitest (~> 5.0)
|
18
18
|
rake (~> 10.0)
|
19
19
|
supersaas-api-client!
|
20
20
|
|
21
21
|
BUNDLED WITH
|
22
|
-
1.
|
22
|
+
1.17.3
|
data/README.md
CHANGED
@@ -145,13 +145,13 @@ List appointments by `schedule_id`, with `form` and `start_time` and `limit` vie
|
|
145
145
|
|
146
146
|
Get agenda (upcoming) appointments by `schedule_id` and `user_id`, with `from_time` view param:
|
147
147
|
|
148
|
-
Supersaas::Client.instance.appointments.agenda(12345, 67890, '2018-
|
148
|
+
Supersaas::Client.instance.appointments.agenda(12345, 67890, '2018-01-31 00:00:00') #=> [<Supersaas::Appointment>, ...]
|
149
149
|
|
150
150
|
#### Get Agenda Slots
|
151
151
|
|
152
152
|
Get agenda (upcoming) slots by `schedule_id` and `user_id`, with `from_time` view param:
|
153
153
|
|
154
|
-
Supersaas::Client.instance.appointments.agenda_slots(12345, 67890, '2018-
|
154
|
+
Supersaas::Client.instance.appointments.agenda_slots(12345, 67890, '2018-01-31 00:00:00') #=> [<Supersaas::Slot>, ...]
|
155
155
|
|
156
156
|
_Note: works only for capacity type schedules._
|
157
157
|
|
@@ -159,25 +159,27 @@ _Note: works only for capacity type schedules._
|
|
159
159
|
|
160
160
|
Get available appointments by `schedule_id`, with `from` time and `length_minutes` and `resource` params:
|
161
161
|
|
162
|
-
Supersaas::Client.instance.appointments.available(12345, '2018-
|
162
|
+
Supersaas::Client.instance.appointments.available(12345, '2018-01-31 00:00:00', 15, 'My Class') #=> [<Supersaas::Appointment>, ...]
|
163
163
|
|
164
164
|
#### Get Recent Changes
|
165
165
|
|
166
|
-
Get recently changed appointments by `schedule_id`, with `
|
166
|
+
Get recently changed appointments by `schedule_id`, with `from` time, `to` time and `slot` view param:
|
167
167
|
|
168
|
-
Supersaas::Client.instance.appointments.changes(12345, '2018-
|
168
|
+
Supersaas::Client.instance.appointments.changes(12345, '2018-01-31 00:00:00', '2019-01-31 00:00:00', true) #=> [<Supersaas::Appointment>, ...]
|
169
169
|
|
170
|
-
#### Get Recent Changes Slots
|
171
170
|
|
172
|
-
Get
|
171
|
+
#### Get list of appointments
|
172
|
+
|
173
|
+
Get list of appointments by `schedule_id`, with `today`,`from` time, `to` time and `slot` view param:
|
174
|
+
|
175
|
+
Supersaas::Client.instance.appointments.range(12345, false, '2018-01-31 00:00:00', '2019-01-31 00:00:00', true) #=> [<Supersaas::Appointment>, ...]/[<Supersaas::Slot>, ...]
|
173
176
|
|
174
|
-
Supersaas::Client.instance.appointments.changes_slots(12345, '2018-1-31 00:00:00', true) #=> [<Supersaas::Slot>, ...]
|
175
177
|
|
176
178
|
#### List Template Forms
|
177
179
|
|
178
180
|
Get all forms by template `superform_id`, with `from_time` param:
|
179
181
|
|
180
|
-
Supersaas::Client.instance.forms.list(12345, '2018-
|
182
|
+
Supersaas::Client.instance.forms.list(12345, '2018-01-31 00:00:00') #=> [<Supersaas::Form>, ...]
|
181
183
|
|
182
184
|
#### Get Form
|
183
185
|
|
data/examples/appointments.rb
CHANGED
@@ -73,7 +73,7 @@ end
|
|
73
73
|
|
74
74
|
puts "\n\rlisting changes..."
|
75
75
|
from = DateTime.now - 120
|
76
|
-
puts "\n\r#### Supersaas::Client.instance.appointments.changes(#{schedule_id}, '#{from.strftime("%Y-%m-%d %H:%M:%S")}', #{show_slot || 'false'})\n\r"
|
76
|
+
puts "\n\r#### Supersaas::Client.instance.appointments.changes(#{schedule_id}, '#{from.strftime("%Y-%m-%d %H:%M:%S")}', '#{to.strftime("%Y-%m-%d %H:%M:%S")}', #{show_slot || 'false'})\n\r"
|
77
77
|
|
78
78
|
Supersaas::Client.instance.appointments.changes(schedule_id, from, show_slot)
|
79
79
|
|
@@ -117,21 +117,19 @@ module Supersaas
|
|
117
117
|
client.delete(path, nil, params)
|
118
118
|
end
|
119
119
|
|
120
|
-
def changes(schedule_id, from_time)
|
120
|
+
def changes(schedule_id, from_time=nil, to=nil, slot=false)
|
121
121
|
path = "/changes/#{validate_id(schedule_id)}"
|
122
|
-
params = {
|
122
|
+
params = build_param({}, from_time, to, slot)
|
123
123
|
res = client.get(path, params)
|
124
124
|
map_slots_or_bookings(res)
|
125
125
|
end
|
126
126
|
|
127
|
-
def
|
128
|
-
path = "/
|
129
|
-
params = {
|
130
|
-
|
131
|
-
slot: true
|
132
|
-
}
|
127
|
+
def range(schedule_id, today=false, from_time=nil, to=nil, slot=false)
|
128
|
+
path = "/range/#{validate_id(schedule_id)}"
|
129
|
+
params = {}; params.merge!(today: true) if today
|
130
|
+
params = build_param(params, from_time, to, slot)
|
133
131
|
res = client.get(path, params)
|
134
|
-
map_slots_or_bookings(res
|
132
|
+
map_slots_or_bookings(res)
|
135
133
|
end
|
136
134
|
|
137
135
|
private
|
@@ -149,5 +147,12 @@ module Supersaas
|
|
149
147
|
[]
|
150
148
|
end
|
151
149
|
end
|
150
|
+
|
151
|
+
def build_param(params, from_time, to, slot)
|
152
|
+
params.merge!(from: validate_datetime(from_time)) if from_time
|
153
|
+
params.merge!(to: validate_datetime(to)) if to
|
154
|
+
params.merge!(slot: true) if slot
|
155
|
+
params
|
156
|
+
end
|
152
157
|
end
|
153
158
|
end
|
@@ -121,6 +121,10 @@ module Supersaas
|
|
121
121
|
json_body(res)
|
122
122
|
when 422, 400
|
123
123
|
json_body(res)
|
124
|
+
when 401
|
125
|
+
raise Supersaas::Exception.new("HTTP Request Error: Unauthorised")
|
126
|
+
when 404
|
127
|
+
raise Supersaas::Exception.new("HTTP Request Error: Not Found")
|
124
128
|
else
|
125
129
|
{}
|
126
130
|
end
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.17.3"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
26
|
spec.add_development_dependency "minitest", "~> 5.0"
|
27
27
|
end
|
data/test/appointments_test.rb
CHANGED
@@ -65,10 +65,10 @@ module Supersaas
|
|
65
65
|
assert_last_request_path "/api/changes/#{@schedule_id}.json?#{URI.encode_www_form(from: from)}"
|
66
66
|
end
|
67
67
|
|
68
|
-
def
|
69
|
-
from =
|
70
|
-
refute_nil @client.appointments.
|
71
|
-
assert_last_request_path "/api/
|
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
72
|
end
|
73
73
|
|
74
74
|
def test_delete
|
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.
|
4
|
+
version: 1.1.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: 2019-
|
11
|
+
date: 2019-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.17.3
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.17.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
|
-
rubygems_version: 3.0.
|
120
|
+
rubygems_version: 3.0.4
|
121
121
|
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: Online bookings/appointments/calendars using the SuperSaaS scheduling platform.
|