instagram-continued-continued 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.hound.yml +2 -0
- data/.rspec +3 -0
- data/.rubocop.yml +15 -0
- data/.travis.yml +20 -0
- data/.yardopts +9 -0
- data/Gemfile +3 -0
- data/LICENSE.md +30 -0
- data/PATENTS.md +23 -0
- data/README.md +15 -0
- data/Rakefile +23 -0
- data/instagram-continued-continued.gemspec +34 -0
- data/lib/faraday/loud_logger.rb +74 -0
- data/lib/faraday/oauth2.rb +40 -0
- data/lib/faraday/raise_http_exception.rb +61 -0
- data/lib/instagram.rb +28 -0
- data/lib/instagram/api.rb +31 -0
- data/lib/instagram/client.rb +21 -0
- data/lib/instagram/client/comments.rb +62 -0
- data/lib/instagram/client/embedding.rb +28 -0
- data/lib/instagram/client/geographies.rb +29 -0
- data/lib/instagram/client/likes.rb +58 -0
- data/lib/instagram/client/locations.rb +75 -0
- data/lib/instagram/client/media.rb +82 -0
- data/lib/instagram/client/subscriptions.rb +211 -0
- data/lib/instagram/client/tags.rb +59 -0
- data/lib/instagram/client/users.rb +310 -0
- data/lib/instagram/client/utils.rb +28 -0
- data/lib/instagram/configuration.rb +123 -0
- data/lib/instagram/connection.rb +33 -0
- data/lib/instagram/error.rb +34 -0
- data/lib/instagram/hashie_wrapper.rb +8 -0
- data/lib/instagram/oauth.rb +36 -0
- data/lib/instagram/request.rb +79 -0
- data/lib/instagram/response.rb +27 -0
- data/lib/instagram/version.rb +3 -0
- data/spec/faraday/response_spec.rb +85 -0
- data/spec/fixtures/access_token.json +9 -0
- data/spec/fixtures/approve_user.json +8 -0
- data/spec/fixtures/block_user.json +8 -0
- data/spec/fixtures/deny_user.json +8 -0
- data/spec/fixtures/follow_user.json +8 -0
- data/spec/fixtures/followed_by.json +1 -0
- data/spec/fixtures/follows.json +1 -0
- data/spec/fixtures/geography_recent_media.json +1 -0
- data/spec/fixtures/liked_media.json +1 -0
- data/spec/fixtures/location.json +1 -0
- data/spec/fixtures/location_recent_media.json +1 -0
- data/spec/fixtures/location_search.json +1 -0
- data/spec/fixtures/location_search_facebook.json +1 -0
- data/spec/fixtures/media.json +1 -0
- data/spec/fixtures/media_comment.json +1 -0
- data/spec/fixtures/media_comment_deleted.json +1 -0
- data/spec/fixtures/media_comments.json +1 -0
- data/spec/fixtures/media_liked.json +1 -0
- data/spec/fixtures/media_likes.json +1 -0
- data/spec/fixtures/media_popular.json +1 -0
- data/spec/fixtures/media_search.json +1 -0
- data/spec/fixtures/media_shortcode.json +1 -0
- data/spec/fixtures/media_unliked.json +1 -0
- data/spec/fixtures/mikeyk.json +1 -0
- data/spec/fixtures/oembed.json +14 -0
- data/spec/fixtures/recent_media.json +1 -0
- data/spec/fixtures/relationship.json +9 -0
- data/spec/fixtures/requested_by.json +12 -0
- data/spec/fixtures/shayne.json +1 -0
- data/spec/fixtures/subscription.json +12 -0
- data/spec/fixtures/subscription_deleted.json +1 -0
- data/spec/fixtures/subscription_payload.json +14 -0
- data/spec/fixtures/subscriptions.json +22 -0
- data/spec/fixtures/tag.json +1 -0
- data/spec/fixtures/tag_recent_media.json +1 -0
- data/spec/fixtures/tag_search.json +1 -0
- data/spec/fixtures/unblock_user.json +8 -0
- data/spec/fixtures/unfollow_user.json +8 -0
- data/spec/fixtures/user_media_feed.json +1 -0
- data/spec/fixtures/user_search.json +1 -0
- data/spec/instagram/api_spec.rb +259 -0
- data/spec/instagram/client/comments_spec.rb +67 -0
- data/spec/instagram/client/embedding_spec.rb +36 -0
- data/spec/instagram/client/geography_spec.rb +34 -0
- data/spec/instagram/client/likes_spec.rb +62 -0
- data/spec/instagram/client/locations_spec.rb +121 -0
- data/spec/instagram/client/media_spec.rb +95 -0
- data/spec/instagram/client/subscriptions_spec.rb +162 -0
- data/spec/instagram/client/tags_spec.rb +75 -0
- data/spec/instagram/client/users_spec.rb +407 -0
- data/spec/instagram/client/utils_spec.rb +31 -0
- data/spec/instagram/client_spec.rb +23 -0
- data/spec/instagram/request_spec.rb +56 -0
- data/spec/instagram_spec.rb +105 -0
- data/spec/spec_helper.rb +66 -0
- metadata +293 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
require File.expand_path("../../../spec_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Instagram::Client do
|
4
|
+
Instagram::Configuration::VALID_FORMATS.each do |format|
|
5
|
+
context ".new(:format => '#{format}')" do
|
6
|
+
before do
|
7
|
+
@client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", access_token: "AT")
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".tag" do
|
11
|
+
before do
|
12
|
+
stub_get("tags/cat.#{format}")
|
13
|
+
.with(query: { access_token: @client.access_token })
|
14
|
+
.to_return(body: fixture("tag.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should get the correct resource" do
|
18
|
+
@client.tag("cat")
|
19
|
+
expect(a_get("tags/cat.#{format}")
|
20
|
+
.with(query: { access_token: @client.access_token }))
|
21
|
+
.to have_been_made
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should return extended information of a given media item" do
|
25
|
+
tag = @client.tag("cat")
|
26
|
+
expect(tag.name).to eq("cat")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe ".tag_recent_media" do
|
31
|
+
before do
|
32
|
+
stub_get("tags/cat/media/recent.#{format}")
|
33
|
+
.with(query: { access_token: @client.access_token })
|
34
|
+
.to_return(body: fixture("tag_recent_media.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should get the correct resource" do
|
38
|
+
@client.tag_recent_media("cat")
|
39
|
+
expect(a_get("tags/cat/media/recent.#{format}")
|
40
|
+
.with(query: { access_token: @client.access_token }))
|
41
|
+
.to have_been_made
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should return a list of media taken at a given location" do
|
45
|
+
media = @client.tag_recent_media("cat")
|
46
|
+
expect(media).to be_a Array
|
47
|
+
expect(media.first.user.username).to eq("amandavan")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe ".tag_search" do
|
52
|
+
before do
|
53
|
+
stub_get("tags/search.#{format}")
|
54
|
+
.with(query: { access_token: @client.access_token })
|
55
|
+
.with(query: { q: "cat" })
|
56
|
+
.to_return(body: fixture("tag_search.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should get the correct resource" do
|
60
|
+
@client.tag_search("cat")
|
61
|
+
expect(a_get("tags/search.#{format}")
|
62
|
+
.with(query: { access_token: @client.access_token })
|
63
|
+
.with(query: { q: "cat" }))
|
64
|
+
.to have_been_made
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should return an array of user search results" do
|
68
|
+
tags = @client.tag_search("cat")
|
69
|
+
expect(tags).to be_a Array
|
70
|
+
expect(tags.first.name).to eq("cats")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,407 @@
|
|
1
|
+
require File.expand_path("../../../spec_helper", __FILE__)
|
2
|
+
|
3
|
+
describe Instagram::Client do
|
4
|
+
Instagram::Configuration::VALID_FORMATS.each do |format|
|
5
|
+
context ".new(:format => '#{format}')" do
|
6
|
+
before do
|
7
|
+
@client = Instagram::Client.new(format: format, client_id: "CID", client_secret: "CS", access_token: "AT")
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".user" do
|
11
|
+
context "with user ID passed" do
|
12
|
+
before do
|
13
|
+
stub_get("users/4.#{format}")
|
14
|
+
.with(query: { access_token: @client.access_token })
|
15
|
+
.to_return(body: fixture("mikeyk.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should get the correct resource" do
|
19
|
+
@client.user(4)
|
20
|
+
expect(a_get("users/4.#{format}")
|
21
|
+
.with(query: { access_token: @client.access_token }))
|
22
|
+
.to have_been_made
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return extended information of a given user" do
|
26
|
+
user = @client.user(4)
|
27
|
+
expect(user.full_name).to eq("Mike Krieger")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "without user ID passed" do
|
32
|
+
before do
|
33
|
+
stub_get("users/self.#{format}")
|
34
|
+
.with(query: { access_token: @client.access_token })
|
35
|
+
.to_return(body: fixture("shayne.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should get the correct resource" do
|
39
|
+
@client.user
|
40
|
+
expect(a_get("users/self.#{format}")
|
41
|
+
.with(query: { access_token: @client.access_token }))
|
42
|
+
.to have_been_made
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe ".user_search" do
|
48
|
+
before do
|
49
|
+
stub_get("users/search.#{format}")
|
50
|
+
.with(query: { access_token: @client.access_token })
|
51
|
+
.with(query: { q: "Shayne Sweeney" })
|
52
|
+
.to_return(body: fixture("user_search.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should get the correct resource" do
|
56
|
+
@client.user_search("Shayne Sweeney")
|
57
|
+
expect(a_get("users/search.#{format}")
|
58
|
+
.with(query: { access_token: @client.access_token })
|
59
|
+
.with(query: { q: "Shayne Sweeney" }))
|
60
|
+
.to have_been_made
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should return an array of user search results" do
|
64
|
+
users = @client.user_search("Shayne Sweeney")
|
65
|
+
expect(users).to be_a Array
|
66
|
+
expect(users.first.username).to eq("shayne")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe ".user_follows" do
|
71
|
+
context "with user ID passed" do
|
72
|
+
before do
|
73
|
+
stub_get("users/4/follows.#{format}")
|
74
|
+
.with(query: { access_token: @client.access_token })
|
75
|
+
.to_return(body: fixture("follows.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should get the correct resource" do
|
79
|
+
@client.user_follows(4)
|
80
|
+
expect(a_get("users/4/follows.#{format}")
|
81
|
+
.with(query: { access_token: @client.access_token }))
|
82
|
+
.to have_been_made
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should return a list of users whom a given user follows" do
|
86
|
+
follows = @client.user_follows(4)
|
87
|
+
expect(follows).to be_a Array
|
88
|
+
expect(follows.first.username).to eq("heartsf")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "without user ID passed" do
|
93
|
+
before do
|
94
|
+
stub_get("users/self/follows.#{format}")
|
95
|
+
.with(query: { access_token: @client.access_token })
|
96
|
+
.to_return(body: fixture("follows.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should get the correct resource" do
|
100
|
+
@client.user_follows
|
101
|
+
expect(a_get("users/self/follows.#{format}")
|
102
|
+
.with(query: { access_token: @client.access_token }))
|
103
|
+
.to have_been_made
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
describe ".user_followed_by" do
|
109
|
+
context "with user ID passed" do
|
110
|
+
before do
|
111
|
+
stub_get("users/4/followed-by.#{format}")
|
112
|
+
.with(query: { access_token: @client.access_token })
|
113
|
+
.to_return(body: fixture("followed_by.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should get the correct resource" do
|
117
|
+
@client.user_followed_by(4)
|
118
|
+
expect(a_get("users/4/followed-by.#{format}")
|
119
|
+
.with(query: { access_token: @client.access_token }))
|
120
|
+
.to have_been_made
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should return a list of users whom a given user is followed by" do
|
124
|
+
followed_by = @client.user_followed_by(4)
|
125
|
+
expect(followed_by).to be_a Array
|
126
|
+
expect(followed_by.first.username).to eq("bojieyang")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context "without user ID passed" do
|
131
|
+
before do
|
132
|
+
stub_get("users/self/followed-by.#{format}")
|
133
|
+
.with(query: { access_token: @client.access_token })
|
134
|
+
.to_return(body: fixture("followed_by.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should get the correct resource" do
|
138
|
+
@client.user_followed_by
|
139
|
+
expect(a_get("users/self/followed-by.#{format}")
|
140
|
+
.with(query: { access_token: @client.access_token }))
|
141
|
+
.to have_been_made
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
describe ".user_media_feed" do
|
147
|
+
before do
|
148
|
+
stub_get("users/self/feed.#{format}")
|
149
|
+
.with(query: { access_token: @client.access_token })
|
150
|
+
.to_return(body: fixture("user_media_feed.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should get the correct resource" do
|
154
|
+
@client.user_media_feed
|
155
|
+
expect(a_get("users/self/feed.#{format}")
|
156
|
+
.with(query: { access_token: @client.access_token }))
|
157
|
+
.to have_been_made
|
158
|
+
end
|
159
|
+
|
160
|
+
context Instagram::Response do
|
161
|
+
let(:user_media_feed_response) { @client.user_media_feed }
|
162
|
+
subject { user_media_feed_response }
|
163
|
+
|
164
|
+
it { is_expected.to be_a_kind_of(Instagram::Response) }
|
165
|
+
it { is_expected.to respond_to(:pagination) }
|
166
|
+
it { is_expected.to respond_to(:meta) }
|
167
|
+
|
168
|
+
context ".pagination" do
|
169
|
+
subject { user_media_feed_response.pagination }
|
170
|
+
|
171
|
+
it { is_expected.to be_an_instance_of(Instagram::HashieWrapper) }
|
172
|
+
|
173
|
+
describe "#next_max_id" do
|
174
|
+
subject { super().next_max_id }
|
175
|
+
it { is_expected.to eq("22063131") }
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context ".meta" do
|
180
|
+
subject { user_media_feed_response.meta }
|
181
|
+
|
182
|
+
it { is_expected.to be_an_instance_of(Instagram::HashieWrapper) }
|
183
|
+
|
184
|
+
describe "#code" do
|
185
|
+
subject { super().code }
|
186
|
+
it { is_expected.to eq(200) }
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
describe ".user_liked_media" do
|
193
|
+
before do
|
194
|
+
stub_get("users/self/media/liked.#{format}")
|
195
|
+
.with(query: { access_token: @client.access_token })
|
196
|
+
.to_return(body: fixture("liked_media.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
197
|
+
end
|
198
|
+
|
199
|
+
it "should get the correct resource" do
|
200
|
+
@client.user_liked_media
|
201
|
+
expect(a_get("users/self/media/liked.#{format}")
|
202
|
+
.with(query: { access_token: @client.access_token }))
|
203
|
+
.to have_been_made
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
describe ".user_recent_media" do
|
208
|
+
context "with user ID passed" do
|
209
|
+
before do
|
210
|
+
stub_get("users/4/media/recent.#{format}")
|
211
|
+
.with(query: { access_token: @client.access_token })
|
212
|
+
.to_return(body: fixture("recent_media.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
213
|
+
end
|
214
|
+
|
215
|
+
it "should get the correct resource" do
|
216
|
+
@client.user_recent_media(4)
|
217
|
+
expect(a_get("users/4/media/recent.#{format}")
|
218
|
+
.with(query: { access_token: @client.access_token }))
|
219
|
+
.to have_been_made
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should return a list of recent media items for the given user" do
|
223
|
+
recent_media = @client.user_recent_media(4)
|
224
|
+
expect(recent_media).to be_a Array
|
225
|
+
expect(recent_media.first.user.username).to eq("shayne")
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
context "without user ID passed" do
|
230
|
+
before do
|
231
|
+
stub_get("users/self/media/recent.#{format}")
|
232
|
+
.with(query: { access_token: @client.access_token })
|
233
|
+
.to_return(body: fixture("recent_media.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
234
|
+
end
|
235
|
+
|
236
|
+
it "should get the correct resource" do
|
237
|
+
@client.user_recent_media
|
238
|
+
expect(a_get("users/self/media/recent.#{format}")
|
239
|
+
.with(query: { access_token: @client.access_token }))
|
240
|
+
.to have_been_made
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
describe ".user_requested_by" do
|
246
|
+
before do
|
247
|
+
stub_get("users/self/requested-by.#{format}")
|
248
|
+
.with(query: { access_token: @client.access_token })
|
249
|
+
.to_return(body: fixture("requested_by.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
250
|
+
end
|
251
|
+
|
252
|
+
it "should get the correct resource" do
|
253
|
+
@client.user_requested_by
|
254
|
+
expect(a_get("users/self/requested-by.#{format}")
|
255
|
+
.with(query: { access_token: @client.access_token }))
|
256
|
+
.to have_been_made
|
257
|
+
end
|
258
|
+
|
259
|
+
it "should return a list of users awaiting approval" do
|
260
|
+
users = @client.user_requested_by
|
261
|
+
expect(users).to be_a Array
|
262
|
+
expect(users.first.username).to eq("shayne")
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
describe ".user_relationship" do
|
267
|
+
before do
|
268
|
+
stub_get("users/4/relationship.#{format}")
|
269
|
+
.with(query: { access_token: @client.access_token })
|
270
|
+
.to_return(body: fixture("relationship.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should get the correct resource" do
|
274
|
+
@client.user_relationship(4)
|
275
|
+
expect(a_get("users/4/relationship.#{format}")
|
276
|
+
.with(query: { access_token: @client.access_token }))
|
277
|
+
.to have_been_made
|
278
|
+
end
|
279
|
+
|
280
|
+
it "should return a relationship status response" do
|
281
|
+
status = @client.user_relationship(4)
|
282
|
+
expect(status.incoming_status).to eq("requested_by")
|
283
|
+
end
|
284
|
+
end
|
285
|
+
|
286
|
+
describe ".follow_user" do
|
287
|
+
before do
|
288
|
+
stub_post("users/4/relationship.#{format}")
|
289
|
+
.with(body: { action: "follow", access_token: @client.access_token })
|
290
|
+
.to_return(body: fixture("follow_user.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
291
|
+
end
|
292
|
+
|
293
|
+
it "should get the correct resource" do
|
294
|
+
@client.follow_user(4)
|
295
|
+
expect(a_post("users/4/relationship.#{format}")
|
296
|
+
.with(body: { action: "follow", access_token: @client.access_token }))
|
297
|
+
.to have_been_made
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should return a relationship status response" do
|
301
|
+
status = @client.follow_user(4)
|
302
|
+
expect(status.outgoing_status).to eq("requested")
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
describe ".unfollow_user" do
|
307
|
+
before do
|
308
|
+
stub_post("users/4/relationship.#{format}")
|
309
|
+
.with(body: { action: "unfollow", access_token: @client.access_token })
|
310
|
+
.to_return(body: fixture("unfollow_user.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
311
|
+
end
|
312
|
+
|
313
|
+
it "should get the correct resource" do
|
314
|
+
@client.unfollow_user(4)
|
315
|
+
expect(a_post("users/4/relationship.#{format}")
|
316
|
+
.with(body: { action: "unfollow", access_token: @client.access_token }))
|
317
|
+
.to have_been_made
|
318
|
+
end
|
319
|
+
|
320
|
+
it "should return a relationship status response" do
|
321
|
+
status = @client.unfollow_user(4)
|
322
|
+
expect(status.outgoing_status).to eq("none")
|
323
|
+
end
|
324
|
+
end
|
325
|
+
|
326
|
+
describe ".block_user" do
|
327
|
+
before do
|
328
|
+
stub_post("users/4/relationship.#{format}")
|
329
|
+
.with(body: { action: "block", access_token: @client.access_token })
|
330
|
+
.to_return(body: fixture("block_user.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
331
|
+
end
|
332
|
+
|
333
|
+
it "should get the correct resource" do
|
334
|
+
@client.block_user(4)
|
335
|
+
expect(a_post("users/4/relationship.#{format}")
|
336
|
+
.with(body: { action: "block", access_token: @client.access_token }))
|
337
|
+
.to have_been_made
|
338
|
+
end
|
339
|
+
|
340
|
+
it "should return a relationship status response" do
|
341
|
+
status = @client.block_user(4)
|
342
|
+
expect(status.outgoing_status).to eq("none")
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
describe ".unblock_user" do
|
347
|
+
before do
|
348
|
+
stub_post("users/4/relationship.#{format}")
|
349
|
+
.with(body: { action: "unblock", access_token: @client.access_token })
|
350
|
+
.to_return(body: fixture("unblock_user.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
351
|
+
end
|
352
|
+
|
353
|
+
it "should get the correct resource" do
|
354
|
+
@client.unblock_user(4)
|
355
|
+
expect(a_post("users/4/relationship.#{format}")
|
356
|
+
.with(body: { action: "unblock", access_token: @client.access_token }))
|
357
|
+
.to have_been_made
|
358
|
+
end
|
359
|
+
|
360
|
+
it "should return a relationship status response" do
|
361
|
+
status = @client.unblock_user(4)
|
362
|
+
expect(status.outgoing_status).to eq("none")
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
describe ".approve_user" do
|
367
|
+
before do
|
368
|
+
stub_post("users/4/relationship.#{format}")
|
369
|
+
.with(body: { action: "approve", access_token: @client.access_token })
|
370
|
+
.to_return(body: fixture("approve_user.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
371
|
+
end
|
372
|
+
|
373
|
+
it "should get the correct resource" do
|
374
|
+
@client.approve_user(4)
|
375
|
+
expect(a_post("users/4/relationship.#{format}")
|
376
|
+
.with(body: { action: "approve", access_token: @client.access_token }))
|
377
|
+
.to have_been_made
|
378
|
+
end
|
379
|
+
|
380
|
+
it "should return a relationship status response" do
|
381
|
+
status = @client.approve_user(4)
|
382
|
+
expect(status.outgoing_status).to eq("follows")
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
describe ".deny_user" do
|
387
|
+
before do
|
388
|
+
stub_post("users/4/relationship.#{format}")
|
389
|
+
.with(body: { action: "deny", access_token: @client.access_token })
|
390
|
+
.to_return(body: fixture("deny_user.#{format}"), headers: { content_type: "application/#{format}; charset=utf-8" })
|
391
|
+
end
|
392
|
+
|
393
|
+
it "should get the correct resource" do
|
394
|
+
@client.deny_user(4)
|
395
|
+
expect(a_post("users/4/relationship.#{format}")
|
396
|
+
.with(body: { action: "deny", access_token: @client.access_token }))
|
397
|
+
.to have_been_made
|
398
|
+
end
|
399
|
+
|
400
|
+
it "should return a relationship status response" do
|
401
|
+
status = @client.deny_user(4)
|
402
|
+
expect(status.outgoing_status).to eq("none")
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|