levelup 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +32 -305
  3. data/Gemfile.lock +1 -1
  4. data/README.md +131 -38
  5. data/levelup.gemspec +1 -1
  6. data/lib/levelup.rb +4 -0
  7. data/lib/levelup/api.rb +1 -2
  8. data/lib/levelup/configuration.rb +1 -1
  9. data/lib/levelup/endpoints/access_tokens.rb +7 -10
  10. data/lib/levelup/endpoints/app_locations.rb +4 -6
  11. data/lib/levelup/endpoints/app_users.rb +1 -7
  12. data/lib/levelup/endpoints/credit_cards.rb +3 -4
  13. data/lib/levelup/endpoints/location_credit.rb +6 -8
  14. data/lib/levelup/endpoints/location_merchant_funded_credit.rb +23 -0
  15. data/lib/levelup/endpoints/location_orders.rb +8 -14
  16. data/lib/levelup/endpoints/merchant_funded_credits.rb +4 -6
  17. data/lib/levelup/endpoints/merchant_locations.rb +8 -13
  18. data/lib/levelup/endpoints/merchant_orders.rb +6 -8
  19. data/lib/levelup/endpoints/orders.rb +3 -3
  20. data/lib/levelup/endpoints/permissions_requests.rb +1 -2
  21. data/lib/levelup/endpoints/qr_codes.rb +3 -4
  22. data/lib/levelup/endpoints/specific_app.rb +1 -2
  23. data/lib/levelup/endpoints/specific_location.rb +13 -8
  24. data/lib/levelup/endpoints/specific_merchant.rb +4 -5
  25. data/lib/levelup/endpoints/specific_order.rb +4 -8
  26. data/lib/levelup/endpoints/specific_permissions_request.rb +3 -5
  27. data/lib/levelup/endpoints/user_addresses.rb +6 -7
  28. data/lib/levelup/endpoints/user_orders.rb +2 -3
  29. data/lib/levelup/endpoints/users.rb +5 -0
  30. data/lib/levelup/requests/authenticate_merchant.rb +1 -2
  31. data/lib/levelup/requests/create_address.rb +3 -4
  32. data/lib/levelup/requests/create_card.rb +2 -3
  33. data/lib/levelup/requests/create_order.rb +1 -2
  34. data/lib/levelup/requests/create_user.rb +4 -13
  35. data/lib/levelup/requests/get_location_credit.rb +1 -2
  36. data/lib/levelup/requests/get_location_merchant_funded_credit.rb +16 -0
  37. data/lib/levelup/requests/get_order.rb +1 -2
  38. data/lib/levelup/requests/give_merchant_credit.rb +1 -2
  39. data/lib/levelup/requests/list_addresses.rb +3 -4
  40. data/lib/levelup/requests/list_app_locations.rb +1 -2
  41. data/lib/levelup/requests/list_locations.rb +2 -3
  42. data/lib/levelup/requests/list_orders.rb +2 -3
  43. data/lib/levelup/requests/list_user_orders.rb +3 -4
  44. data/lib/levelup/requests/show_permissions_request.rb +1 -2
  45. data/lib/levelup/responses/success_paginated.rb +1 -2
  46. data/lib/levelup/templates/app_authenticated.rb +1 -3
  47. data/lib/levelup/templates/merchant_and_user_authenticated.rb +4 -9
  48. data/lib/levelup/templates/merchant_authenticated.rb +2 -5
  49. data/lib/levelup/utils/payment_calculator.rb +83 -0
  50. data/spec/endpoints/access_tokens_spec.rb +2 -4
  51. data/spec/endpoints/app_users_spec.rb +6 -22
  52. data/spec/endpoints/location_credit_spec.rb +1 -2
  53. data/spec/endpoints/location_merchant_funded_credit_spec.rb +12 -0
  54. data/spec/endpoints/location_orders_spec.rb +3 -4
  55. data/spec/endpoints/merchant_funded_credits_spec.rb +1 -2
  56. data/spec/endpoints/merchant_locations_spec.rb +4 -4
  57. data/spec/endpoints/qr_codes_spec.rb +1 -2
  58. data/spec/endpoints/specific_order_spec.rb +3 -4
  59. data/spec/endpoints/specific_permissions_request_spec.rb +1 -2
  60. data/spec/endpoints/user_addresses_spec.rb +1 -2
  61. data/spec/endpoints/user_orders_spec.rb +1 -2
  62. data/spec/endpoints/users_spec.rb +22 -0
  63. data/spec/{data_objects/requests → requests}/authenticate_app_spec.rb +0 -0
  64. data/spec/{data_objects/requests → requests}/authenticate_merchant_spec.rb +0 -0
  65. data/spec/{data_objects/requests → requests}/create_order_spec.rb +0 -0
  66. data/spec/{data_objects/requests → requests}/get_order_spec.rb +0 -0
  67. data/spec/{data_objects/requests → requests}/list_locations_spec.rb +0 -0
  68. data/spec/{data_objects/requests → requests}/list_orders_spec.rb +0 -0
  69. data/spec/{data_objects/requests → requests}/refund_order_spec.rb +0 -0
  70. data/spec/{data_objects/requests → requests}/request_permissions_spec.rb +1 -2
  71. data/spec/{data_objects/responses → responses}/error_spec.rb +0 -0
  72. data/spec/{data_objects/responses → responses}/response_spec.rb +0 -0
  73. data/spec/{data_objects/responses → responses}/success_paginated_spec.rb +1 -2
  74. data/spec/utils/payment_calculator/payment_calculator_spec.rb +164 -0
  75. metadata +36 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37ecaa0b0077be335d54744b34de2883647a9e99
