wix-hive-ruby 0.9.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 (78) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.rubocop.yml +487 -0
  4. data/.yardopts +6 -0
  5. data/Gemfile +4 -0
  6. data/Guardfile +11 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +641 -0
  9. data/Rakefile +33 -0
  10. data/e2e/activities_api_spec.rb +334 -0
  11. data/e2e/contacts_api_spec.rb +364 -0
  12. data/e2e/e2e_helper.rb +35 -0
  13. data/e2e/insights_api_spec.rb +29 -0
  14. data/lib/hive/activities/contact/contact_create_activity.rb +109 -0
  15. data/lib/hive/activities/contact/contact_form_activity.rb +31 -0
  16. data/lib/hive/activities/conversion/conversion_complete_activity.rb +33 -0
  17. data/lib/hive/activities/e_commerce/purchase_activity.rb +150 -0
  18. data/lib/hive/activities/factory.rb +71 -0
  19. data/lib/hive/activities/hotels/hotels_cancel_activity.rb +52 -0
  20. data/lib/hive/activities/hotels/hotels_confirmation_activity.rb +133 -0
  21. data/lib/hive/activities/hotels/hotels_purchase_activity.rb +48 -0
  22. data/lib/hive/activities/hotels/hotels_purchase_failed_activity.rb +59 -0
  23. data/lib/hive/activities/messaging/send_activity.rb +75 -0
  24. data/lib/hive/activities/music/album_fan_activity.rb +36 -0
  25. data/lib/hive/activities/music/album_share_activity.rb +23 -0
  26. data/lib/hive/activities/music/track_lyrics_activity.rb +38 -0
  27. data/lib/hive/activities/music/track_play_activity.rb +31 -0
  28. data/lib/hive/activities/music/track_played_activity.rb +31 -0
  29. data/lib/hive/activities/music/track_share_activity.rb +32 -0
  30. data/lib/hive/activities/music/track_skipped_activity.rb +31 -0
  31. data/lib/hive/activities/scheduler/scheduler_appointment_activity.rb +73 -0
  32. data/lib/hive/activity.rb +60 -0
  33. data/lib/hive/activity_summary.rb +24 -0
  34. data/lib/hive/connect/request/wix_api_request.rb +92 -0
  35. data/lib/hive/connect/response/error.rb +88 -0
  36. data/lib/hive/connect/response/parse_json.rb +29 -0
  37. data/lib/hive/connect/response/raise_error.rb +17 -0
  38. data/lib/hive/connect/wix_client.rb +148 -0
  39. data/lib/hive/contact.rb +153 -0
  40. data/lib/hive/cursor.rb +48 -0
  41. data/lib/hive/errors.rb +5 -0
  42. data/lib/hive/extensions/hashie_hash.rb +16 -0
  43. data/lib/hive/extensions/hashie_validate_enum.rb +11 -0
  44. data/lib/hive/rest/activities.rb +55 -0
  45. data/lib/hive/rest/api.rb +13 -0
  46. data/lib/hive/rest/contacts.rb +114 -0
  47. data/lib/hive/rest/insights.rb +17 -0
  48. data/lib/hive/util.rb +20 -0
  49. data/lib/hive/version.rb +14 -0
  50. data/lib/wix-hive-ruby.rb +5 -0
  51. data/samples/quick_start.rb +49 -0
  52. data/spec/hive/activities/contact/contact_create_activity_spec.rb +25 -0
  53. data/spec/hive/activities/contact/contact_form_activity_spec.rb +9 -0
  54. data/spec/hive/activities/conversion/conversion_complete_activity_spec.rb +9 -0
  55. data/spec/hive/activities/e_commerce/purchase_activity_spec.rb +19 -0
  56. data/spec/hive/activities/factory_spec.rb +78 -0
  57. data/spec/hive/activities/hotels/hotels_cancel_activity_spec.rb +22 -0
  58. data/spec/hive/activities/hotels/hotels_confirmation_activity_spec.rb +34 -0
  59. data/spec/hive/activities/hotels/hotels_purchase_activity_spec.rb +22 -0
  60. data/spec/hive/activities/hotels/hotels_purchase_failed_activity_spec.rb +22 -0
  61. data/spec/hive/activities/messaging/send_activity_spec.rb +13 -0
  62. data/spec/hive/activities/scheduler/scheduler_appointment_activity_spec.rb +10 -0
  63. data/spec/hive/activity_spec.rb +18 -0
  64. data/spec/hive/connect/request/wix_api_request_spec.rb +54 -0
  65. data/spec/hive/connect/response/error_spec.rb +31 -0
  66. data/spec/hive/connect/response/parse_json_spec.rb +28 -0
  67. data/spec/hive/connect/response/raise_error_spec.rb +19 -0
  68. data/spec/hive/connect/wix_client_spec.rb +103 -0
  69. data/spec/hive/contact_spec.rb +148 -0
  70. data/spec/hive/cursor_spec.rb +75 -0
  71. data/spec/hive/hashie_hash_spec.rb +23 -0
  72. data/spec/hive/rest/activities_spec.rb +87 -0
  73. data/spec/hive/rest/contacts_spec.rb +225 -0
  74. data/spec/hive/rest/insights_spec.rb +17 -0
  75. data/spec/hive/util_spec.rb +36 -0
  76. data/spec/spec_helper.rb +59 -0
  77. data/wix-hive-ruby.gemspec +38 -0
  78. metadata +392 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7b382c3267da79ccd311ceb13370075726fab0d9
