wix-hive-ruby 0.9.1 → 0.9.2

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 (31) hide show
  1. checksums.yaml +5 -13
  2. data/README.md +30 -16
  3. data/e2e/activities_api_spec.rb +44 -18
  4. data/e2e/contacts_api_spec.rb +57 -35
  5. data/e2e/e2e_helper.rb +0 -4
  6. data/lib/hive/activities/contact/contact_create_activity.rb +1 -1
  7. data/lib/hive/activities/contact/contact_form_activity.rb +1 -1
  8. data/lib/hive/activities/conversion/conversion_complete_activity.rb +2 -2
  9. data/lib/hive/activities/e_commerce/purchase_activity.rb +1 -1
  10. data/lib/hive/activities/factory.rb +5 -2
  11. data/lib/hive/activities/hotels/hotels_cancel_activity.rb +1 -1
  12. data/lib/hive/activities/hotels/hotels_confirmation_activity.rb +3 -1
  13. data/lib/hive/activities/hotels/hotels_purchase_activity.rb +1 -1
  14. data/lib/hive/activities/hotels/hotels_purchase_failed_activity.rb +1 -1
  15. data/lib/hive/activities/messaging/send_activity.rb +2 -2
  16. data/lib/hive/activities/music/album_fan_activity.rb +2 -16
  17. data/lib/hive/activities/music/album_played_activity.rb +36 -0
  18. data/lib/hive/activities/music/album_share_activity.rb +2 -2
  19. data/lib/hive/activities/music/track_lyrics_activity.rb +2 -9
  20. data/lib/hive/activities/music/track_play_activity.rb +2 -9
  21. data/lib/hive/activities/music/track_played_activity.rb +2 -9
  22. data/lib/hive/activities/music/track_share_activity.rb +2 -9
  23. data/lib/hive/activities/music/track_skipped_activity.rb +2 -9
  24. data/lib/hive/activities/scheduler/scheduler_appointment_activity.rb +1 -1
  25. data/lib/hive/rest/contacts.rb +34 -34
  26. data/lib/hive/version.rb +1 -1
  27. data/spec/hive/activities/conversion/conversion_complete_activity_spec.rb +1 -1
  28. data/spec/hive/activities/factory_spec.rb +7 -3
  29. data/spec/hive/activities/messaging/send_activity_spec.rb +1 -1
  30. data/spec/hive/rest/contacts_spec.rb +15 -15
  31. metadata +52 -50
@@ -29,7 +29,3 @@ def client
29
29
  config.instance_id = 'YOUR_INSTANCE_ID'
30
30
  end
31
31
  end
32
-
33
- def pendingImpl
34
- pending 'To be implemented'
35
- end
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.470Z
2
+ # Generated on 2014-10-01T07:31:22.131Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.439Z
2
+ # Generated on 2014-10-01T07:31:22.097Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.479Z
2
+ # Generated on 2014-10-01T07:31:22.140Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -10,7 +10,7 @@ module Hive
10
10
  class Metadata < Hashie::Trash
11
11
  include Hashie::Extensions::IgnoreUndeclared
12
12
 
13
- property :property, required: true
13
+ property :name, required: true
14
14
  property :value, required: true
15
15
  end
16
16
 
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.514Z
2
+ # Generated on 2014-10-01T07:31:22.174Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -1,11 +1,12 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.632Z
2
+ # Generated on 2014-10-01T07:31:22.295Z
3
3
 
4
4
  require 'hive/activities/contact/contact_form_activity'
5
5
  require 'hive/activities/contact/contact_create_activity'
6
6
  require 'hive/activities/conversion/conversion_complete_activity'
7
7
  require 'hive/activities/e_commerce/purchase_activity'
8
8
  require 'hive/activities/messaging/send_activity'
9
+ require 'hive/activities/music/album_played_activity'
9
10
  require 'hive/activities/music/album_fan_activity'
10
11
  require 'hive/activities/music/album_share_activity'
11
12
  require 'hive/activities/music/track_lyrics_activity'
@@ -34,6 +35,8 @@ module Hive
34
35
 
35
36
  MESSAGING_SEND = ActivityType.new(Messaging::SendActivity, 'messaging/send')
36
37
 
38
+ MUSIC_ALBUM_PLAYED = ActivityType.new(Music::PlayedActivity, 'music/album-played')
39
+
37
40
  MUSIC_ALBUM_FAN = ActivityType.new(Music::FanActivity, 'music/album-fan')
38
41
 
39
42
  MUSIC_ALBUM_SHARE = ActivityType.new(Music::ShareActivity, 'music/album-share')
