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,52 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.594Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Hotels
10
+ class Refund < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ property :kind, required: true, transform_with: Hashie::Validate.enum(%w(FULL PARTIAL NONE))
14
+ property :total, required: true
15
+ property :currency, required: true
16
+ property :notes
17
+ property :destination, required: true
18
+ end
19
+
20
+ class CancelActivity < Hashie::Trash
21
+ include Hashie::Extensions::IgnoreUndeclared
22
+ include Hashie::Extensions::Coercion
23
+
24
+ coerce_key :refund, Refund
25
+ coerce_key :guests, Guest
26
+ coerce_key :stay, Stay
27
+ coerce_key :rates, Array[Rate]
28
+ coerce_key :invoice, Invoice
29
+ coerce_key :customer, Customer
30
+ coerce_key :rooms, Array[Room]
31
+
32
+ property :cancelDate, required: true
33
+ property :refund, required: true
34
+ property :reservationId
35
+ property :guests, required: true
36
+ property :stay, required: true
37
+ property :rates, default: []
38
+ property :invoice, required: true
39
+ property :customer
40
+ property :rooms, default: []
41
+
42
+ def add_rate(args)
43
+ rates << Rate.new(args)
44
+ end
45
+
46
+ def add_room(args)
47
+ rooms << Room.new(args)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,133 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.580Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Hotels
10
+ class Guest < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ property :total, required: true
14
+ property :adults, required: true
15
+ property :children, required: true
16
+ end
17
+
18
+ class Stay < Hashie::Trash
19
+ include Hashie::Extensions::IgnoreUndeclared
20
+
21
+ property :checkin, required: true
22
+ property :checkout, required: true
23
+ end
24
+
25
+ class Tax < Hashie::Trash
26
+ include Hashie::Extensions::IgnoreUndeclared
27
+
28
+ property :name, required: true
29
+ property :total, required: true
30
+ property :currency, required: true
31
+ end
32
+
33
+ class Rate < Hashie::Trash
34
+ include Hashie::Extensions::IgnoreUndeclared
35
+ include Hashie::Extensions::Coercion
36
+
37
+ coerce_key :taxes, Array[Tax]
38
+
39
+ property :date, required: true
40
+ property :subtotal, required: true
41
+ property :taxes, default: []
42
+ property :total, required: true
43
+ property :currency, required: true
44
+
45
+ def add_tax(args)
46
+ taxes << Tax.new(args)
47
+ end
48
+ end
49
+
50
+ class Invoice < Hashie::Trash
51
+ include Hashie::Extensions::IgnoreUndeclared
52
+
53
+ property :subtotal, required: true
54
+ property :total, required: true
55
+ property :currency, required: true
56
+ end
57
+
58
+ class Name < Hashie::Trash
59
+ include Hashie::Extensions::IgnoreUndeclared
60
+
61
+ property :prefix
62
+ property :first
63
+ property :middle
64
+ property :last
65
+ property :suffix
66
+ end
67
+
68
+ class Customer < Hashie::Trash
69
+ include Hashie::Extensions::IgnoreUndeclared
70
+ include Hashie::Extensions::Coercion
71
+
72
+ coerce_key :name, Name
73
+
74
+ property :contactId
75
+ property :isGuest
76
+ property :name
77
+ property :phone
78
+ property :email
79
+ end
80
+
81
+ class Bed < Hashie::Trash
82
+ include Hashie::Extensions::IgnoreUndeclared
83
+
84
+ property :kind, required: true
85
+ property :sleeps
86
+ end
87
+
88
+ class Room < Hashie::Trash
89
+ include Hashie::Extensions::IgnoreUndeclared
90
+ include Hashie::Extensions::Coercion
91
+
92
+ coerce_key :beds, Array[Bed]
93
+
94
+ property :id
95
+ property :beds, default: []
96
+ property :maxOccupancy, required: true
97
+
98
+ def add_bed(args)
99
+ beds << Bed.new(args)
100
+ end
101
+ end
102
+
103
+ class ConfirmationActivity < Hashie::Trash
104
+ include Hashie::Extensions::IgnoreUndeclared
105
+ include Hashie::Extensions::Coercion
106
+
107
+ coerce_key :guests, Guest
108
+ coerce_key :stay, Stay
109
+ coerce_key :rates, Array[Rate]
110
+ coerce_key :invoice, Invoice
111
+ coerce_key :customer, Customer
112
+ coerce_key :rooms, Array[Room]
113
+
114
+ property :source, required: true, transform_with: Hashie::Validate.enum(%w(GUEST STAFF))
115
+ property :reservationId
116
+ property :guests, required: true
117
+ property :stay, required: true
118
+ property :rates, default: []
119
+ property :invoice, required: true
120
+ property :customer
121
+ property :rooms, default: []
122
+
123
+ def add_rate(args)
124
+ rates << Rate.new(args)
125
+ end
126
+
127
+ def add_room(args)
128
+ rooms << Room.new(args)
129
+ end
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1,48 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.609Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Hotels
10
+ class Payment < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ property :subtotal, required: true
14
+ property :total, required: true
15
+ property :currency, required: true
16
+ property :source, required: true
17
+ end
18
+
19
+ class PurchaseActivity < Hashie::Trash
20
+ include Hashie::Extensions::IgnoreUndeclared
21
+ include Hashie::Extensions::Coercion
22
+
23
+ coerce_key :guests, Guest
24
+ coerce_key :stay, Stay
25
+ coerce_key :rates, Array[Rate]
26
+ coerce_key :payment, Payment
27
+ coerce_key :customer, Customer
28
+ coerce_key :rooms, Array[Room]
29
+
30
+ property :reservationId
31
+ property :guests, required: true
32
+ property :stay, required: true
33
+ property :rates, default: []
34
+ property :payment, required: true
35
+ property :customer
36
+ property :rooms, default: []
37
+
38
+ def add_rate(args)
39
+ rates << Rate.new(args)
40
+ end
41
+
42
+ def add_room(args)
43
+ rooms << Room.new(args)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,59 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.623Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Hotels
10
+ class Error < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ property :errorCode
14
+ property :reason
15
+ end
16
+
17
+ class PurchaseFailedActivity < Hashie::Trash
18
+ include Hashie::Extensions::IgnoreUndeclared
19
+ include Hashie::Extensions::Coercion
20
+
21
+ class Payment < Hashie::Trash
22
+ include Hashie::Extensions::IgnoreUndeclared
23
+ include Hashie::Extensions::Coercion
24
+
25
+ coerce_key :error, Error
26
+
27
+ property :subtotal, required: true
28
+ property :total, required: true
29
+ property :currency, required: true
30
+ property :source, required: true
31
+ property :error
32
+ end
33
+
34
+ coerce_key :guests, Guest
35
+ coerce_key :stay, Stay
36
+ coerce_key :rates, Array[Rate]
37
+ coerce_key :payment, Payment
38
+ coerce_key :customer, Customer
39
+ coerce_key :rooms, Array[Room]
40
+
41
+ property :reservationId
42
+ property :guests, required: true
43
+ property :stay, required: true
44
+ property :rates, default: []
45
+ property :payment, required: true
46
+ property :customer
47
+ property :rooms, default: []
48
+
49
+ def add_rate(args)
50
+ rates << Rate.new(args)
51
+ end
52
+
53
+ def add_room(args)
54
+ rooms << Room.new(args)
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,75 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.530Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Messaging
10
+ class Name < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ property :prefix
14
+ property :first
15
+ property :middle
16
+ property :last
17
+ property :suffix
18
+ end
19
+
20
+ class Destination < Hashie::Trash
21
+ include Hashie::Extensions::IgnoreUndeclared
22
+ include Hashie::Extensions::Coercion
23
+
24
+ coerce_key :name, Name
25
+
26
+ property :target, required: true
27
+ property :name
28
+ end
29
+
30
+ class Recipient < Hashie::Trash
31
+ include Hashie::Extensions::IgnoreUndeclared
32
+ include Hashie::Extensions::Coercion
33
+
34
+ coerce_key :destination, Destination
35
+
36
+ property :method, required: true, transform_with: Hashie::Validate.enum(%w(EMAIL SMS PHONE SOCIAL))
37
+ property :destination, required: true
38
+ property :contactId
39
+ end
40
+
41
+ class Metadata < Hashie::Trash
42
+ include Hashie::Extensions::IgnoreUndeclared
43
+
44
+ property :property, required: true
45
+ property :value, required: true
46
+ end
47
+
48
+ class ConversionTarget < Hashie::Trash
49
+ include Hashie::Extensions::IgnoreUndeclared
50
+ include Hashie::Extensions::Coercion
51
+
52
+ coerce_key :metadata, Array[Metadata]
53
+
54
+ property :conversionType, required: true, transform_with: Hashie::Validate.enum(%w(PAGEVIEW PURCHASE UPGRADE LIKE FAN NONE))
55
+ property :metadata, default: []
56
+
57
+ def add_metadata(args)
58
+ metadata << Metadata.new(args)
59
+ end
60
+ end
61
+
62
+ class SendActivity < Hashie::Trash
63
+ include Hashie::Extensions::IgnoreUndeclared
64
+ include Hashie::Extensions::Coercion
65
+
66
+ coerce_key :recipient, Recipient
67
+ coerce_key :conversionTarget, ConversionTarget
68
+
69
+ property :recipient, required: true
70
+ property :messageId
71
+ property :conversionTarget
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,36 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.534Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Music
10
+ class Album < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ property :name, required: true
14
+ property :id
15
+ end
16
+
17
+ class Artist < Hashie::Trash
18
+ include Hashie::Extensions::IgnoreUndeclared
19
+
20
+ property :name, required: true
21
+ property :id
22
+ end
23
+
24
+ class FanActivity < Hashie::Trash
25
+ include Hashie::Extensions::IgnoreUndeclared
26
+ include Hashie::Extensions::Coercion
27
+
28
+ coerce_key :album, Album
29
+ coerce_key :artist, Artist
30
+
31
+ property :album
32
+ property :artist
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,23 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.538Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Music
10
+ class ShareActivity < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+ include Hashie::Extensions::Coercion
13
+
14
+ coerce_key :album, Album
15
+ coerce_key :artist, Artist
16
+
17
+ property :album
18
+ property :artist
19
+ property :sharedTo, required: true, transform_with: Hashie::Validate.enum(%w(FACEBOOK GOOGLE_PLUS TWITTER))
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,38 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-09-10T14:02:21.543Z
3
+
4
+ require 'hashie'
5
+ require 'hive/extensions/hashie_validate_enum'
6
+
7
+ module Hive
8
+ module Activities
9
+ module Music
10
+ class Track < Hashie::Trash
11
+ include Hashie::Extensions::IgnoreUndeclared
12
+
13
+ property :name, required: true
14
+ property :id
15
+ end
16
+
17
+ class LyricsActivity < Hashie::Trash
18
+ include Hashie::Extensions::IgnoreUndeclared
19
+ include Hashie::Extensions::Coercion
20
+
21
+ class Album < Hashie::Trash
22
+ include Hashie::Extensions::IgnoreUndeclared
23
+
24
+ property :name
25
+ property :id
26
+ end
27
+
28
+ coerce_key :track, Track
29
+ coerce_key :album, Album
30
+ coerce_key :artist, Artist
31
+
32
+ property :track
33
+ property :album
34
+ property :artist
35
+ end
36
+ end
37
+ end
38
+ end