4
- data.tar.gz: 1eb778f8427864d578c0aa16c52b67701ac9ec42
3
+ metadata.gz: d848c067c68b9ed5fd3e30c5037dcc45441d8de4
4
+ data.tar.gz: 4589cab800829bdedb94c17c12c4f3294ce55892
5
5
  SHA512:
6
- metadata.gz: 46a0863b7ee1a7e091f658dfd855a41a75fbb19a45441e2d44abbce8a13dbaf0633832f4b20aedf49d50465e7027829d19862996db9d814661f9bd9277725c38
7
- data.tar.gz: 82b2541958f7c3308ab338595d204234ea770976c3a6981362801142932bb62d0d85d9291344950b33856cd8946d2632231c6a5052e261d0d80823fa05a9f6c7
6
+ metadata.gz: db4cdca730f0aa89a40f7c535f84f7587da1cc618fb780b0eb4fd150e6dc3c9aa6ef6285913fd73a40273bc0982d705aa955dd1dfa36b1154dabb156e64fec87
7
+ data.tar.gz: a13cc452b09fe24189a45429ad9a639f968dfde29a02d825b2ce872836a519ab05aa6414b2b475c7c4008abb65ba03aefae1464c019199e529400afe85ddb3b0
@@ -1,17 +1,12 @@
1
1
  # Rubocop comes with most cops enabled and some disabled by default.
2
- # Our style guide does not match these defaults, so we explicitly enable/disable each cop below.
3
- # We should add an entry for any cop introduced via Rubocop updates
4
- # (with 'rubocop --auto-gen-config' helping out)
2
+ # Our style guide does not match these defaults, so we explicitly enable/disable some cops below.
5
3
 
6
- AccessModifierIndentation:
7
- Enabled: true
4
+ AbcSize:
5
+ Enabled: false
8
6
 
9
7
  AccessorMethodName:
10
8
  Enabled: false
11
9
 
12
- Alias:
13
- Enabled: true
14
-
15
10
  AlignArray:
16
11
  Enabled: false
17
12
 
@@ -21,177 +16,66 @@ AlignHash:
21
16
  AlignParameters:
22
17
  Enabled: false
23
18
 
24
- AndOr:
25
- Enabled: true
26
-
27
- AsciiComments:
28
- Enabled: true
29
-
30
- AsciiIdentifiers:
31
- Enabled: true
32
-
33
- AssignmentInCondition:
34
- Enabled: false
35
-
36
- Attr:
37
- Enabled: true
38
-
39
- BeginBlock:
40
- Enabled: true
41
-
42
- BlockAlignment:
19
+ AmbiguousOperator:
43
20
  Enabled: false
44
21
 
45
- BlockComments:
46
- Enabled: true
47
-
48
- BlockNesting:
22
+ AmbiguousRegexpLiteral:
49
23
  Enabled: false
50
24
 
51
- Blocks:
52
- Enabled: false
53
-
54
- BracesAroundHashParameters:
25
+ AssignmentInCondition:
55
26
  Enabled: false
56
27
 
57
- CaseEquality:
58
- Enabled: true
59
-
60
28
  CaseIndentation:
61
- Enabled: false
29
+ IndentWhenRelativeTo: end
62
30
 
63
- CharacterLiteral:
64
- Enabled: true
65
-
66
- ClassAndModuleCamelCase:
67
- Enabled: true
31
+ ClassAndModuleChildren:
32
+ Enabled: false
68
33
 
69
34
  ClassLength:
70
35
  Enabled: false
71
36
 
72
- ClassMethods:
73
- Enabled: true
74
-
75
- ClassVars:
76
- Enabled: true
77
-
78
37
  CollectionMethods:
