trubl 1.4.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 (105) hide show
  1. data/.yardopts +8 -0
  2. data/LICENSE.md +20 -0
  3. data/README.md +72 -0
  4. data/Rakefile +11 -0
  5. data/lib/trubl.rb +30 -0
  6. data/lib/trubl/api/category.rb +33 -0
  7. data/lib/trubl/api/channel.rb +32 -0
  8. data/lib/trubl/api/conversation.rb +31 -0
  9. data/lib/trubl/api/hashtags.rb +45 -0
  10. data/lib/trubl/api/me.rb +68 -0
  11. data/lib/trubl/api/search.rb +35 -0
  12. data/lib/trubl/api/streams.rb +14 -0
  13. data/lib/trubl/api/suggested_users.rb +16 -0
  14. data/lib/trubl/api/touts.rb +143 -0
  15. data/lib/trubl/api/users.rb +79 -0
  16. data/lib/trubl/authorization.rb +7 -0
  17. data/lib/trubl/authorizations.rb +8 -0
  18. data/lib/trubl/base.rb +37 -0
  19. data/lib/trubl/category.rb +7 -0
  20. data/lib/trubl/channel.rb +7 -0
  21. data/lib/trubl/client.rb +252 -0
  22. data/lib/trubl/collection.rb +43 -0
  23. data/lib/trubl/conversation.rb +7 -0
  24. data/lib/trubl/hashtag.rb +7 -0
  25. data/lib/trubl/hashtags.rb +8 -0
  26. data/lib/trubl/oauth.rb +56 -0
  27. data/lib/trubl/pagination.rb +17 -0
  28. data/lib/trubl/tout.rb +29 -0
  29. data/lib/trubl/touts.rb +8 -0
  30. data/lib/trubl/user.rb +29 -0
  31. data/lib/trubl/users.rb +8 -0
  32. data/lib/trubl/version.rb +16 -0
  33. data/lib/trubl/widget.rb +15 -0
  34. data/lib/trubl/widgets.rb +8 -0
  35. data/spec/fixtures/category_response.json +1 -0
  36. data/spec/fixtures/category_touts_response.json +689 -0
  37. data/spec/fixtures/category_users_response.json +1709 -0
  38. data/spec/fixtures/channel_response.json +1 -0
  39. data/spec/fixtures/channel_touts_response.json +1 -0
  40. data/spec/fixtures/channel_users_response.json +1 -0
  41. data/spec/fixtures/client1_auth_resp.json +1 -0
  42. data/spec/fixtures/client2_auth_resp.json +1 -0
  43. data/spec/fixtures/conversation_authors_response.json +37 -0
  44. data/spec/fixtures/conversation_response.json +41 -0
  45. data/spec/fixtures/conversation_touts_response.json +107 -0
  46. data/spec/fixtures/featured_touts_response.json +4249 -0
  47. data/spec/fixtures/hashtag_response.json +1 -0
  48. data/spec/fixtures/hashtags_touts_response.json +304 -0
  49. data/spec/fixtures/latest_touts_response.json +3600 -0
  50. data/spec/fixtures/like_tout_response.json +109 -0
  51. data/spec/fixtures/me_authorizations_response.json +14 -0
  52. data/spec/fixtures/me_fb_sharing_response.json +21 -0
  53. data/spec/fixtures/me_friends_response.json +121 -0
  54. data/spec/fixtures/me_retrieve_user_friends_response.json +174 -0
  55. data/spec/fixtures/me_retrieve_user_liked_touts_response.json +1255 -0
  56. data/spec/fixtures/me_retrieve_user_touts_response.json +479 -0
  57. data/spec/fixtures/retout_tout_response.json +99 -0
  58. data/spec/fixtures/retrieve_me_response.json +35 -0
  59. data/spec/fixtures/retrieve_tout.json +98 -0
  60. data/spec/fixtures/retrieve_tout_response.json +98 -0
  61. data/spec/fixtures/search_hashtags_response.json +100 -0
  62. data/spec/fixtures/search_touts_response.json +304 -0
  63. data/spec/fixtures/search_users_response.json +37 -0
  64. data/spec/fixtures/suggested_hashtags_response.json +137 -0
  65. data/spec/fixtures/suggested_users_response.json +1 -0
  66. data/spec/fixtures/test.mp4 +0 -0
  67. data/spec/fixtures/tout.json +98 -0
  68. data/spec/fixtures/tout_conversation_response.json +41 -0
  69. data/spec/fixtures/touts_liked_by_response.json +65 -0
  70. data/spec/fixtures/touts_liked_by_user_response.json +106 -0
  71. data/spec/fixtures/touts_me_updates_response.json +357 -0
  72. data/spec/fixtures/touts_search_results.json +304 -0
  73. data/spec/fixtures/trending_hashtags_response.json +149 -0
  74. data/spec/fixtures/unlike_tout_response.json +109 -0
  75. data/spec/fixtures/update_me_response.json +35 -0
  76. data/spec/fixtures/user.json +28 -0
  77. data/spec/fixtures/user_followers.json +1409 -0
  78. data/spec/fixtures/user_touts_response.json +479 -0
  79. data/spec/fixtures/user_with_utf8.json +29 -0
  80. data/spec/fixtures/users.json +58 -0
  81. data/spec/fixtures/users_search_results.json +37 -0
  82. data/spec/fixtures/widgets.json +142 -0
  83. data/spec/spec_helper.rb +61 -0
  84. data/spec/trubl/api/category_spec.rb +39 -0
  85. data/spec/trubl/api/channel_spec.rb +39 -0
  86. data/spec/trubl/api/conversation_spec.rb +38 -0
  87. data/spec/trubl/api/hashtags_spec.rb +60 -0
  88. data/spec/trubl/api/me_spec.rb +98 -0
  89. data/spec/trubl/api/search_spec.rb +40 -0
  90. data/spec/trubl/api/streams_spec.rb +18 -0
  91. data/spec/trubl/api/suggested_users_spec.rb +17 -0
  92. data/spec/trubl/api/touts_spec.rb +215 -0
  93. data/spec/trubl/api/users_spec.rb +122 -0
  94. data/spec/trubl/base_spec.rb +88 -0
  95. data/spec/trubl/category_spec.rb +15 -0
  96. data/spec/trubl/channel_spec.rb +16 -0
  97. data/spec/trubl/client_spec.rb +141 -0
  98. data/spec/trubl/conversation_spec.rb +13 -0
  99. data/spec/trubl/hashtag_spec.rb +11 -0
  100. data/spec/trubl/oauth_spec.rb +27 -0
  101. data/spec/trubl/tout_spec.rb +41 -0
  102. data/spec/trubl/user_spec.rb +65 -0
  103. data/spec/trubl_spec.rb +23 -0
  104. data/trubl.gemspec +41 -0
  105. metadata +494 -0