@@ -58,7 +61,7 @@ module Hive
58
61
 
59
62
  SCHEDULER_APPOINTMENT = ActivityType.new(Scheduler::AppointmentActivity, 'scheduler/appointment')
60
63
 
61
- TYPES = [CONTACT_CONTACT_FORM, CONTACTS_CREATE, CONVERSION_COMPLETE, E_COMMERCE_PURCHASE, MESSAGING_SEND, MUSIC_ALBUM_FAN, MUSIC_ALBUM_SHARE, MUSIC_TRACK_LYRICS, MUSIC_TRACK_PLAY, MUSIC_TRACK_PLAYED, MUSIC_TRACK_SKIP, MUSIC_TRACK_SHARE, HOTELS_CONFIRMATION, HOTELS_CANCEL, HOTELS_PURCHASE, HOTELS_PURCHASE_FAILED, SCHEDULER_APPOINTMENT]
64
+ TYPES = [CONTACT_CONTACT_FORM, CONTACTS_CREATE, CONVERSION_COMPLETE, E_COMMERCE_PURCHASE, MESSAGING_SEND, MUSIC_ALBUM_PLAYED, MUSIC_ALBUM_FAN, MUSIC_ALBUM_SHARE, MUSIC_TRACK_LYRICS, MUSIC_TRACK_PLAY, MUSIC_TRACK_PLAYED, MUSIC_TRACK_SKIP, MUSIC_TRACK_SHARE, HOTELS_CONFIRMATION, HOTELS_CANCEL, HOTELS_PURCHASE, HOTELS_PURCHASE_FAILED, SCHEDULER_APPOINTMENT]
62
65
 
63
66
  module_function
64
67
 
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.594Z
2
+ # Generated on 2014-10-01T07:31:22.261Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.580Z
2
+ # Generated on 2014-10-01T07:31:22.247Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -90,10 +90,12 @@ module Hive
90
90
  include Hashie::Extensions::Coercion
91
91
 
92
92
  coerce_key :beds, Array[Bed]
93
+ coerce_key :amenities, Array[String]
93
94
 
94
95
  property :id
95
96
  property :beds, default: []
96
97
  property :maxOccupancy, required: true
98
+ property :amenities, default: []
97
99
 
98
100
  def add_bed(args)
99
101
  beds << Bed.new(args)
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.609Z
2
+ # Generated on 2014-10-01T07:31:22.275Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.623Z
2
+ # Generated on 2014-10-01T07:31:22.288Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.530Z
2
+ # Generated on 2014-10-01T07:31:22.189Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -41,7 +41,7 @@ module Hive
41
41
  class Metadata < Hashie::Trash
42
42
  include Hashie::Extensions::IgnoreUndeclared
43
43
 
44
- property :property, required: true
44
+ property :name, required: true
45
45
  property :value, required: true
46
46
  end
47
47
 
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.534Z
2
+ # Generated on 2014-10-01T07:31:22.196Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -7,20 +7,6 @@ require 'hive/extensions/hashie_validate_enum'
7
7
  module Hive
8
8
  module Activities
9
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
10
  class FanActivity < Hashie::Trash
25
11
  include Hashie::Extensions::IgnoreUndeclared
26
12
  include Hashie::Extensions::Coercion
@@ -28,7 +14,7 @@ module Hive
28
14
  coerce_key :album, Album
29
15
  coerce_key :artist, Artist
30
16
 
31
- property :album
17
+ property :album, required: true
32
18
  property :artist
33
19
  end
34
20
  end
@@ -0,0 +1,36 @@
1
+ # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
+ # Generated on 2014-10-01T07:31:22.192Z
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 PlayedActivity < 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, required: true
32
+ property :artist
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.538Z
2
+ # Generated on 2014-10-01T07:31:22.200Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -14,7 +14,7 @@ module Hive
14
14
  coerce_key :album, Album
15
15
  coerce_key :artist, Artist
16
16
 
17
- property :album
17
+ property :album, required: true
18
18
  property :artist
19
19
  property :sharedTo, required: true, transform_with: Hashie::Validate.enum(%w(FACEBOOK GOOGLE_PLUS TWITTER))
20
20
  end
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.543Z
2
+ # Generated on 2014-10-01T07:31:22.208Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -18,18 +18,11 @@ module Hive
18
18
  include Hashie::Extensions::IgnoreUndeclared
19
19
  include Hashie::Extensions::Coercion
20
20
 
21
- class Album < Hashie::Trash
22
- include Hashie::Extensions::IgnoreUndeclared
23
-
24
- property :name
25
- property :id
26
- end
27
-
28
21
  coerce_key :track, Track