79
38
  Enabled: false
80
39
 
81
- ColonMethodCall:
82
- Enabled: true
83
-
84
- CommentAnnotation:
85
- Enabled: true
86
-
87
- ConstantName:
88
- Enabled: false
89
-
90
40
  CyclomaticComplexity:
91
41
  Enabled: false
92
42
 
93
- Debugger:
94
- Enabled: true
95
-
96
- DefaultScope:
97
- Enabled: true
98
-
99
- DefWithParentheses:
100
- Enabled: true
43
+ Delegate:
44
+ Enabled: false
101
45
 
102
46
  Documentation:
103
47
  Enabled: false
104
48
 
105
49
  DotPosition:
50
+ EnforcedStyle: leading
106
51
  Enabled: false
107
52
 
108
- EmptyEnsure:
109
- Enabled: true
110
-
111
- EmptyLineBetweenDefs:
53
+ DoubleNegation:
112
54
  Enabled: false
113
55
 
114
- EmptyLines:
115
- Enabled: true
116
-
117
- EmptyLinesAroundAccessModifier:
118
- Enabled: true
119
-
120
56
  EmptyLineBetweenDefs:
121
57
  AllowAdjacentOneLineDefs: true
122
- Enabled: true
123
-
124
- EmptyLinesAroundBody:
125
- Enabled: true
126
-
127
- EmptyLiteral:
128
- Enabled: true
129
-
130
- Encoding:
131
- Enabled: true
132
58
 
133
59
  EndAlignment:
134
- Enabled: false
60
+ AlignWith: variable
135
61
 
136
- EndBlock:
137
- Enabled: true
62
+ FormatString:
63
+ EnforcedStyle: percent
138
64
 
139
- EndInMethod:
140
- Enabled: true
141
-
142
- EndOfLine:
143
- Enabled: true
144
-
145
- EnsureReturn:
146
- Enabled: true
147
-
148
- Eval:
149
- Enabled: true
150
-
151
- EvenOdd:
152
- Enabled: true
153
-
154
- FavorJoin:
155
- Enabled: true
156
-
157
- FavorSprintf:
65
+ GuardClause:
158
66
  Enabled: false
159
67
 
160
- FavorUnlessOverNegatedIf:
161
- Enabled: true
162
-
163
- FavorUntilOverNegatedWhile:
164
- Enabled: true
165
-
166
- FlipFlop:
167
- Enabled: true
168
-
169
- FinalNewline:
170
- Enabled: true
171
-
172
- For:
173
- Enabled: true
174
-
175
- GlobalVars:
176
- Enabled: true
177
-
178
68
  HandleExceptions:
179
69
  Enabled: false
180
70
 
181
71
  HasAndBelongsToMany:
182
- Enabled: true
183
-
184
- HashMethods:
185
- Enabled: true
186
-
187
- HashSyntax:
188
- Enabled: true
72
+ Enabled: false
189
73
 
190
74
  IfUnlessModifier:
191
75
  Enabled: false
192
76
 
193
- IfWithSemicolon:
194
- Enabled: true
77
+ IndentHash:
78
+ Enabled: false
195
79
 
196
80
  IndentationWidth:
197
81
  Enabled: false
@@ -199,18 +83,8 @@ IndentationWidth:
199
83
  Lambda:
200
84
  Enabled: false
201
85
 
202
- LambdaCall:
203
- Enabled: true
204
-
205
- LeadingCommentSpace:
206
- Enabled: true
207
-
208
86
  LineLength:
209
- Enabled: true
210
- Max: 80 #differs from platform spec because it's open source
211
-
212
- LiteralInCondition:
213
- Enabled: true
87
+ Max: 100
214
88
 
215
89
  Loop:
216
90
  Enabled: false
@@ -218,210 +92,63 @@ Loop:
218
92
  MethodCalledOnDoEndBlock:
219
93
  Enabled: false
220
94
 
221
- MethodCallParentheses:
222
- Enabled: true
223
-
224
95
  MethodLength:
225
96
  Enabled: false
226
97
 
227
- MethodName:
228
- Enabled: true
229
-
230
- ModuleFunction:
231
- Enabled: true
232
-
233
- MultilineBlockChain:
234
- Enabled: true
235
-
236
- MultilineIfThen:
237
- Enabled: true
238
-
239
- MultilineTernaryOperator:
240
- Enabled: true
241
-
242
- NestedTernaryOperator:
243
- Enabled: true
244
-
245
- NilComparison:
246
- Enabled: true
98
+ MultilineOperationIndentation:
99
+ Enabled: false
247
100
 
248
- Not:
249
- Enabled: true
101
+ Next:
102
+ Enabled: false
250
103
 