@@ -0,0 +1,29 @@
1
+ {
2
+ "user": {
3
+ "avatar": {
4
+ "large": {
5
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/large/TwitterIcon2.jpg"
6
+ },
7
+ "medium": {
8
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/medium/TwitterIcon2.jpg"
9
+ },
10
+ "profile": {
11
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/profile/TwitterIcon2.jpg"
12
+ },
13
+ "small": {
14
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/small/TwitterIcon2.jpg"
15
+ }
16
+ },
17
+ "bio": "It gladdens me to know that Baldr's father [Odin] makes ready the benches for a banquet. Soon we shall be drinking ale from the curved horns. The champion who comes into Odin's dwelling [Valhalla] does not lament his death. I shall not enter his hall with words of fear upon my lips. The Æsir will welcome me. Death comes without lamenting… Eager am I to depart. The Dísir summon me home, those whom Odin sends for me Valkyries from the halls of the Lord of Hosts. Gladly shall I drink ale in the high-seat with the Æsir. The days of my life are ended. I laugh as I die.",
18
+ "followers_count": 1564,
19
+ "friendly_name": "Ragnarr Loðbrók",
20
+ "friends_count": 2,
21
+ "fullname": "Ragnarr Loðbrók",
22
+ "location": "The Norseland",
23
+ "touts_count": 28,
24
+ "uid": "loðbrók",
25
+ "username": "Ragnarr Loðbrók",
26
+ "verified": true
27
+ }
28
+ }
29
+
@@ -0,0 +1,58 @@
1
+ [
2
+ {
3
+ "user": {
4
+ "avatar": {
5
+ "large": {
6
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/large/TwitterIcon2.jpg"
7
+ },
8
+ "medium": {
9
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/medium/TwitterIcon2.jpg"
10
+ },
11
+ "profile": {
12
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/profile/TwitterIcon2.jpg"
13
+ },
14
+ "small": {
15
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/small/TwitterIcon2.jpg"
16
+ }
17
+ },
18
+ "bio": "\"My favorite $#*! ever\" - Questlove\r\n\r\nKarmin is Amy Ellis' pronounced rap flow and searing R&B influenced pop vocals married with Nick Noonan's multi-instrumental talent and smooth harmonies. The duo's dynamic chemistry results in a perfect ble",
19
+ "followers_count": 1564,
20
+ "friendly_name": "Wwe",
21
+ "friends_count": 2,
22
+ "fullname": "Wwe",
23
+ "location": "",
24
+ "touts_count": 28,
25
+ "uid": "wwe",
26
+ "username": "Wwe",
27
+ "verified": true
28
+ }
29
+ },
30
+ {
31
+ "user": {
32
+ "avatar": {
33
+ "large": {
34
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/large/TwitterIcon2.jpg"
35
+ },
36
+ "medium": {
37
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/medium/TwitterIcon2.jpg"
38
+ },
39
+ "profile": {
40
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/profile/TwitterIcon2.jpg"
41
+ },
42
+ "small": {
43
+ "http_url": "http://avatars.tout.com/u/d5dec37b9602443a03aaf9203949998b/small/TwitterIcon2.jpg"
44
+ }
45
+ },
46
+ "bio": "\"My favorite $#*! ever\" - Questlove\r\n\r\nKarmin is Amy Ellis' pronounced rap flow and searing R&B influenced pop vocals married with Nick Noonan's multi-instrumental talent and smooth harmonies. The duo's dynamic chemistry results in a perfect ble",
47
+ "followers_count": 1564,
48
+ "friendly_name": "Zackryder",
49
+ "friends_count": 2,
50
+ "fullname": "Zackryder",
51
+ "location": "",
52
+ "touts_count": 28,
53
+ "uid": "zackryder",
54
+ "username": "Zackryder",
55
+ "verified": true
56
+ }
57
+ }
58
+ ]
@@ -0,0 +1,37 @@
1
+ {
2
+ "pagination": {
3
+ "current_page": 1,
4
+ "per_page": 50,
5
+ "total_entries": 1
6
+ },
7
+ "users": [
8
+ {
9
+ "user": {
10
+ "avatar": {
11
+ "large": {
12
+ "http_url": "http://avatars.tout.com/u/c8e5ce4920132c340a1004506cf92a3b/large/MelissaJHartavatar.jpg"
13
+ },
14
+ "medium": {
15
+ "http_url": "http://avatars.tout.com/u/c8e5ce4920132c340a1004506cf92a3b/medium/MelissaJHartavatar.jpg"
16
+ },
17
+ "profile": {
18
+ "http_url": "http://avatars.tout.com/u/c8e5ce4920132c340a1004506cf92a3b/profile/MelissaJHartavatar.jpg"
19
+ },
20
+ "small": {
21
+ "http_url": "http://avatars.tout.com/u/c8e5ce4920132c340a1004506cf92a3b/small/MelissaJHartavatar.jpg"
22
+ }
23
+ },
24
+ "bio": "You may know me as Clarissa or Sabrina but my 2 boys Mason and Brady call me Mommy! Thats my favorite role yet!",
25
+ "followers_count": 806,
26
+ "friendly_name": "Melissa Joan Hart ",
27
+ "friends_count": 0,
28
+ "fullname": "Melissa Joan Hart ",
29
+ "location": "Living life!",
30
+ "touts_count": 44,
31
+ "uid": "mellyjhart",
32
+ "username": "MellyJHart",
33
+ "verified": true
34
+ }
35
+ }
36
+ ]
37
+ }
@@ -0,0 +1,142 @@
1
+ { "widgets": [
2
+ {
3
+ "widget": {
4
+ "uid": "d0cr9c",
5
+ "style": "broadcast",
6
+ "orientation": "vertical",
7
+ "title": "Widget Builder Marketing Page",
8
+ "width": "300",
9
+ "height": "600",
10
+ "has_anchor_tout": true,
11
+ "first_tout_open": true,
12
+ "order": "newest",
13
+ "commentable": true,
14
+ "open_graph_enabled": false,
15
+ "default_text": "",
16
+ "shareable": true,
17
+ "header_bg_color": "1985b7",
18
+ "footer_bg_color": "ffffff",
19
+ "body_bg_color": "e8e8e8",
20
+ "font_color": "ffffff",
21
+ "font_family": "Palatino Linotype",
22
+ "header_text": "Example Widget with Anchor Tout ___________________",
23
+ "header_link": "",
24
+ "display_header": true,
25
+ "allow_embed": true,
26
+ "created_at": "2012-08-31T13:05:27-07:00",
27
+ "updated_at": "2012-09-08T11:40:46-07:00",
28
+ "stream_id": 2496,
29
+ "autopopulate": false,
30
+ "autoplay": false,
31
+ "autorefresh": false,
32
+ "autorefresh_interval": null,
33
+ "ui_locale": "en-US",
34
+ "user": {
35
+ "username": "TeamTout",
36
+ "uid": "teamtout",
37
+ "fullname": "Team Tout",
38
+ "friendly_name": "Team Tout",
39
+ "verified": true,
40
+ "touts_count": 2176,
41
+ "followers_count": 25811,
42
+ "friends_count": 1731,
43
+ "last_tout_recorded_at": "2012-12-21T00:53:49Z",
44
+ "created_at": "2011-06-14T17:21:38Z",
45
+ "avatar": {
46
+ "profile": {
47
+ "http_url": "http://avatars-staging.tout.com/u/b49e63bc2e07da02c0d423f66a467a88/profile/ToutLogoAvatar.jpg"
48
+ },
49
+ "large": {
50
+ "http_url": "http://avatars-staging.tout.com/u/b49e63bc2e07da02c0d423f66a467a88/large/ToutLogoAvatar.jpg"
51
+ },
52
+ "medium": {
53
+ "http_url": "http://avatars-staging.tout.com/u/b49e63bc2e07da02c0d423f66a467a88/medium/ToutLogoAvatar.jpg"
54
+ },
55
+ "small": {
56
+ "http_url": "http://avatars-staging.tout.com/u/b49e63bc2e07da02c0d423f66a467a88/small/ToutLogoAvatar.jpg"
57
+ }
58
+ }
59
+ },
60
+ "anchor_tout": {
61
+ "uid": "j6l3uu",
62
+ "text": "This is an anchor Tout. ",
63
+ "parsed_text": {
64
+ "hashtags": [
65
+
66
+ ],
67
+ "mentions": [
68
+
69
+ ],
70
+ "urls": [
71
+
72
+ ]
73
+ },
74
+ "views_count": 254,
75
+ "likes_count": 10,
76
+ "total_likes_count": 10,
77
+ "replies_count": 1,
78
+ "retouts_count": 0,
79
+ "recorded_at": "2012-09-05T06:32:51Z",
80
+ "created_at": "2012-09-05T06:34:21Z",
81
+ "privacy": "public",
82
+ "user": {
83
+ "username": "AnchorTout",
84
+ "uid": "anchortout",
85
+ "fullname": "",
86
+ "verified": false,
87
+ "location": "",
88
+ "headline": "",
89
+ "bio": "",
90
+ "friendly_name": "AnchorTout",
91
+ "touts_count": 6,
92
+ "followers_count": 0,
93
+ "friends_count": 0,
94
+ "last_tout_recorded_at": "2012-09-18T02:11:07Z",
95
+ "created_at": "2012-09-05T05:45:10Z",
96
+ "avatar": {
97
+ "profile": {
98
+ "http_url": "http://avatars-staging.tout.com/u/83ae660c92aa860fbe368ab2278ad96d/profile/Screen_shot_2012-09-04_at_11.35.57_PM.png"
99
+ },
100
+ "large": {
101
+ "http_url": "http://avatars-staging.tout.com/u/83ae660c92aa860fbe368ab2278ad96d/large/Screen_shot_2012-09-04_at_11.35.57_PM.png"
102
+ },
103
+ "medium": {
104
+ "http_url": "http://avatars-staging.tout.com/u/83ae660c92aa860fbe368ab2278ad96d/medium/Screen_shot_2012-09-04_at_11.35.57_PM.png"
105
+ },
106
+ "small": {
107
+ "http_url": "http://avatars-staging.tout.com/u/83ae660c92aa860fbe368ab2278ad96d/small/Screen_shot_2012-09-04_at_11.35.57_PM.png"
108
+ }
109
+ }
110
+ },
111
+ "image": {
112
+ "poster": {
113
+ "width": 480,
114
+ "height": 360,
115
+ "http_url": "http://thumbnails-staging.tout.com/watermark/704197b1a83f2421c3f4d39525ad3486/poster-0.jpg"
116
+ },
117
+ "thumbnail": {
118
+ "width": 150,
119
+ "height": 112,
120
+ "http_url": "http://thumbnails-staging.tout.com/watermark/704197b1a83f2421c3f4d39525ad3486/thumbs-0.jpg"
121
+ }
122
+ },
123
+ "video": {
124
+ "type": "native",
125
+ "duration": 15,
126
+ "mp4": {
127
+ "width": 480,
128
+ "height": 360,
129
+ "http_url": "http://videos-staging.tout.com/watermark/mp4/704197b1a83f2421c3f4d39525ad3486.mp4"
130
+ }
131
+ }
132
+ },
133
+ "stream_uid": "bybq2v",
134
+ "stream_pusher_channel": "staging-filteredstream-bybq2v-7abb45b873a9d4b150171853d6885c3e",
135
+ "moderation_set": {
136
+ "uid": "vgn056",
137
+ "auto_approve": true
138
+ }
139
+ }
140
+ }
141
+
142
+ ] }
@@ -0,0 +1,61 @@
1
+ require 'uri'
2
+ require 'json'
3
+ require 'rspec'
4
+ require 'rspec_encoding_matchers'
5
+ require 'webmock/rspec'
6
+ require_relative '../lib/trubl'
7
+
8
+ class MockResponse
9
+ attr_accessor :body
10
+ def initialize(file)
11
+ @body = fixture(file)
12
+ end
13
+ end
14
+
15
+ def authed_client_for(user)
16
+
17
+ end
18
+
19
+ def stub_delete(uri)
20
+ request_stub(:delete, uri)
21
+ end
22
+
23
+ def stub_post(uri)
24
+ request_stub(:post, uri)
25
+ end
26
+
27
+ def stub_get(uri)
28
+ request_stub(:get, uri)
29
+ end
30
+
31
+ def stub_api_get(path, base_uri = "https://api.tout.com/api/v1/")
32
+ stub_get URI.join(base_uri, path).to_s
33
+ end
34
+
35
+ def api_get_request(path, base_uri = "https://api.tout.com/api/v1/")
36
+ some_request :get, URI.join(base_uri, path).to_s
37
+ end
38
+
39
+ def stub_put(uri)
40
+ request_stub(:put, uri)
41
+ end
42
+
43
+ def request_stub(method, uri)
44
+ stub_request(method, /.*?#{uri}.*?/)
45
+ end
46
+
47
+ def some_request(method, uri)
48
+ a_request(method, /.*?#{uri}.*?/)
49
+ end
50
+
51
+ def fixture(file)
52
+ File.read(File.expand_path('../fixtures/', __FILE__) +'/' + file)
53
+ end
54
+
55
+ def json_fixture(file)
56
+ JSON.parse(fixture(file))
57
+ end
58
+
59
+ def response_fixture(file)
60
+ MockResponse.new(file)
61
+ end
@@ -0,0 +1,39 @@
1
+ require_relative '../../spec_helper'
2
+ require 'trubl/client'
3
+ require 'webmock'
4
+
5
+ describe Trubl::API::Category do
6
+
7
+ let(:category_uid){"music"}
8
+
9
+ it '.retrieve_category parses a category response correctly' do
10
+ stub_api_get("categories/#{category_uid}").to_return(:body => fixture("category_response.json"))
11
+ category = Trubl::Client.new.retrieve_category(category_uid)
12
+ expect(category).to be_a Trubl::Category
13
+ expect(category.uid).to eq(category_uid)
14
+ api_get_request("categories/#{category_uid}").should have_been_made
15
+ end
16
+
17
+ it '.retrieve_category_users parses category users correctly' do
18
+ stub_api_get("categories/#{category_uid}/users").to_return(:body => fixture("category_users_response.json"))
19
+ users = Trubl::Client.new.retrieve_category_users(category_uid)
20
+ expect(users).to be_a Trubl::Users
21
+ #expect(users.pagination).to be_a Trubl::Pagination
22
+ users.each do |u|
23
+ expect(u).to be_a Trubl::User
24
+ end
25
+ api_get_request("categories/#{category_uid}/users").should have_been_made
26
+ end
27
+
28
+ it '.retrieve_category_touts parses category touts correctly' do
29
+ stub_api_get("categories/#{category_uid}/touts").to_return(:body => fixture("category_touts_response.json"))
30
+ touts = Trubl::Client.new.retrieve_category_touts(category_uid)
31
+ expect(touts).to be_a Trubl::Touts
32
+ #expect(touts.pagination).to be_a Trubl::Pagination
33
+ touts.each do |u|
34
+ expect(u).to be_a Trubl::Tout
35
+ end
36
+ api_get_request("categories/#{category_uid}/touts").should have_been_made
37
+ end
38
+
39
+ end
@@ -0,0 +1,39 @@
1
+ require_relative '../../spec_helper'
2
+ require 'trubl/client'
3
+ require 'webmock'
4
+
5
+ describe Trubl::API::Channel do
6
+
7
+ let(:channel_uid){"new-york-fashion-week"}
8
+
9
+ it '.retrieve_channel parses a channel response correctly' do
10
+ stub_api_get("channels/#{channel_uid}").to_return(:body => fixture("channel_response.json"))
11
+ channel = Trubl::Client.new.retrieve_channel(channel_uid)
12
+ expect(channel).to be_a Trubl::Channel
13
+ expect(channel.uid).to eq(channel_uid)
14
+ api_get_request("channels/#{channel_uid}").should have_been_made
15
+ end
16
+
17
+ it '.retrieve_channel_users parses channel users correctly' do
18
+ stub_api_get("channels/#{channel_uid}/users").to_return(:body => fixture("channel_users_response.json"))
19
+ users = Trubl::Client.new.retrieve_channel_users(channel_uid)
20
+ expect(users).to be_a Trubl::Users
21
+ #expect(users.pagination).to be_a Trubl::Pagination
22
+ users.each do |u|
23
+ expect(u).to be_a Trubl::User
24
+ end
25
+ api_get_request("channels/#{channel_uid}/users").should have_been_made
26
+ end
27
+
28
+ it '.retrieve_channel_touts parses channel touts correctly' do
29
+ stub_api_get("channels/#{channel_uid}/touts").to_return(:body => fixture("channel_touts_response.json"))
30
+ touts = Trubl::Client.new.retrieve_channel_touts(channel_uid)
31
+ expect(touts).to be_a Trubl::Touts
32
+ #expect(touts.pagination).to be_a Trubl::Pagination
33
+ touts.each do |u|
34
+ expect(u).to be_a Trubl::Tout
35
+ end
36
+ api_get_request("channels/#{channel_uid}/touts").should have_been_made
37
+ end
38
+
39
+ end
@@ -0,0 +1,38 @@
1
+ require_relative '../../spec_helper'
2
+ require 'trubl/client'
3
+ require 'webmock'
4
+
5
+ describe Trubl::API::Conversation do
6
+
7
+ it '.retrieve_conversation parses a conversation response correctly' do
8
+ stub_get("https://api.tout.com/api/v1/conversations/iummti53").to_return(:body => fixture("conversation_response.json"))
9
+ conversation = Trubl::Client.new.retrieve_conversation("iummti53")
10
+ expect(conversation).to be_a Trubl::Conversation
11
+ p conversation
12
+ expect(conversation.uid).to eq("iummti53")
13
+ some_request(:get, "/api/v1/conversations/iummti53").should have_been_made
14
+ end
15
+
16
+ it '.retrieve_conversation_participants parses conversation participants correctly' do
17
+ stub_get("https://api.tout.com/api/v1/conversations/iummti53/authors").to_return(:body => fixture("conversation_authors_response.json"))
18
+ users = Trubl::Client.new.retrieve_conversation_participants("iummti53")
19
+ expect(users).to be_a Trubl::Users
20
+ #expect(users.pagination).to be_a Trubl::Pagination
21
+ users.each do |u|
22
+ expect(u).to be_a Trubl::User
23
+ end
24
+ some_request(:get, "/api/v1/conversations/iummti53/authors").should have_been_made
25
+ end
26
+
27
+ it '.retrieve_conversation_touts parses conversation touts correctly' do
28
+ stub_get("https://api.tout.com/api/v1/conversations/iummti53/touts").to_return(:body => fixture("conversation_touts_response.json"))
29
+ touts = Trubl::Client.new.retrieve_conversation_touts("iummti53")
30
+ expect(touts).to be_a Trubl::Touts
31
+ #expect(touts.pagination).to be_a Trubl::Pagination
32
+ touts.each do |u|
33
+ expect(u).to be_a Trubl::Tout
34
+ end
35
+ some_request(:get, "/api/v1/conversations/iummti53/touts").should have_been_made
36
+ end
37
+
38
+ end