29
22
  coerce_key :album, Album
30
23
  coerce_key :artist, Artist
31
24
 
32
- property :track
25
+ property :track, required: true
33
26
  property :album
34
27
  property :artist
35
28
  end
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.549Z
2
+ # Generated on 2014-10-01T07:31:22.215Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -11,18 +11,11 @@ module Hive
11
11
  include Hashie::Extensions::IgnoreUndeclared
12
12
  include Hashie::Extensions::Coercion
13
13
 
14
- class Album < Hashie::Trash
15
- include Hashie::Extensions::IgnoreUndeclared
16
-
17
- property :name
18
- property :id
19
- end
20
-
21
14
  coerce_key :track, Track
22
15
  coerce_key :album, Album
23
16
  coerce_key :artist, Artist
24
17
 
25
- property :track
18
+ property :track, required: true
26
19
  property :album
27
20
  property :artist
28
21
  end
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.555Z
2
+ # Generated on 2014-10-01T07:31:22.222Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -11,18 +11,11 @@ module Hive
11
11
  include Hashie::Extensions::IgnoreUndeclared
12
12
  include Hashie::Extensions::Coercion
13
13
 
14
- class Album < Hashie::Trash
15
- include Hashie::Extensions::IgnoreUndeclared
16
-
17
- property :name
18
- property :id
19
- end
20
-
21
14
  coerce_key :track, Track
22
15
  coerce_key :album, Album
23
16
  coerce_key :artist, Artist
24
17
 
25
- property :track
18
+ property :track, required: true
26
19
  property :album
27
20
  property :artist
28
21
  end
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.569Z
2
+ # Generated on 2014-10-01T07:31:22.236Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -11,18 +11,11 @@ module Hive
11
11
  include Hashie::Extensions::IgnoreUndeclared
12
12
  include Hashie::Extensions::Coercion
13
13
 
14
- class Album < Hashie::Trash
15
- include Hashie::Extensions::IgnoreUndeclared
16
-
17
- property :name
18
- property :id
19
- end
20
-
21
14
  coerce_key :track, Track
22
15
  coerce_key :album, Album
23
16
  coerce_key :artist, Artist
24
17
 
25
- property :track
18
+ property :track, required: true
26
19
  property :album
27
20
  property :artist
28
21
  property :sharedTo, required: true, transform_with: Hashie::Validate.enum(%w(FACEBOOK GOOGLE_PLUS TWITTER))
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.561Z
2
+ # Generated on 2014-10-01T07:31:22.230Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -11,18 +11,11 @@ module Hive
11
11
  include Hashie::Extensions::IgnoreUndeclared
12
12
  include Hashie::Extensions::Coercion
13
13
 
14
- class Album < Hashie::Trash
15
- include Hashie::Extensions::IgnoreUndeclared
16
-
17
- property :name
18
- property :id
19
- end
20
-
21
14
  coerce_key :track, Track
22
15
  coerce_key :album, Album
23
16
  coerce_key :artist, Artist
24
17
 
25
- property :track
18
+ property :track, required: true
26
19
  property :album
27
20
  property :artist
28
21
  end
@@ -1,5 +1,5 @@
1
1
  # THIS IS A GENERATED FILE, DO NOT EDIT THIS
2
- # Generated on 2014-09-10T14:02:21.629Z
2
+ # Generated on 2014-10-01T07:31:22.293Z
3
3
 
4
4
  require 'hashie'
5
5
  require 'hive/extensions/hashie_validate_enum'
@@ -40,74 +40,74 @@ module Hive
40
40
  # edit_contact_field("v1/contacts/#{contact_id}", contact)
41
41
  end
42
42
 
43
- def update_contact_name(id, name)
44
- edit_contact_field("v1/contacts/#{id}/name", name)
43
+ def update_contact_name(id, name, modified_at)
44
+ edit_contact_field("v1/contacts/#{id}/name", name, modified_at)
45
45
  end
46
46
 
47
- def update_contact_company(id, company)
48
- edit_contact_field("v1/contacts/#{id}/company", company)
47
+ def update_contact_company(id, company, modified_at)
48
+ edit_contact_field("v1/contacts/#{id}/company", company, modified_at)
49
49
  end
50
50
 
51
- def update_contact_picture(id, picture)
52
- edit_contact_field("v1/contacts/#{id}/picture", picture)
51
+ def update_contact_picture(id, picture, modified_at)
52
+ edit_contact_field("v1/contacts/#{id}/picture", picture, modified_at)
53
53
  end
54
54
 