4
+ data.tar.gz: 9b7e203f3a891c24f91b49e7e2f8539b90eacd50
5
+ SHA512:
6
+ metadata.gz: d38ff3638b5c4878a1db75a26ed3f7c0514a05521642c7efeaf1ad69e6be5847a3b0a5f3c736808e806a6cd72a8c4219c466bf6a4cec4bebab2f74aef3667189
7
+ data.tar.gz: 9d6c42434c315b4fd2086af15fad78e2eea87e55f49a6ec781ba3eda1342cd93a69072023435f28266ec553719dacd4ff23be016d862e68c86a222915ef05dc9
@@ -0,0 +1,20 @@
1
+ #Intellij
2
+ .idea/
3
+ *.iml
4
+ *.iws
5
+
6
+ # Mac
7
+ .DS_Store
8
+
9
+ #Project
10
+ coverage
11
+ rdoc
12
+ doc
13
+ .yardoc/
14
+ pkg
15
+ *.gem
16
+ .bundle
17
+ Gemfile.lock
18
+ e2e/fixtures
19
+ e2e/e2e
20
+ hive.log
@@ -0,0 +1,487 @@
1
+ # Common configuration.
2
+ AllCops:
3
+ # Include gemspec and Rakefile
4
+ Include:
5
+ - 'Gemfile'
6
+ - 'Rakefile'
7
+ - 'wix-hive-ruby.gemspec'
8
+
9
+ #TODO: Alex enable this once documentation is added!!
10
+ Documentation:
11
+ Enabled: false
12
+
13
+ # Indent private/protected/public as deep as method definitions
14
+ Style/AccessModifierIndentation:
15
+ EnforcedStyle: indent
16
+ SupportedStyles:
17
+ - outdent
18
+ - indent
19
+
20
+ # Align the elements of a hash literal if they span more than one line.
21
+ Style/AlignHash:
22
+ # Alignment of entries using hash rocket as separator. Valid values are:
23
+ #
24
+ # key - left alignment of keys
25
+ # 'a' => 2
26
+ # 'bb' => 3
27
+ # separator - alignment of hash rockets, keys are right aligned
28
+ # 'a' => 2
29
+ # 'bb' => 3
30
+ # table - left alignment of keys, hash rockets, and values
31
+ # 'a' => 2
32
+ # 'bb' => 3
33
+ EnforcedHashRocketStyle: key
34
+ # Alignment of entries using colon as separator. Valid values are:
35
+ #
36
+ # key - left alignment of keys
37
+ # a: 0
38
+ # bb: 1
39
+ # separator - alignment of colons, keys are right aligned
40
+ # a: 0
41
+ # bb: 1
42
+ # table - left alignment of keys and values
43
+ # a: 0
44
+ # bb: 1
45
+ EnforcedColonStyle: key
46
+ # Select whether hashes that are the last argument in a method call should be
47
+ # inspected? Valid values are:
48
+ #
49
+ # always_inspect - Inspect both implicit and explicit hashes.
50
+ # Registers an offense for:
51
+ # function(a: 1,
52
+ # b: 2)
53
+ # Registers an offense for:
54
+ # function({a: 1,
55
+ # b: 2})
56
+ # always_ignore - Ignore both implicit and explicit hashes.
57
+ # Accepts:
58
+ # function(a: 1,
59
+ # b: 2)
60
+ # Accepts:
61
+ # function({a: 1,
62
+ # b: 2})
63
+ # ignore_implicit - Ignore only implicit hashes.
64
+ # Accepts:
65
+ # function(a: 1,
66
+ # b: 2)
67
+ # Registers an offense for:
68
+ # function({a: 1,
69
+ # b: 2})
70
+ # ignore_explicit - Ignore only explicit hashes.
71
+ # Accepts:
72
+ # function({a: 1,
73
+ # b: 2})
74
+ # Registers an offense for:
75
+ # function(a: 1,
76
+ # b: 2)
77
+ EnforcedLastArgumentHashStyle: always_inspect
78
+ SupportedLastArgumentHashStyles:
79
+ - always_inspect
80
+ - always_ignore
81
+ - ignore_implicit
82
+ - ignore_explicit
83
+
84
+ Style/AlignParameters:
85
+ # Alignment of parameters in multi-line method calls.
86
+ #
87
+ # The `with_first_parameter` style aligns the following lines along the same column
88
+ # as the first parameter.
89
+ #
90
+ # method_call(a,
91
+ # b)
92
+ #
93
+ # The `with_fixed_indentation` style aligns the following lines with one
94
+ # level of indentation relative to the start of the line with the method call.
95
+ #
96
+ # method_call(a,
97
+ # b)
98
+ EnforcedStyle: with_first_parameter
99
+ SupportedStyles:
100
+ - with_first_parameter
101
+ - with_fixed_indentation
102
+
103
+ Style/BlockNesting:
104
+ Max: 3
105
+
106
+ Style/BracesAroundHashParameters:
107
+ EnforcedStyle: no_braces
108
+ SupportedStyles:
109
+ - braces
110
+ - no_braces
111
+
112
+ # Indentation of `when`.
113
+ Style/CaseIndentation:
114
+ IndentWhenRelativeTo: case
115
+ SupportedStyles:
116
+ - case
117
+ - end
118
+ IndentOneStep: false
119
+
120
+ Style/ClassAndModuleChildren:
121
+ # Checks the style of children definitions at classes and modules.
122
+ #
123
+ # Basically there are two different styles:
124
+ #
125
+ # `nested` - have each child on a separate line
126
+ # class Foo
127
+ # class Bar
128
+ # end
129
+ # end
130
+ #
131
+ # `compact` - combine definitions as much as possible
132
+ # class Foo::Bar
133
+ # end
134
+ #
135
+ # The compact style is only forced, for classes / modules with one child.
136
+ EnforcedStyle: nested
137
+ SupportedStyles:
138
+ - nested
139
+ - compact
140
+
141
+ Style/ClassCheck:
142
+ EnforcedStyle: is_a?
143
+ SupportedStyles:
144
+ - is_a?
145
+ - kind_of?
146
+
147
+ Style/ClassLength:
148
+ Enabled: false
149
+
150
+ # Align with the style guide.
151
+ Style/CollectionMethods:
152
+ # Mapping from undesired method to desired_method
153
+ # e.g. to use `detect` over `find`:
154
+ #
155
+ # CollectionMethods:
156
+ # PreferredMethods:
157
+ # find: detect
158
+ PreferredMethods:
159
+ collect: 'map'
160
+ collect!: 'map!'
161
+ inject: 'reduce'
162
+ detect: 'find'
163
+ find_all: 'select'
164
+
165
+ # Checks formatting of special comments
166
+ Style/CommentAnnotation:
167
+ Keywords:
168
+ - TODO
169
+ - FIXME
170
+ - OPTIMIZE
171
+ - HACK
172
+ - REVIEW
173
+
174
+ # Avoid complex methods.
175
+ Style/CyclomaticComplexity:
176
+ Max: 6
177
+
178
+ # Multi-line method chaining should be done with leading dots.
179
+ Style/DotPosition:
180
+ EnforcedStyle: leading
181
+ SupportedStyles:
182
+ - leading
183
+ - trailing
184
+
185
+ # Use empty lines between defs.
186
+ Style/EmptyLineBetweenDefs:
187
+ # If true, this parameter means that single line method definitions don't
188
+ # need an empty line between them.
189
+ AllowAdjacentOneLineDefs: false
190
+
191
+ # Checks whether the source file has a utf-8 encoding comment or not
192
+ Style/Encoding:
193
+ EnforcedStyle: always
194
+ SupportedStyles:
195
+ - when_needed
196
+ - always
197
+
198
+ Style/FileName:
199
+ Exclude:
200
+ - '**/Rakefile'
201
+ - '**/Gemfile'
202
+ - '**/Capfile'
203
+ - 'lib/wix-hive-ruby.rb'
204
+
205
+ # Checks use of for or each in multiline loops.
206
+ Style/For:
207
+ EnforcedStyle: each
208
+ SupportedStyles:
209
+ - for
210
+ - each
211
+
212
+ # Enforce the method used for string formatting.
213
+ Style/FormatString:
214
+ EnforcedStyle: format
215
+ SupportedStyles:
216
+ - format
217
+ - sprintf
218
+ - percent
219
+
220
+ # Built-in global variables are allowed by default.
221
+ Style/GlobalVars:
222
+ AllowedVariables: []
223
+
224
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
225
+ # needs to have to trigger this cop
226
+ Style/GuardClause:
227
+ MinBodyLength: 1
228
+
229
+ Style/HashSyntax:
230
+ EnforcedStyle: ruby19
231
+ SupportedStyles:
232
+ - ruby19
233
+ - hash_rockets
234
+
235
+ Style/IfUnlessModifier:
236
+ Enabled: false
237
+
238
+ # Checks the indentation of the first key in a hash literal.
239
+ Style/IndentHash:
240
+ # The value `special_inside_parentheses` means that hash literals with braces
241
+ # that have their opening brace on the same line as a surrounding opening
242
+ # round parenthesis, shall have their first key indented relative to the
243
+ # first position inside the parenthesis.
244
+ # The value `consistent` means that the indentation of the first key shall
245
+ # always be relative to the first position of the line where the opening
246
+ # brace is.
247
+ EnforcedStyle: special_inside_parentheses
248
+ SupportedStyles:
249
+ - special_inside_parentheses
250
+ - consistent
251
+
252
+ Style/Lambda:
253
+ Enabled: false
254
+
255
+ Style/LambdaCall:
256
+ EnforcedStyle: call
257
+ SupportedStyles:
258
+ - call
259
+ - braces
260
+
261
+ Style/LineLength:
262
+ Enabled: false
263
+
264
+ Style/Next:
265
+ # With `always` all conditions at the end of an iteration needs to be
266
+ # replace by next - with `skip_modifier_ifs` the modifier if like this one
267
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
268
+ EnforcedStyle: skip_modifier_ifs
269
+ SupportedStyles:
270
+ - skip_modifier_ifs
271
+ - always
272
+
273
+ Style/NonNilCheck:
274
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
275
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
276
+ # **usually** OK, but might change behavior.
277
+ #
278
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
279
+ # offenses for `!x.nil?` and does no changes that might change behavior.
280
+ IncludeSemanticChanges: false
281
+
282
+ Style/MethodDefParentheses:
283
+ EnforcedStyle: require_parentheses
284
+ SupportedStyles:
285
+ - require_parentheses
286
+ - require_no_parentheses
287
+
288
+ Style/MethodLength:
289
+ CountComments: false # count full line comments?
290
+ Max: 10
291
+
292
+ Style/MethodName:
293
+ EnforcedStyle: snake_case
294
+ SupportedStyles:
295
+ - snake_case
296
+ - camelCase
297
+
298
+ Style/NumericLiterals:
299
+ MinDigits: 5
300
+
301
+ Style/ParameterLists:
302
+ Max: 5
303
+ CountKeywordArgs: true
304
+
305
+ # Allow safe assignment in conditions.
306
+ Style/ParenthesesAroundCondition:
307
+ AllowSafeAssignment: true
308
+
309
+ Style/PercentLiteralDelimiters:
310
+ PreferredDelimiters:
311
+ '%': ()
312
+ '%i': ()
313
+ '%q': ()
314
+ '%Q': ()
315
+ '%r': '{}'
316
+ '%s': ()
317
+ '%w': ()
318
+ '%W': ()
319
+ '%x': ()
320
+
321
+ Style/PredicateName:
322
+ NamePrefixBlacklist:
323
+ - is_
324
+ - has_
325
+ - have_
326
+
327
+ Style/RaiseArgs:
328
+ EnforcedStyle: exploded
329
+ SupportedStyles:
330
+ - compact # raise Exception.new(msg)
331
+ - exploded # raise Exception, msg
332
+
333
+
334
+ Style/RedundantReturn:
335
+ # When true allows code like `return x, y`.
336
+ AllowMultipleReturnValues: false
337
+
338
+ Style/RegexpLiteral:
339
+ # The maximum number of (escaped) slashes that a slash-delimited regexp is
340
+ # allowed to have. If there are more slashes, a %r regexp shall be used.
341
+ MaxSlashes: 1
342
+
343
+ Style/Semicolon:
344
+ # Allow ; to separate several expressions on the same line.
345
+ AllowAsExpressionSeparator: false
346
+
347
+ Style/SignalException:
348
+ EnforcedStyle: semantic
349
+ SupportedStyles:
350
+ - only_raise
351
+ - only_fail
352
+ - semantic
353
+
354
+
355
+ Style/SingleLineBlockParams:
356
+ Methods:
357
+ - reduce:
358
+ - a
359
+ - e
360
+ - inject:
361
+ - a
362
+ - e
363
+
364
+ Style/SingleLineMethods:
365
+ AllowIfMethodIsEmpty: true
366
+
367
+ Style/StringLiterals:
368
+ EnforcedStyle: single_quotes
369
+ SupportedStyles:
370
+ - single_quotes
371
+ - double_quotes
372
+
373
+ Style/SpaceAroundEqualsInParameterDefault:
374
+ EnforcedStyle: space
375
+ SupportedStyles:
376
+ - space
377
+ - no_space
378
+
379
+ Style/SpaceBeforeBlockBraces:
380
+ EnforcedStyle: space
381
+ SupportedStyles:
382
+ - space
383
+ - no_space
384
+
385
+ Style/SpaceInsideBlockBraces:
386
+ EnforcedStyle: space
387
+ SupportedStyles:
388
+ - space
389
+ - no_space
390
+ # Valid values are: space, no_space
391
+ EnforcedStyleForEmptyBraces: no_space
392
+ # Space between { and |. Overrides EnforcedStyle if there is a conflict.
393
+ SpaceBeforeBlockParameters: true
394
+
395
+ Style/SpaceInsideHashLiteralBraces:
396
+ EnforcedStyle: space
397
+ EnforcedStyleForEmptyBraces: no_space
398
+ SupportedStyles:
399
+ - space
400
+ - no_space
401
+
402
+ Style/TrailingBlankLines:
403
+ EnforcedStyle: final_newline
404
+ SupportedStyles:
405
+ - final_newline
406
+ - final_blank_line
407
+
408
+ Style/TrailingComma:
409
+ # If EnforcedStyleForMultiline is comma, the cop allows a comma after the
410
+ # last item of a list, but only for lists where each item is on its own line.
411
+ EnforcedStyleForMultiline: no_comma
412
+ SupportedStyles:
413
+ - comma
414
+ - no_comma
415
+
416
+ # TrivialAccessors doesn't require exact name matches and doesn't allow
417
+ # predicated methods by default.
418
+ Style/TrivialAccessors:
419
+ ExactNameMatch: false
420
+ AllowPredicates: false
421
+ # Allows trivial writers that don't end in an equal sign. e.g.
422
+ #
423
+ # def on_exception(action)
424
+ # @on_exception=action
425
+ # end
426
+ # on_exception :restart
427
+ #
428
+ # Commonly used in DSLs
429
+ AllowDSLWriters: false
430
+ Whitelist:
431
+ - to_ary
432
+ - to_a
433
+ - to_c
434
+ - to_enum
435
+ - to_h
436
+ - to_hash
437
+ - to_i
438
+ - to_int
439
+ - to_io
440
+ - to_open
441
+ - to_path
442
+ - to_proc
443
+ - to_r
444
+ - to_regexp
445
+ - to_str
446
+ - to_s
447
+ - to_sym
448
+
449
+ Style/VariableName:
450
+ EnforcedStyle: snake_case
451
+ SupportedStyles:
452
+ - snake_case
453
+ - camelCase
454
+
455
+ Style/WhileUntilModifier:
456
+ Enabled: false
457
+
458
+ Style/WordArray:
459
+ MinSize: 0
460
+
461
+ ##################### Lint ##################################
462
+
463
+ # Allow safe assignment in conditions.
464
+ Lint/AssignmentInCondition:
465
+ AllowSafeAssignment: true
466
+
467
+ # Align ends correctly.
468
+ Lint/EndAlignment:
469
+ # The value `keyword` means that `end` should be aligned with the matching
470
+ # keyword (if, while, etc.).
471
+ # The value `variable` means that in assignments, `end` should be aligned
472
+ # with the start of the variable on the left hand side of `=`. In all other
473
+ # situations, `end` should still be aligned with the keyword.
474
+ AlignWith: keyword
475
+ SupportedStyles:
476
+ - keyword
477
+ - variable
478
+
479
+ Lint/DefEndAlignment:
480
+ # The value `def` means that `end` should be aligned with the def keyword.
481
+ # The value `start_of_line` means that `end` should be aligned with method
482
+ # calls like `private`, `public`, etc, if present in front of the `def`
483
+ # keyword on the same line.
484
+ AlignWith: start_of_line
485
+ SupportedStyles:
486
+ - start_of_line
487
+ - def