251
104
  NumericLiterals:
252
105
  Enabled: false
253
106
 
254
- OneLineConditional:
255
- Enabled: true
256
-
257
- OpMethod:
258
- Enabled: true
259
-
260
- Output:
261
- Enabled: true
262
-
263
107
  ParameterLists:
264
108
  Enabled: false
265
109
 
266
- ParenthesesAroundCondition:
267
- Enabled: true
268
-
269
110
  ParenthesesAsGroupedExpression:
270
111
  Enabled: false
271
112
 
272
- PerlBackrefs:
113
+ PerceivedComplexity:
273
114
  Enabled: false
274
115
 
275
116
  PredicateName:
276
117
  Enabled: false
277
118
 
278
- Proc:
279
- Enabled: false
280
-
281
- RaiseArgs:
282
- Enabled: true
283
-
284
- ReadAttribute:
285
- Enabled: true
286
-
287
- RedundantBegin:
288
- Enabled: true
289
-
290
- RedundantException:
291
- Enabled: true
292
-
293
- RedundantReturn:
294
- Enabled: true
295
-
296
- RedundantSelf:
297
- Enabled: true
298
-
299
119
  RegexpLiteral:
300
120
  Enabled: false
301
121
 
302
- RescueException:
303
- Enabled: true
304
-
305
122
  RescueModifier:
306
123
  Enabled: false
307
124
 
308
- Semicolon:
309
- Enabled: true
310
-
311
- ShadowingOuterLocalVariable:
312
- Enabled: true
313
-
314
125
  SignalException:
315
126
  Enabled: false
316
127
 
317
- SingleLineBlockParams:
318
- Enabled: true
319
-
320
- SingleLineMethods:
321
- Enabled: true
322
-
323
128
  SpaceAfterColon:
324
- Enabled: true
325
-
326
- SpaceAfterComma:
327
- Enabled: true
328
-
329
- SpaceAfterControlKeyword:
330
- Enabled: true
331
-
332
- SpaceAfterMethodName:
333
- Enabled: true
334
-
335
- SpaceAfterNot:
336
- Enabled: true
337
-
338
- SpaceAfterSemicolon:
339
- Enabled: true
340
-
341
- SpaceAroundBlockBraces:
342
- Enabled: true
343
- EnforcedStyle: space_inside_braces
344
- EnforcedStyleForEmptyBraces: no_space
345
- SpaceBeforeBlockParameters: true
346
-
347
- SpaceAroundEqualsInParameterDefault:
348
- Enabled: true
349
-
350
- SpaceAroundOperators:
351
- Enabled: true
352
-
353
- SpaceBeforeModifierKeyword:
354
- Enabled: true
355
-
356
- SpaceInsideBrackets:
357
- Enabled: true
358
-
359
- SpaceInsideHashLiteralBraces:
360
- Enabled: true
361
-
362
- SpaceInsideParens:
363
- Enabled: true
364
-
365
- SpecialGlobalVars:
366
- Enabled: true
367
-
368
- StringLiterals:
369
129
  Enabled: false
370
130
 
371
- SymbolArray:
131
+ TrivialAccessors:
372
132
  Enabled: false
373
133
 
374
- Syntax:
134
+ UnusedBlockArgument:
375
135
  Enabled: false
376
136
 
377
- Tab:
378
- Enabled: true
379
-
380
- TrailingBlankLines:
381
- Enabled: true
382
-
383
- TrailingWhitespace:
384
- Enabled: true
385
-
386
- TrivialAccessors:
137
+ UnusedMethodArgument:
387
138
  Enabled: false
388
139
 
389
- UnlessElse:
390
- Enabled: true
391
-
392
- UnreachableCode:
393
- Enabled: true
394
-
395
140
  UselessAssignment:
396
141
  Enabled: false
397
142
 
398
- UselessComparison:
399
- Enabled: true
400
-
401
- UselessSetterCall:
402
- Enabled: true
403
-
404
143
  Validation:
405
- Enabled: true
406
-
407
- VariableInterpolation:
408
- Enabled: true
409
-
410
- VariableName:
411
- Enabled: true
412
- EnforcedStyle: snake_case
144
+ Enabled: false
413
145
 
146
+ # Can be enabled when we switch to RSpec "expect.to" syntax:
414
147
  Void:
415
148
  Enabled: false
416
149
 
417
- WhenThen:
418
- Enabled: true
419
-
420
- WhileUntilDo:
421
- Enabled: true
422
-
423
150
  WhileUntilModifier:
424
151
  Enabled: false
425
152
 
426
153
  WordArray:
427
- Enabled: false
154
+ MinSize: 3