55
- def update_contact_address(id, address_id, address)
56
- edit_contact_field("v1/contacts/#{id}/address/#{address_id}", address)
55
+ def update_contact_address(id, address_id, address, modified_at)
56
+ edit_contact_field("v1/contacts/#{id}/address/#{address_id}", address, modified_at)
57
57
  end
58
58
 
59
- def update_contact_email(id, email_id, email)
60
- edit_contact_field("v1/contacts/#{id}/email/#{email_id}", email)
59
+ def update_contact_email(id, email_id, email, modified_at)
60
+ edit_contact_field("v1/contacts/#{id}/email/#{email_id}", email, modified_at)
61
61
  end
62
62
 
63
- def update_contact_phone(id, phone_id, phone)
64
- edit_contact_field("v1/contacts/#{id}/phone/#{phone_id}", phone)
63
+ def update_contact_phone(id, phone_id, phone, modified_at)
64
+ edit_contact_field("v1/contacts/#{id}/phone/#{phone_id}", phone, modified_at)
65
65
  end
66
66
 
67
- def update_contact_date(id, date_id, date)
68
- edit_contact_field("v1/contacts/#{id}/date/#{date_id}", date)
67
+ def update_contact_date(id, date_id, date, modified_at)
68
+ edit_contact_field("v1/contacts/#{id}/date/#{date_id}", date, modified_at)
69
69
  end
70
70
 
71
- def update_contact_note(id, note_id, note)
72
- edit_contact_field("v1/contacts/#{id}/note/#{note_id}", note)
71
+ def update_contact_note(id, note_id, note, modified_at)
72
+ edit_contact_field("v1/contacts/#{id}/note/#{note_id}", note, modified_at)
73
73
  end
74
74
 
75
- def update_contact_custom(id, custom_id, custom)
76
- edit_contact_field("v1/contacts/#{id}/custom/#{custom_id}", custom)
75
+ def update_contact_custom(id, custom_id, custom, modified_at)
76
+ edit_contact_field("v1/contacts/#{id}/custom/#{custom_id}", custom, modified_at)
77
77
  end
78
78
 
79
- def add_contact_address(id, address)
80
- add_contact_field("v1/contacts/#{id}/address", address)
79
+ def add_contact_address(id, address, modified_at)
80
+ add_contact_field("v1/contacts/#{id}/address", address, modified_at)
81
81
  end
82
82
 
83
- def add_contact_email(id, email)
84
- add_contact_field("v1/contacts/#{id}/email", email)
83
+ def add_contact_email(id, email, modified_at)
84
+ add_contact_field("v1/contacts/#{id}/email", email, modified_at)
85
85
  end
86
86
 
87
- def add_contact_phone(id, phone)
88
- add_contact_field("v1/contacts/#{id}/phone", phone)
87
+ def add_contact_phone(id, phone, modified_at)
88
+ add_contact_field("v1/contacts/#{id}/phone", phone, modified_at)
89
89
  end
90
90
 
91
- def add_contact_note(id, note)
92
- add_contact_field("v1/contacts/#{id}/note", note)
91
+ def add_contact_note(id, note, modified_at)
92
+ add_contact_field("v1/contacts/#{id}/note", note, modified_at)
93
93
  end
94
94
 
95
- def add_contact_custom(id, custom)
96
- add_contact_field("v1/contacts/#{id}/custom", custom)
95
+ def add_contact_custom(id, custom, modified_at)
96
+ add_contact_field("v1/contacts/#{id}/custom", custom, modified_at)
97
97
  end
98
98
 
99
- def add_contact_tags(id, tags)
100
- add_contact_field("v1/contacts/#{id}/tags", tags)
99
+ def add_contact_tags(id, tags, modified_at)
100
+ add_contact_field("v1/contacts/#{id}/tags", tags, modified_at)
101
101
  end
102
102
 
103
103
  private
104
104
 
105
- def edit_contact_field(url, body)
106
- perform_with_object(:put, url, Hive::Contact, body: body.to_json, params: { modifiedAt: Time.now.iso8601(3) })
105
+ def edit_contact_field(url, body, modified_at)
106
+ perform_with_object(:put, url, Hive::Contact, body: body.to_json, params: { modifiedAt: modified_at })
107
107
  end
108
108
 
109
- def add_contact_field(url, body)
110
- perform_with_object(:post, url, Hive::Contact, body: body.to_json, params: { modifiedAt: Time.now.iso8601(3) })
109
+ def add_contact_field(url, body, modified_at)
110
+ perform_with_object(:post, url, Hive::Contact, body: body.to_json, params: { modifiedAt: modified_at })
111
111
  end
112
112
  end
113
113
  end