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.
- checksums.yaml +4 -4
- data/.github/workflows/actions.yaml +21 -0
- data/.gitignore +3 -1
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +296 -0
- data/Gemfile +5 -3
- data/Gemfile.lock +31 -4
- data/README.md +108 -54
- data/Rakefile +8 -6
- data/bin/console +4 -3
- data/examples/appointments.rb +70 -42
- data/examples/forms.rb +20 -22
- data/examples/groups.rb +20 -0
- data/examples/promotions.rb +32 -0
- data/examples/schedules.rb +23 -11
- data/examples/users.rb +31 -23
- data/lib/supersaas-api-client/api/appointments.rb +37 -25
- data/lib/supersaas-api-client/api/base_api.rb +69 -23
- data/lib/supersaas-api-client/api/forms.rb +16 -9
- data/lib/supersaas-api-client/api/groups.rb +12 -0
- data/lib/supersaas-api-client/api/promotions.rb +29 -0
- data/lib/supersaas-api-client/api/schedules.rb +14 -4
- data/lib/supersaas-api-client/api/users.rb +28 -15
- data/lib/supersaas-api-client/client.rb +101 -35
- data/lib/supersaas-api-client/exception.rb +3 -1
- data/lib/supersaas-api-client/models/appointment.rb +9 -12
- data/lib/supersaas-api-client/models/base_model.rb +4 -1
- data/lib/supersaas-api-client/models/field_list.rb +12 -0
- data/lib/supersaas-api-client/models/form.rb +5 -2
- data/lib/supersaas-api-client/models/group.rb +7 -0
- data/lib/supersaas-api-client/models/promotion.rb +7 -0
- data/lib/supersaas-api-client/models/resource.rb +3 -1
- data/lib/supersaas-api-client/models/schedule.rb +3 -1
- data/lib/supersaas-api-client/models/slot.rb +4 -6
- data/lib/supersaas-api-client/models/super_form.rb +7 -0
- data/lib/supersaas-api-client/models/user.rb +5 -8
- data/lib/supersaas-api-client/version.rb +4 -2
- data/lib/supersaas-api-client.rb +3 -1
- data/lib/supersaas.rb +23 -15
- data/supersaas-api-client.gemspec +19 -18
- metadata +40 -26
- data/test/appointments_test.rb +0 -99
- data/test/client_test.rb +0 -46
- data/test/forms_test.rb +0 -22
- data/test/schedules_test.rb +0 -19
- data/test/test_helper.rb +0 -23
- data/test/users_test.rb +0 -68
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69136c9082483368bec705b15876862604aee77120860b916716fd24933dbb39
|
4
|
+
data.tar.gz: 4949acd898c133b10239f9b11e3c37ab3c535d00446d13c6f6fcc6e085e90bd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6940527d2f3ef447d2ef2bf34fad20df99ef88dccb5aedbc185f328047341c8f3c96293b3e5f3eea56952d004d83bbeac56c89762a32e71f5c99bdd05a6006b
|
7
|
+
data.tar.gz: 46dfe6591f66cc505bf5bb6915db31e0a6842335a225149931d111493a191eaa4df756734dcff1269423185379688436b210938fa0eda436e24a54dfd9adb7ba
|
@@ -0,0 +1,21 @@
|
|
1
|
+
name: SuperSaaS Ruby API Client CI
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [ main ]
|
5
|
+
pull_request:
|
6
|
+
branches: [ main ]
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
strategy:
|
10
|
+
fail-fast: false
|
11
|
+
matrix:
|
12
|
+
os: [ubuntu-latest, macos-latest]
|
13
|
+
ruby: ['3.0', '3.1', '3.2', '3.3', 'head', 'jruby', 'jruby-head']
|
14
|
+
runs-on: ${{ matrix.os }}
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: ${{ matrix.ruby }}
|
20
|
+
bundler-cache: true
|
21
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,296 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2024-01-17 11:07:18 UTC using RuboCop version 1.60.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 2
|
10
|
+
# Configuration parameters: Severity, Include.
|
11
|
+
# Include: **/*.gemspec
|
12
|
+
Gemspec/RequiredRubyVersion:
|
13
|
+
Exclude:
|
14
|
+
- 'supersaas-api-client.gemspec'
|
15
|
+
- 'supersaas-api-client/supersaas-api-client.gemspec'
|
16
|
+
|
17
|
+
# Offense count: 8
|
18
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
19
|
+
Metrics/AbcSize:
|
20
|
+
Max: 72
|
21
|
+
|
22
|
+
# Offense count: 2
|
23
|
+
# Configuration parameters: CountComments, CountAsOne.
|
24
|
+
Metrics/ClassLength:
|
25
|
+
Max: 200
|
26
|
+
|
27
|
+
# Offense count: 3
|
28
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
29
|
+
Metrics/CyclomaticComplexity:
|
30
|
+
Max: 20
|
31
|
+
|
32
|
+
# Offense count: 9
|
33
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
34
|
+
Metrics/MethodLength:
|
35
|
+
Max: 71
|
36
|
+
|
37
|
+
# Offense count: 7
|
38
|
+
# Configuration parameters: CountKeywordArgs.
|
39
|
+
Metrics/ParameterLists:
|
40
|
+
MaxOptionalParameters: 9
|
41
|
+
Max: 10
|
42
|
+
|
43
|
+
# Offense count: 3
|
44
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
45
|
+
Metrics/PerceivedComplexity:
|
46
|
+
Max: 17
|
47
|
+
|
48
|
+
# Offense count: 1
|
49
|
+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
50
|
+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
|
51
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
52
|
+
Naming/FileName:
|
53
|
+
Exclude:
|
54
|
+
- 'lib/supersaas-api-client.rb'
|
55
|
+
|
56
|
+
# Offense count: 22
|
57
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
58
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
59
|
+
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
60
|
+
Naming/VariableNumber:
|
61
|
+
Exclude:
|
62
|
+
- 'lib/supersaas-api-client/api/appointments.rb'
|
63
|
+
- 'lib/supersaas-api-client/api/users.rb'
|
64
|
+
- 'lib/supersaas-api-client/models/appointment.rb'
|
65
|
+
- 'test/appointments_test.rb'
|
66
|
+
- 'test/users_test.rb'
|
67
|
+
|
68
|
+
# Offense count: 18
|
69
|
+
# Configuration parameters: AllowedConstants.
|
70
|
+
Style/Documentation:
|
71
|
+
Enabled: false
|
72
|
+
|
73
|
+
# Offense count: 6
|
74
|
+
# This cop supports safe autocorrection (--autocorrect).
|
75
|
+
Style/IfUnlessModifier:
|
76
|
+
Exclude:
|
77
|
+
- 'lib/supersaas-api-client/api/base_api.rb'
|
78
|
+
- 'lib/supersaas-api-client/client.rb'
|
79
|
+
|
80
|
+
# Offense count: 5
|
81
|
+
# Configuration parameters: AllowedMethods.
|
82
|
+
# AllowedMethods: respond_to_missing?
|
83
|
+
Style/OptionalBooleanParameter:
|
84
|
+
Exclude:
|
85
|
+
- 'lib/supersaas-api-client/api/appointments.rb'
|
86
|
+
|
87
|
+
# Offense count: 6
|
88
|
+
# This cop supports safe autocorrection (--autocorrect).
|
89
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
90
|
+
# URISchemes: http, https
|
91
|
+
Layout/LineLength:
|
92
|
+
Max: 191
|
93
|
+
|
94
|
+
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
|
95
|
+
Enabled: true
|
96
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
97
|
+
Enabled: false
|
98
|
+
Gemspec/RequireMFA: # new in 1.23
|
99
|
+
Enabled: true
|
100
|
+
Layout/LineContinuationLeadingSpace: # new in 1.31
|
101
|
+
Enabled: true
|
102
|
+
Layout/LineContinuationSpacing: # new in 1.31
|
103
|
+
Enabled: true
|
104
|
+
Layout/LineEndStringConcatenationIndentation: # new in 1.18
|
105
|
+
Enabled: true
|
106
|
+
Layout/SpaceBeforeBrackets: # new in 1.7
|
107
|
+
Enabled: true
|
108
|
+
Lint/AmbiguousAssignment: # new in 1.7
|
109
|
+
Enabled: true
|
110
|
+
Lint/AmbiguousOperatorPrecedence: # new in 1.21
|
111
|
+
Enabled: true
|
112
|
+
Lint/AmbiguousRange: # new in 1.19
|
113
|
+
Enabled: true
|
114
|
+
Lint/ConstantOverwrittenInRescue: # new in 1.31
|
115
|
+
Enabled: true
|
116
|
+
Lint/DeprecatedConstants: # new in 1.8
|
117
|
+
Enabled: true
|
118
|
+
Lint/DuplicateBranch: # new in 1.3
|
119
|
+
Enabled: true
|
120
|
+
Lint/DuplicateMagicComment: # new in 1.37
|
121
|
+
Enabled: true
|
122
|
+
Lint/DuplicateMatchPattern: # new in 1.50
|
123
|
+
Enabled: true
|
124
|
+
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
|
125
|
+
Enabled: true
|
126
|
+
Lint/EmptyBlock: # new in 1.1
|
127
|
+
Enabled: true
|
128
|
+
Lint/EmptyClass: # new in 1.3
|
129
|
+
Enabled: true
|
130
|
+
Lint/EmptyInPattern: # new in 1.16
|
131
|
+
Enabled: true
|
132
|
+
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
|
133
|
+
Enabled: true
|
134
|
+
Lint/ItWithoutArgumentsInBlock: # new in 1.59
|
135
|
+
Enabled: true
|
136
|
+
Lint/LambdaWithoutLiteralBlock: # new in 1.8
|
137
|
+
Enabled: true
|
138
|
+
Lint/LiteralAssignmentInCondition: # new in 1.58
|
139
|
+
Enabled: true
|
140
|
+
Lint/MixedCaseRange: # new in 1.53
|
141
|
+
Enabled: true
|
142
|
+
Lint/NoReturnInBeginEndBlocks: # new in 1.2
|
143
|
+
Enabled: true
|
144
|
+
Lint/NonAtomicFileOperation: # new in 1.31
|
145
|
+
Enabled: true
|
146
|
+
Lint/NumberedParameterAssignment: # new in 1.9
|
147
|
+
Enabled: true
|
148
|
+
Lint/OrAssignmentToConstant: # new in 1.9
|
149
|
+
Enabled: true
|
150
|
+
Lint/RedundantDirGlobSort: # new in 1.8
|
151
|
+
Enabled: true
|
152
|
+
Lint/RedundantRegexpQuantifiers: # new in 1.53
|
153
|
+
Enabled: true
|
154
|
+
Lint/RefinementImportMethods: # new in 1.27
|
155
|
+
Enabled: true
|
156
|
+
Lint/RequireRangeParentheses: # new in 1.32
|
157
|
+
Enabled: true
|
158
|
+
Lint/RequireRelativeSelfPath: # new in 1.22
|
159
|
+
Enabled: true
|
160
|
+
Lint/SymbolConversion: # new in 1.9
|
161
|
+
Enabled: true
|
162
|
+
Lint/ToEnumArguments: # new in 1.1
|
163
|
+
Enabled: true
|
164
|
+
Lint/TripleQuotes: # new in 1.9
|
165
|
+
Enabled: true
|
166
|
+
Lint/UnexpectedBlockArity: # new in 1.5
|
167
|
+
Enabled: true
|
168
|
+
Lint/UnmodifiedReduceAccumulator: # new in 1.1
|
169
|
+
Enabled: true
|
170
|
+
Lint/UselessRescue: # new in 1.43
|
171
|
+
Enabled: true
|
172
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
173
|
+
Enabled: true
|
174
|
+
Metrics/CollectionLiteralLength: # new in 1.47
|
175
|
+
Enabled: true
|
176
|
+
Naming/BlockForwarding: # new in 1.24
|
177
|
+
Enabled: true
|
178
|
+
Security/CompoundHash: # new in 1.28
|
179
|
+
Enabled: true
|
180
|
+
Security/IoMethods: # new in 1.22
|
181
|
+
Enabled: true
|
182
|
+
Style/ArgumentsForwarding: # new in 1.1
|
183
|
+
Enabled: true
|
184
|
+
Style/ArrayIntersect: # new in 1.40
|
185
|
+
Enabled: true
|
186
|
+
Style/CollectionCompact: # new in 1.2
|
187
|
+
Enabled: true
|
188
|
+
Style/ComparableClamp: # new in 1.44
|
189
|
+
Enabled: true
|
190
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
191
|
+
Enabled: true
|
192
|
+
Style/DataInheritance: # new in 1.49
|
193
|
+
Enabled: true
|
194
|
+
Style/DirEmpty: # new in 1.48
|
195
|
+
Enabled: true
|
196
|
+
Style/DocumentDynamicEvalDefinition: # new in 1.1
|
197
|
+
Enabled: true
|
198
|
+
Style/EmptyHeredoc: # new in 1.32
|
199
|
+
Enabled: true
|
200
|
+
Style/EndlessMethod: # new in 1.8
|
201
|
+
Enabled: true
|
202
|
+
Style/EnvHome: # new in 1.29
|
203
|
+
Enabled: true
|
204
|
+
Style/ExactRegexpMatch: # new in 1.51
|
205
|
+
Enabled: true
|
206
|
+
Style/FetchEnvVar: # new in 1.28
|
207
|
+
Enabled: true
|
208
|
+
Style/FileEmpty: # new in 1.48
|
209
|
+
Enabled: true
|
210
|
+
Style/FileRead: # new in 1.24
|
211
|
+
Enabled: true
|
212
|
+
Style/FileWrite: # new in 1.24
|
213
|
+
Enabled: true
|
214
|
+
Style/HashConversion: # new in 1.10
|
215
|
+
Enabled: true
|
216
|
+
Style/HashExcept: # new in 1.7
|
217
|
+
Enabled: true
|
218
|
+
Style/IfWithBooleanLiteralBranches: # new in 1.9
|
219
|
+
Enabled: true
|
220
|
+
Style/InPatternThen: # new in 1.16
|
221
|
+
Enabled: true
|
222
|
+
Style/MagicCommentFormat: # new in 1.35
|
223
|
+
Enabled: true
|
224
|
+
Style/MapCompactWithConditionalBlock: # new in 1.30
|
225
|
+
Enabled: true
|
226
|
+
Style/MapToHash: # new in 1.24
|
227
|
+
Enabled: true
|
228
|
+
Style/MapToSet: # new in 1.42
|
229
|
+
Enabled: true
|
230
|
+
Style/MinMaxComparison: # new in 1.42
|
231
|
+
Enabled: true
|
232
|
+
Style/MultilineInPatternThen: # new in 1.16
|
233
|
+
Enabled: true
|
234
|
+
Style/NegatedIfElseCondition: # new in 1.2
|
235
|
+
Enabled: true
|
236
|
+
Style/NestedFileDirname: # new in 1.26
|
237
|
+
Enabled: true
|
238
|
+
Style/NilLambda: # new in 1.3
|
239
|
+
Enabled: true
|
240
|
+
Style/NumberedParameters: # new in 1.22
|
241
|
+
Enabled: true
|
242
|
+
Style/NumberedParametersLimit: # new in 1.22
|
243
|
+
Enabled: true
|
244
|
+
Style/ObjectThen: # new in 1.28
|
245
|
+
Enabled: true
|
246
|
+
Style/OpenStructUse: # new in 1.23
|
247
|
+
Enabled: true
|
248
|
+
Style/OperatorMethodCall: # new in 1.37
|
249
|
+
Enabled: true
|
250
|
+
Style/QuotedSymbols: # new in 1.16
|
251
|
+
Enabled: true
|
252
|
+
Style/RedundantArgument: # new in 1.4
|
253
|
+
Enabled: true
|
254
|
+
Style/RedundantArrayConstructor: # new in 1.52
|
255
|
+
Enabled: true
|
256
|
+
Style/RedundantConstantBase: # new in 1.40
|
257
|
+
Enabled: true
|
258
|
+
Style/RedundantCurrentDirectoryInPath: # new in 1.53
|
259
|
+
Enabled: true
|
260
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
261
|
+
Enabled: true
|
262
|
+
Style/RedundantEach: # new in 1.38
|
263
|
+
Enabled: true
|
264
|
+
Style/RedundantFilterChain: # new in 1.52
|
265
|
+
Enabled: true
|
266
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
267
|
+
Enabled: true
|
268
|
+
Style/RedundantInitialize: # new in 1.27
|
269
|
+
Enabled: true
|
270
|
+
Style/RedundantLineContinuation: # new in 1.49
|
271
|
+
Enabled: true
|
272
|
+
Style/RedundantRegexpArgument: # new in 1.53
|
273
|
+
Enabled: true
|
274
|
+
Style/RedundantRegexpConstructor: # new in 1.52
|
275
|
+
Enabled: true
|
276
|
+
Style/RedundantSelfAssignmentBranch: # new in 1.19
|
277
|
+
Enabled: true
|
278
|
+
Style/RedundantStringEscape: # new in 1.37
|
279
|
+
Enabled: true
|
280
|
+
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
|
281
|
+
Enabled: true
|
282
|
+
Style/SelectByRegexp: # new in 1.22
|
283
|
+
Enabled: true
|
284
|
+
Style/SingleLineDoEndBlock: # new in 1.57
|
285
|
+
Enabled: true
|
286
|
+
Style/StringChars: # new in 1.12
|
287
|
+
Enabled: true
|
288
|
+
Style/SuperWithArgsParentheses: # new in 1.58
|
289
|
+
Enabled: true
|
290
|
+
Style/SwapValues: # new in 1.1
|
291
|
+
Enabled: true
|
292
|
+
Style/YAMLFileRead: # new in 1.53
|
293
|
+
Enabled: true
|
294
|
+
|
295
|
+
AllCops:
|
296
|
+
SuggestExtensions: false
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
supersaas-api-client (
|
4
|
+
supersaas-api-client (2.0.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
9
|
+
ast (2.4.2)
|
10
|
+
json (2.7.1)
|
11
|
+
language_server-protocol (3.17.0.3)
|
12
|
+
minitest (5.20.0)
|
13
|
+
parallel (1.24.0)
|
14
|
+
parser (3.3.0.4)
|
15
|
+
ast (~> 2.4.1)
|
16
|
+
racc
|
17
|
+
racc (1.7.3)
|
18
|
+
rainbow (3.1.1)
|
19
|
+
rake (13.1.0)
|
20
|
+
regexp_parser (2.9.0)
|
21
|
+
rexml (3.2.6)
|
22
|
+
rubocop (1.60.0)
|
23
|
+
json (~> 2.3)
|
24
|
+
language_server-protocol (>= 3.17.0)
|
25
|
+
parallel (~> 1.10)
|
26
|
+
parser (>= 3.3.0.2)
|
27
|
+
rainbow (>= 2.2.2, < 4.0)
|
28
|
+
regexp_parser (>= 1.8, < 3.0)
|
29
|
+
rexml (>= 3.2.5, < 4.0)
|
30
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
31
|
+
ruby-progressbar (~> 1.7)
|
32
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
33
|
+
rubocop-ast (1.30.0)
|
34
|
+
parser (>= 3.2.1.0)
|
35
|
+
ruby-progressbar (1.13.0)
|
36
|
+
unicode-display_width (2.5.0)
|
11
37
|
|
12
38
|
PLATFORMS
|
13
39
|
ruby
|
@@ -16,7 +42,8 @@ DEPENDENCIES
|
|
16
42
|
bundler
|
17
43
|
minitest
|
18
44
|
rake
|
45
|
+
rubocop
|
19
46
|
supersaas-api-client!
|
20
47
|
|
21
48
|
BUNDLED WITH
|
22
|
-
|
49
|
+
2.3.12
|
data/README.md
CHANGED
@@ -1,33 +1,29 @@
|
|
1
1
|
# SuperSaaS Ruby API Client
|
2
2
|
|
3
|
-
|
3
|
+
Manage appointments, users, and other object on the [SuperSaaS appointment scheduling](https://www.supersaas.com/) platform in Ruby.
|
4
4
|
|
5
|
-
The SuperSaaS API provides
|
5
|
+
The SuperSaaS API provides endpoints that can be used to read or update information from your SuperSaaS account.
|
6
|
+
This can be useful to build an integration with back-end system or to extract information to generate reports.
|
6
7
|
|
7
8
|
## Prerequisites
|
8
9
|
|
9
10
|
1. [Register for a (free) SuperSaaS account](https://www.supersaas.com/accounts/new), and
|
10
|
-
2.
|
11
|
+
2. Get your account name and API key on the [Account Info](https://www.supersaas.com/accounts/edit) page.
|
11
12
|
|
12
|
-
|
13
|
+
### Dependencies
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
No external libraries. Only the native `json` and `net/http` standard libs are used.
|
15
|
+
No external dependencies. Only the `json` and `net/http` gems from the ruby standard library are used.
|
17
16
|
|
18
17
|
## Installation
|
19
18
|
|
20
|
-
|
21
|
-
|
22
|
-
The SuperSaaS Ruby API Client is available from RubyGems and can be included in your project GemFile. Note, the supersaas-api-client may update major versions with breaking changes, so it's recommended to use a major version when expressing the gem dependency. e.g.
|
19
|
+
Install with:
|
23
20
|
|
24
|
-
gem
|
21
|
+
$ gem install supersaas-api-client
|
25
22
|
|
26
|
-
|
23
|
+
Alternatively, you can use `bundler` to install it by adding this line to you Gemfile.
|
24
|
+
The supersaas-api-client may update major versions with breaking changes, so it's recommended to use a major version when expressing the gem dependency. e.g.
|
27
25
|
|
28
|
-
|
29
|
-
|
30
|
-
$ gem install supersaas-api-client
|
26
|
+
gem 'supersaas-api-client', '~> 2'
|
31
27
|
|
32
28
|
## Configuration
|
33
29
|
|
@@ -67,59 +63,63 @@ Details of the data structures, parameters, and values can be found on the devel
|
|
67
63
|
|
68
64
|
https://www.supersaas.com/info/dev
|
69
65
|
|
70
|
-
#### List Schedules
|
71
|
-
|
72
|
-
Get all account schedules:
|
73
|
-
|
74
|
-
Supersaas::Client.instance.schedules.list #=> [<Supersaas::Schedule>, ...]
|
75
|
-
|
76
|
-
#### List Resource
|
77
|
-
|
78
|
-
Get all services/resources by `schedule_id`:
|
79
|
-
|
80
|
-
Supersaas::Client.instance.schedules.resources(12345) #=> [<Supersaas::Resource>, ...]
|
81
|
-
|
82
|
-
_Note: does not work for capacity type schedules._
|
83
|
-
|
84
66
|
#### Create User
|
85
67
|
|
86
|
-
Create a user with user attributes params
|
68
|
+
Create a user with user attributes params `create(attributes, user_id = nil, webhook = nil, duplicate = nil)`.
|
69
|
+
If webhook=true is present it will trigger any webhooks connected to the account.
|
70
|
+
To avoid a ‘create’ action from being automatically interpreted as an ‘update’, you can add the parameter duplicate=raise, then error `422 Unprocessable Entity` will be raised.
|
71
|
+
If in your database your user has id 1234 then you can supply a foreign key in format 1234fk in `user_id` (optional) which you can use to identify user:
|
72
|
+
If validation fails for any field then error `422 Unprocessable Entity` will be raised and any additional information will be printed to your log.
|
73
|
+
Data fields that you can supply can be found [here.](https://www.supersaas.com/info/dev/user_api)
|
87
74
|
|
88
|
-
Supersaas::Client.instance.users.create({name: 'name@name.com', full_name: 'Example Name', email: 'example@example.com'}) #=> http://www.supersaas.com/api/users/
|
75
|
+
Supersaas::Client.instance.users.create({name: 'name@name.com', full_name: 'Example Name', email: 'example@example.com'}, '1234fk', true, 'raise') #=> http://www.supersaas.com/api/users/1234.json
|
89
76
|
|
90
77
|
#### Update User
|
91
78
|
|
92
|
-
Update a user by `user_id` with user attributes params
|
79
|
+
Update a user by `user_id` with user attributes params `update(user_id, attributes, webhook = nil, notfound = nil)`.
|
80
|
+
If webhook=true is present it will trigger any webhooks connected to the account.
|
81
|
+
To avoid automatically creating a new record, you can add the parameter notfound=error or notfound=ignore to return a 404 Not Found or 200 OK respectively.
|
82
|
+
If the `user_id` does not exist 404 error will be raised.
|
83
|
+
You only need to specify the attributes you wish to update:
|
93
84
|
|
94
|
-
Supersaas::Client.instance.users.update(12345, {full_name: 'New Name'}) #=> nil
|
85
|
+
Supersaas::Client.instance.users.update(12345, {full_name: 'New Name'}, true, "ignore") #=> nil
|
95
86
|
|
96
87
|
#### Delete User
|
97
88
|
|
98
|
-
Delete a single user by `user_id
|
89
|
+
Delete a single user by `user_id`, and if the user does not exist 404 error will be raised.
|
99
90
|
|
100
91
|
Supersaas::Client.instance.users.delete(12345) #=> nil
|
101
92
|
|
102
93
|
#### Get User
|
103
94
|
|
104
|
-
Get a single user by `user_id
|
95
|
+
Get a single user by `user_id`, and if the user does not exist 404 error will be raised:
|
105
96
|
|
106
97
|
Supersaas::Client.instance.users.get(12345) #=> <Supersaas::User>
|
107
98
|
|
108
99
|
#### List Users
|
109
100
|
|
110
|
-
Get all users with optional `form` and `limit`/`offset` pagination params
|
101
|
+
Get all users with optional `form` and `limit`/`offset` pagination params, `list(form = nil, limit = nil, offset = nil)`.
|
102
|
+
User can have a form attached, and setting `form=true` shows the data:
|
111
103
|
|
112
104
|
Supersaas::Client.instance.users.list(false, 25, 0) #=> [<Supersaas::User>, ...]
|
113
105
|
|
106
|
+
#### List Fields of User object
|
107
|
+
|
108
|
+
Get all the fields available to user object:
|
109
|
+
|
110
|
+
Supersaas::Client.instance.users.field_list #=> [<Supersaas::FieldList>, ...]
|
111
|
+
|
114
112
|
#### Create Appointment/Booking
|
115
113
|
|
116
|
-
Create an appointment
|
114
|
+
Create an appointment with `schedule_id`, and `user_id(optional)` (see API documentation on [create new](https://www.supersaas.com/info/dev/appointment_api#bookings_api)) appointment attributes and optional `form` and `webhook` params,
|
115
|
+
`create(schedule_id, user_id, attributes, form = nil, webhook = nil)`:
|
117
116
|
|
118
117
|
Supersaas::Client.instance.appointments.create(12345, 67890, {full_name: 'Example Name', email: 'example@example.com', slot_id: 12345}, true, true) #=> http://www.supersaas.com/api/bookings/12345.json
|
119
118
|
|
120
119
|
#### Update Appointment/Booking
|
121
120
|
|
122
|
-
Update an appointment by `schedule_id` and `appointment_id` with appointment attributes
|
121
|
+
Update an appointment by `schedule_id` and `appointment_id` with appointment attributes, see the above link,
|
122
|
+
`update(schedule_id, appointment_id, attributes, form = nil, webhook = nil)`:
|
123
123
|
|
124
124
|
Supersaas::Client.instance.appointments.update(12345, 67890, {full_name: 'New Name'}) #=> nil
|
125
125
|
|
@@ -137,56 +137,113 @@ Get a single appointment by `schedule_id` and `appointment_id`:
|
|
137
137
|
|
138
138
|
#### List Appointments/Bookings
|
139
139
|
|
140
|
-
List appointments by `schedule_id`, with `form` and `start_time` and `limit` view params
|
140
|
+
List appointments by `schedule_id`, with `form` and `start_time` and `limit` view params,
|
141
|
+
`list(schedule_id, form = nil, start_time = nil, limit = nil)`:
|
141
142
|
|
142
143
|
Supersaas::Client.instance.appointments.list(12345, 67890, true, true) #=> [<Supersaas::Appointment>, ...]
|
143
144
|
|
144
145
|
#### Get Agenda
|
145
146
|
|
146
|
-
Get agenda (upcoming) appointments by `schedule_id` and `user_id`, with `from_time` view param
|
147
|
+
Get agenda (upcoming) appointments by `schedule_id` and `user_id`, with `from_time` view param ([see](https://www.supersaas.com/info/dev/appointment_api#agenda),
|
148
|
+
`agenda(schedule_id, user_id, from_time = nil, slot = false)`:
|
147
149
|
|
148
150
|
Supersaas::Client.instance.appointments.agenda(12345, 67890, '2018-01-31 00:00:00') #=> [<Supersaas::Appointment>, ...]
|
149
151
|
|
150
152
|
#### Get Agenda Slots
|
151
153
|
|
152
|
-
Get agenda (upcoming) slots by `schedule_id` and `user_id`, with `from_time` view param
|
154
|
+
Get agenda (upcoming) slots by `schedule_id` and `user_id`, with `from_time` view param,
|
155
|
+
`agenda_slots(schedule_id, user_id, from_time = nil)`:
|
153
156
|
|
154
157
|
Supersaas::Client.instance.appointments.agenda_slots(12345, 67890, '2018-01-31 00:00:00') #=> [<Supersaas::Slot>, ...]
|
155
158
|
|
156
|
-
_Note: works
|
159
|
+
_Note: only works for capacity type schedules._
|
157
160
|
|
158
161
|
#### Get Available Appointments/Bookings
|
159
162
|
|
160
|
-
Get available appointments by `schedule_id`, with `from` time and `length_minutes` and `resource` params
|
163
|
+
Get available appointments by `schedule_id`, with `from` time and `length_minutes` and `resource` params ([see](https://www.supersaas.com/info/dev/appointment_api#availability_api),
|
164
|
+
`available(schedule_id, from_time, length_minutes = nil, resource = nil, full = nil, limit = nil)`:
|
161
165
|
|
162
166
|
Supersaas::Client.instance.appointments.available(12345, '2018-01-31 00:00:00', 15, 'My Class') #=> [<Supersaas::Appointment>, ...]
|
163
167
|
|
164
168
|
#### Get Recent Changes
|
165
169
|
|
166
|
-
Get recently changed appointments by `schedule_id`, with `from` time, `to` time
|
170
|
+
Get recently changed appointments by `schedule_id`, with `from` time, `to` time, `user` user, `slot` view params (see [docs](https://www.supersaas.com/info/dev/appointment_api#recent_changes)),
|
171
|
+
`changes(schedule_id, from_time = nil, to = nil, slot = false, user = nil, limit = nil, offset = nil)`:
|
167
172
|
|
168
173
|
Supersaas::Client.instance.appointments.changes(12345, '2018-01-31 00:00:00', '2019-01-31 00:00:00', true) #=> [<Supersaas::Appointment>, ...]
|
169
174
|
|
170
175
|
|
171
176
|
#### Get list of appointments
|
172
177
|
|
173
|
-
Get list of appointments by `schedule_id`, with `today`,`from` time, `to` time and `slot` view
|
178
|
+
Get list of appointments by `schedule_id`, with `today`,`from` time, `to` time and `slot` view params (see [docs](https://www.supersaas.com/info/dev/appointment_api#range)),
|
179
|
+
`range(schedule_id, today = false, from_time = nil, to = nil, slot = false, user = nil, resource_id = nil, service_id = nil, limit = nil, offset = nil)`:
|
174
180
|
|
175
181
|
Supersaas::Client.instance.appointments.range(12345, false, '2018-01-31 00:00:00', '2019-01-31 00:00:00', true) #=> [<Supersaas::Appointment>, ...]/[<Supersaas::Slot>, ...]
|
176
182
|
|
183
|
+
#### List Forms
|
177
184
|
|
178
|
-
|
179
|
-
|
180
|
-
Get all forms by template `superform_id`, with `from_time` param:
|
185
|
+
Get all forms by template `superform_id`, with `from_time`, and `user` params ([see](https://www.supersaas.com/info/dev/form_api)):
|
181
186
|
|
182
187
|
Supersaas::Client.instance.forms.list(12345, '2018-01-31 00:00:00') #=> [<Supersaas::Form>, ...]
|
183
188
|
|
184
189
|
#### Get Form
|
185
190
|
|
186
|
-
Get a single form by `form_id
|
191
|
+
Get a single form by `form_id`, will raise 404 error if not found:
|
187
192
|
|
188
193
|
Supersaas::Client.instance.forms.get(12345) #=> <Supersaas::Form>
|
189
194
|
|
195
|
+
#### Get a list of SuperForms
|
196
|
+
|
197
|
+
Get a list of Form templates (SuperForms):
|
198
|
+
|
199
|
+
Supersaas::Client.instance.forms.forms #=> [<Supersaas::SuperForm>, ...]
|
200
|
+
|
201
|
+
#### List Promotions
|
202
|
+
|
203
|
+
Get a list of promotional coupon codes with paging parameters `limit` and `offset` (see [docs](https://www.supersaas.com/info/dev/promotion_api)),
|
204
|
+
`list(template_form_id, from_time = nil, user = nil)`:
|
205
|
+
|
206
|
+
Supersaas::Client.instance.promotions.list #=> [<Supersaas::Promotion>, ...]
|
207
|
+
|
208
|
+
#### Get a single coupon code
|
209
|
+
|
210
|
+
Retrieve information about a single coupon code use with `promotion_code`:
|
211
|
+
|
212
|
+
Supersaas::Client.instance.promotions.promotion(12345) #=> <Supersaas::Promotion>
|
213
|
+
|
214
|
+
#### Duplicate promotion code
|
215
|
+
|
216
|
+
Duplicate a template promotion by giving (new) `id` and `template_code` in that order:
|
217
|
+
|
218
|
+
Supersaas::Client.instance.promotions.duplicate_promotion_code(12345) #=> nil
|
219
|
+
|
220
|
+
#### List Groups in an account
|
221
|
+
|
222
|
+
List Groups in an account ([see](https://www.supersaas.com/info/dev/information_api)):
|
223
|
+
|
224
|
+
Supersaas::Client.instance.groups.list #=> [<Supersaas::Group>, ...]
|
225
|
+
|
226
|
+
#### List Schedules
|
227
|
+
|
228
|
+
Get all account schedules:
|
229
|
+
|
230
|
+
Supersaas::Client.instance.schedules.list #=> [<Supersaas::Schedule>, ...]
|
231
|
+
|
232
|
+
#### List Services / Resources
|
233
|
+
|
234
|
+
Get all services/resources by `schedule_id`:
|
235
|
+
|
236
|
+
Supersaas::Client.instance.schedules.resources(12345) #=> [<Supersaas::Resource>, ...]
|
237
|
+
|
238
|
+
_Note: does not work for capacity type schedules._
|
239
|
+
|
240
|
+
#### List Fields of a Schedule
|
241
|
+
|
242
|
+
Get all the available fields of a schedule by `schedule_id`:
|
243
|
+
|
244
|
+
Supersaas::Client.instance.schedules.field_list(12345) #=> [<Supersaas::FieldList>, ...]
|
245
|
+
|
246
|
+
|
190
247
|
## Examples
|
191
248
|
|
192
249
|
The ./examples folder contains several executable Ruby scripts demonstrating how to use the API Client for common requests.
|
@@ -226,19 +283,16 @@ The API Client raises a custom exception for HTTP errors and invalid input. Resc
|
|
226
283
|
# Handle error
|
227
284
|
end
|
228
285
|
|
229
|
-
|
286
|
+
Some errors have more information and are printed to the log before raising the error e.g.
|
230
287
|
|
231
288
|
appointment = Supersaas::Client.instance.appointments.create(12345, {bad_field_name: ''})
|
232
|
-
|
289
|
+
"Error 400, Bad request: unknown attribute 'bad_field_name' for Booking."
|
233
290
|
|
234
291
|
## Additional Information
|
235
292
|
|
236
293
|
+ [SuperSaaS Registration](https://www.supersaas.com/accounts/new)
|
237
294
|
+ [Product Documentation](https://www.supersaas.com/info/support)
|
238
295
|
+ [Developer Documentation](https://www.supersaas.com/info/dev)
|
239
|
-
+ [Python API Client](https://github.com/SuperSaaS/supersaas-python-api-client)
|
240
|
-
+ [PHP API Client](https://github.com/SuperSaaS/supersaas-php-api-client)
|
241
|
-
+ [NodeJS API Client](https://github.com/SuperSaaS/supersaas-nodejs-api-client)
|
242
296
|
|
243
297
|
Contact: [support@supersaas.com](mailto:support@supersaas.com)
|
244
298
|
|