twitter 5.6.0 → 5.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +8 -0
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/lib/twitter/base.rb +0 -8
- data/lib/twitter/client.rb +2 -1
- data/lib/twitter/cursor.rb +2 -15
- data/lib/twitter/error.rb +90 -18
- data/lib/twitter/geo_results.rb +0 -10
- data/lib/twitter/request.rb +4 -4
- data/lib/twitter/rest/api.rb +43 -0
- data/lib/twitter/rest/client.rb +10 -44
- data/lib/twitter/rest/direct_messages.rb +138 -0
- data/lib/twitter/rest/favorites.rb +108 -0
- data/lib/twitter/rest/friends_and_followers.rb +281 -0
- data/lib/twitter/rest/help.rb +56 -0
- data/lib/twitter/rest/lists.rb +497 -0
- data/lib/twitter/rest/oauth.rb +65 -0
- data/lib/twitter/rest/places_and_geo.rb +84 -0
- data/lib/twitter/rest/request/multipart_with_file.rb +5 -5
- data/lib/twitter/rest/response/parse_json.rb +2 -4
- data/lib/twitter/rest/response/raise_error.rb +24 -15
- data/lib/twitter/rest/saved_searches.rb +93 -0
- data/lib/twitter/rest/search.rb +37 -0
- data/lib/twitter/rest/spam_reporting.rb +27 -0
- data/lib/twitter/rest/suggested_users.rb +49 -0
- data/lib/twitter/rest/timelines.rb +200 -0
- data/lib/twitter/rest/trends.rb +57 -0
- data/lib/twitter/rest/tweets.rb +309 -0
- data/lib/twitter/rest/undocumented.rb +49 -0
- data/lib/twitter/rest/users.rb +383 -0
- data/lib/twitter/rest/utils.rb +205 -0
- data/lib/twitter/search_results.rb +2 -13
- data/lib/twitter/trend_results.rb +0 -10
- data/lib/twitter/version.rb +1 -1
- data/spec/helper.rb +1 -1
- data/spec/twitter/error_spec.rb +26 -42
- data/spec/twitter/rest/{api/direct_messages_spec.rb → direct_messages_spec.rb} +1 -1
- data/spec/twitter/rest/{api/favorites_spec.rb → favorites_spec.rb} +1 -1
- data/spec/twitter/rest/{api/friends_and_followers_spec.rb → friends_and_followers_spec.rb} +1 -1
- data/spec/twitter/rest/{api/geo_spec.rb → geo_spec.rb} +1 -1
- data/spec/twitter/rest/{api/help_spec.rb → help_spec.rb} +1 -1
- data/spec/twitter/rest/{api/lists_spec.rb → lists_spec.rb} +1 -1
- data/spec/twitter/rest/{api/oauth_spec.rb → oauth_spec.rb} +4 -8
- data/spec/twitter/rest/{api/saved_searches_spec.rb → saved_searches_spec.rb} +1 -1
- data/spec/twitter/rest/{api/search_spec.rb → search_spec.rb} +1 -1
- data/spec/twitter/rest/{api/spam_reporting_spec.rb → spam_reporting_spec.rb} +1 -1
- data/spec/twitter/rest/{api/suggested_users_spec.rb → suggested_users_spec.rb} +1 -1
- data/spec/twitter/rest/{api/timelines_spec.rb → timelines_spec.rb} +1 -1
- data/spec/twitter/rest/{api/trends_spec.rb → trends_spec.rb} +1 -1
- data/spec/twitter/rest/{api/tweets_spec.rb → tweets_spec.rb} +74 -5
- data/spec/twitter/rest/{api/undocumented_spec.rb → undocumented_spec.rb} +1 -1
- data/spec/twitter/rest/{api/users_spec.rb → users_spec.rb} +5 -5
- data/spec/twitter/tweet_spec.rb +1 -1
- data/twitter.gemspec +0 -1
- metadata +247 -237
- metadata.gz.sig +0 -0
- checksums.yaml +0 -7
- checksums.yaml.gz.sig +0 -0
- data/lib/twitter/error/already_favorited.rb +0 -10
- data/lib/twitter/error/already_posted.rb +0 -10
- data/lib/twitter/error/already_retweeted.rb +0 -10
- data/lib/twitter/error/bad_gateway.rb +0 -10
- data/lib/twitter/error/bad_request.rb +0 -10
- data/lib/twitter/error/configuration_error.rb +0 -8
- data/lib/twitter/error/forbidden.rb +0 -10
- data/lib/twitter/error/gateway_timeout.rb +0 -10
- data/lib/twitter/error/internal_server_error.rb +0 -10
- data/lib/twitter/error/not_acceptable.rb +0 -10
- data/lib/twitter/error/not_found.rb +0 -10
- data/lib/twitter/error/request_timeout.rb +0 -10
- data/lib/twitter/error/service_unavailable.rb +0 -10
- data/lib/twitter/error/too_many_requests.rb +0 -12
- data/lib/twitter/error/unauthorized.rb +0 -10
- data/lib/twitter/error/unprocessable_entity.rb +0 -10
- data/lib/twitter/rest/api/direct_messages.rb +0 -140
- data/lib/twitter/rest/api/favorites.rb +0 -115
- data/lib/twitter/rest/api/friends_and_followers.rb +0 -284
- data/lib/twitter/rest/api/help.rb +0 -58
- data/lib/twitter/rest/api/lists.rb +0 -500
- data/lib/twitter/rest/api/oauth.rb +0 -67
- data/lib/twitter/rest/api/places_and_geo.rb +0 -86
- data/lib/twitter/rest/api/saved_searches.rb +0 -95
- data/lib/twitter/rest/api/search.rb +0 -39
- data/lib/twitter/rest/api/spam_reporting.rb +0 -29
- data/lib/twitter/rest/api/suggested_users.rb +0 -51
- data/lib/twitter/rest/api/timelines.rb +0 -202
- data/lib/twitter/rest/api/trends.rb +0 -58
- data/lib/twitter/rest/api/tweets.rb +0 -297
- data/lib/twitter/rest/api/undocumented.rb +0 -51
- data/lib/twitter/rest/api/users.rb +0 -383
- data/lib/twitter/rest/api/utils.rb +0 -212
@@ -0,0 +1,205 @@
|
|
1
|
+
require 'addressable/uri'
|
2
|
+
require 'twitter/arguments'
|
3
|
+
require 'twitter/request'
|
4
|
+
require 'twitter/user'
|
5
|
+
require 'twitter/utils'
|
6
|
+
|
7
|
+
module Twitter
|
8
|
+
module REST
|
9
|
+
module Utils
|
10
|
+
include Twitter::Utils
|
11
|
+
URI_SUBSTRING = '://'
|
12
|
+
DEFAULT_CURSOR = -1
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
# Take a URI string or Twitter::Identity object and return its ID
|
17
|
+
#
|
18
|
+
# @param object [Integer, String, URI, Twitter::Identity] An ID, URI, or object.
|
19
|
+
# @return [Integer]
|
20
|
+
def extract_id(object)
|
21
|
+
case object
|
22
|
+
when ::Integer
|
23
|
+
object
|
24
|
+
when ::String
|
25
|
+
object.split('/').last.to_i
|
26
|
+
when URI
|
27
|
+
object.path.split('/').last.to_i
|
28
|
+
when Twitter::Identity
|
29
|
+
object.id
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# @param request_method [Symbol]
|
34
|
+
# @param path [String]
|
35
|
+
# @param options [Hash]
|
36
|
+
# @param klass [Class]
|
37
|
+
def perform_with_object(request_method, path, options, klass)
|
38
|
+
request = Twitter::Request.new(self, request_method, path, options)
|
39
|
+
request.perform_with_object(klass)
|
40
|
+
end
|
41
|
+
|
42
|
+
# @param request_method [Symbol]
|
43
|
+
# @param path [String]
|
44
|
+
# @param options [Hash]
|
45
|
+
# @param klass [Class]
|
46
|
+
def perform_with_objects(request_method, path, options, klass)
|
47
|
+
request = Twitter::Request.new(self, request_method, path, options)
|
48
|
+
request.perform_with_objects(klass)
|
49
|
+
end
|
50
|
+
|
51
|
+
# @param request_method [Symbol]
|
52
|
+
# @param path [String]
|
53
|
+
# @param options [Hash]
|
54
|
+
# @param klass [Class]
|
55
|
+
def perform_with_cursor(request_method, path, options, collection_name, klass = nil) # rubocop:disable ParameterLists
|
56
|
+
merge_default_cursor!(options)
|
57
|
+
request = Twitter::Request.new(self, request_method, path, options)
|
58
|
+
request.perform_with_cursor(collection_name.to_sym, klass)
|
59
|
+
end
|
60
|
+
|
61
|
+
# @param request_method [Symbol]
|
62
|
+
# @param path [String]
|
63
|
+
# @param args [Array]
|
64
|
+
# @return [Array<Twitter::User>]
|
65
|
+
def parallel_user_objects_from_response(request_method, path, args)
|
66
|
+
arguments = Twitter::Arguments.new(args)
|
67
|
+
parallel_map(arguments) do |user|
|
68
|
+
perform_with_object(request_method, path, merge_user(arguments.options, user), Twitter::User)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# @param request_method [Symbol]
|
73
|
+
# @param path [String]
|
74
|
+
# @param args [Array]
|
75
|
+
# @return [Array<Twitter::User>]
|
76
|
+
def user_objects_from_response(request_method, path, args)
|
77
|
+
arguments = Twitter::Arguments.new(args)
|
78
|
+
merge_user!(arguments.options, arguments.pop || screen_name) unless arguments.options[:user_id] || arguments.options[:screen_name]
|
79
|
+
perform_with_objects(request_method, path, arguments.options, Twitter::User)
|
80
|
+
end
|
81
|
+
|
82
|
+
# @param klass [Class]
|
83
|
+
# @param request_method [Symbol]
|
84
|
+
# @param path [String]
|
85
|
+
# @param args [Array]
|
86
|
+
# @return [Array]
|
87
|
+
def objects_from_response_with_user(klass, request_method, path, args)
|
88
|
+
arguments = Twitter::Arguments.new(args)
|
89
|
+
merge_user!(arguments.options, arguments.pop)
|
90
|
+
perform_with_objects(request_method, path, arguments.options, klass)
|
91
|
+
end
|
92
|
+
|
93
|
+
# @param klass [Class]
|
94
|
+
# @param request_method [Symbol]
|
95
|
+
# @param path [String]
|
96
|
+
# @param args [Array]
|
97
|
+
# @return [Array]
|
98
|
+
def parallel_objects_from_response(klass, request_method, path, args)
|
99
|
+
arguments = Twitter::Arguments.new(args)
|
100
|
+
parallel_map(arguments) do |object|
|
101
|
+
perform_with_object(request_method, path, arguments.options.merge(:id => extract_id(object)), klass)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# @param collection_name [Symbol]
|
106
|
+
# @param klass [Class]
|
107
|
+
# @param request_method [Symbol]
|
108
|
+
# @param path [String]
|
109
|
+
# @param args [Array]
|
110
|
+
# @return [Twitter::Cursor]
|
111
|
+
def cursor_from_response_with_user(collection_name, klass, request_method, path, args) # rubocop:disable ParameterLists
|
112
|
+
arguments = Twitter::Arguments.new(args)
|
113
|
+
merge_user!(arguments.options, arguments.pop || screen_name) unless arguments.options[:user_id] || arguments.options[:screen_name]
|
114
|
+
perform_with_cursor(request_method, path, arguments.options, collection_name, klass)
|
115
|
+
end
|
116
|
+
|
117
|
+
def screen_name
|
118
|
+
@screen_name ||= verify_credentials.screen_name
|
119
|
+
end
|
120
|
+
|
121
|
+
def merge_default_cursor!(options)
|
122
|
+
options[:cursor] = DEFAULT_CURSOR unless options[:cursor]
|
123
|
+
end
|
124
|
+
|
125
|
+
# Take a user and merge it into the hash with the correct key
|
126
|
+
#
|
127
|
+
# @param hash [Hash]
|
128
|
+
# @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
129
|
+
# @return [Hash]
|
130
|
+
def merge_user(hash, user, prefix = nil)
|
131
|
+
merge_user!(hash.dup, user, prefix)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Take a user and merge it into the hash with the correct key
|
135
|
+
#
|
136
|
+
# @param hash [Hash]
|
137
|
+
# @param user [Integer, String, URI, Twitter::User] A Twitter user ID, screen name, URI, or object.
|
138
|
+
# @return [Hash]
|
139
|
+
def merge_user!(hash, user, prefix = nil)
|
140
|
+
case user
|
141
|
+
when Integer
|
142
|
+
set_compound_key('user_id', user, hash, prefix)
|
143
|
+
when String
|
144
|
+
if user[URI_SUBSTRING]
|
145
|
+
set_compound_key('screen_name', user.split('/').last, hash, prefix)
|
146
|
+
else
|
147
|
+
set_compound_key('screen_name', user, hash, prefix)
|
148
|
+
end
|
149
|
+
when URI, Addressable::URI
|
150
|
+
set_compound_key('screen_name', user.path.split('/').last, hash, prefix)
|
151
|
+
when Twitter::User
|
152
|
+
set_compound_key('user_id', user.id, hash, prefix)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def set_compound_key(key, value, hash, prefix = nil)
|
157
|
+
compound_key = [prefix, key].compact.join('_').to_sym
|
158
|
+
hash[compound_key] = value
|
159
|
+
hash
|
160
|
+
end
|
161
|
+
|
162
|
+
# Take a multiple users and merge them into the hash with the correct keys
|
163
|
+
#
|
164
|
+
# @param hash [Hash]
|
165
|
+
# @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen_names, or objects.
|
166
|
+
# @return [Hash]
|
167
|
+
def merge_users(hash, users)
|
168
|
+
merge_users!(hash.dup, users)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Take a multiple users and merge them into the hash with the correct keys
|
172
|
+
#
|
173
|
+
# @param hash [Hash]
|
174
|
+
# @param users [Enumerable<Integer, String, URI, Twitter::User>] A collection of Twitter user IDs, screen_names, URIs, or objects.
|
175
|
+
# @return [Hash]
|
176
|
+
def merge_users!(hash, users)
|
177
|
+
user_ids, screen_names = collect_user_ids_and_screen_names(users)
|
178
|
+
hash[:user_id] = user_ids.join(',') unless user_ids.empty?
|
179
|
+
hash[:screen_name] = screen_names.join(',') unless screen_names.empty?
|
180
|
+
hash
|
181
|
+
end
|
182
|
+
|
183
|
+
def collect_user_ids_and_screen_names(users) # rubocop:disable MethodLength
|
184
|
+
user_ids, screen_names = [], []
|
185
|
+
users.flatten.each do |user|
|
186
|
+
case user
|
187
|
+
when Integer
|
188
|
+
user_ids << user
|
189
|
+
when String
|
190
|
+
if user[URI_SUBSTRING]
|
191
|
+
screen_names << user.split('/').last
|
192
|
+
else
|
193
|
+
screen_names << user
|
194
|
+
end
|
195
|
+
when URI
|
196
|
+
screen_names << user.path.split('/').last
|
197
|
+
when Twitter::User
|
198
|
+
user_ids << user.id
|
199
|
+
end
|
200
|
+
end
|
201
|
+
[user_ids, screen_names]
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -12,17 +12,6 @@ module Twitter
|
|
12
12
|
deprecate_alias :to_hash, :to_h
|
13
13
|
deprecate_alias :to_hsh, :to_h
|
14
14
|
|
15
|
-
class << self
|
16
|
-
# Construct a new SearchResults object from a response hash
|
17
|
-
#
|
18
|
-
# @param response [Hash]
|
19
|
-
# @param request [Twitter::Request]
|
20
|
-
# @return [Twitter::SearchResults]
|
21
|
-
def from_response(response, request)
|
22
|
-
new(response[:body], request)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
15
|
# Initializes a new SearchResults object
|
27
16
|
#
|
28
17
|
# @param attrs [Hash]
|
@@ -61,8 +50,8 @@ module Twitter
|
|
61
50
|
|
62
51
|
# @return [Hash]
|
63
52
|
def fetch_next_page
|
64
|
-
response = @client.send(@request_method, @path, next_page)
|
65
|
-
self.attrs = response
|
53
|
+
response = @client.send(@request_method, @path, next_page).body
|
54
|
+
self.attrs = response
|
66
55
|
end
|
67
56
|
|
68
57
|
# @param attrs [Hash]
|
@@ -15,16 +15,6 @@ module Twitter
|
|
15
15
|
deprecate_alias :to_hash, :to_h
|
16
16
|
deprecate_alias :to_hsh, :to_h
|
17
17
|
|
18
|
-
class << self
|
19
|
-
# Construct a new TrendResults object from a response hash
|
20
|
-
#
|
21
|
-
# @param response [Hash]
|
22
|
-
# @return [Twitter::Base]
|
23
|
-
def from_response(response = {})
|
24
|
-
new(response[:body].first)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
18
|
# Initializes a new TrendResults object
|
29
19
|
#
|
30
20
|
# @param attrs [Hash]
|
data/lib/twitter/version.rb
CHANGED
data/spec/helper.rb
CHANGED
data/spec/twitter/error_spec.rb
CHANGED
@@ -6,63 +6,47 @@ describe Twitter::Error do
|
|
6
6
|
@client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
|
7
7
|
end
|
8
8
|
|
9
|
+
describe '#code' do
|
10
|
+
it 'returns the error code' do
|
11
|
+
error = Twitter::Error.new('execution expired', {}, 123)
|
12
|
+
expect(error.code).to eq(123)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
9
16
|
describe '#message' do
|
10
|
-
it 'returns the message
|
11
|
-
error = Twitter::Error.new(
|
12
|
-
expect(error.message).to eq('
|
17
|
+
it 'returns the error message' do
|
18
|
+
error = Twitter::Error.new('execution expired')
|
19
|
+
expect(error.message).to eq('execution expired')
|
13
20
|
end
|
14
21
|
end
|
15
22
|
|
16
23
|
describe '#rate_limit' do
|
17
|
-
it 'returns
|
18
|
-
error = Twitter::Error.new(
|
24
|
+
it 'returns a rate limit object' do
|
25
|
+
error = Twitter::Error.new('execution expired')
|
19
26
|
expect(error.rate_limit).to be_a Twitter::RateLimit
|
20
27
|
end
|
21
28
|
end
|
22
29
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
30
|
+
[nil, 'error', 'errors'].each do |key|
|
31
|
+
context "when JSON body contains #{key.inspect}" do
|
32
|
+
before do
|
33
|
+
body = "{\"#{key}\":\"Internal Server Error\"}" unless body.nil?
|
34
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'}).to_return(:status => 500, :body => body)
|
35
|
+
end
|
36
|
+
it 'raises an exception with the proper message' do
|
37
|
+
expect { @client.user_timeline('sferik') }.to raise_error(Twitter::Error::InternalServerError)
|
38
|
+
end
|
27
39
|
end
|
28
40
|
end
|
29
41
|
|
30
42
|
Twitter::Error.errors.each do |status, exception|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
before do
|
35
|
-
body_message = '{"' + body + '":"Client Error"}' unless body.nil?
|
36
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'}).to_return(:status => status, :body => body_message)
|
37
|
-
end
|
38
|
-
it "raises #{exception.name}" do
|
39
|
-
expect { @client.user_timeline('sferik') }.to raise_error(exception)
|
40
|
-
end
|
43
|
+
context "when HTTP status is #{status}" do
|
44
|
+
before do
|
45
|
+
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'}).to_return(:status => status, :body => '{}')
|
41
46
|
end
|
42
|
-
|
43
|
-
|
44
|
-
context "when HTTP status is #{status} and body is errors" do
|
45
|
-
context 'when errors is an array of hashes' do
|
46
|
-
context 'when error code is nil' do
|
47
|
-
before do
|
48
|
-
body_message = '{"errors":[{"message":"Client Error"}]}'
|
49
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'}).to_return(:status => status, :body => body_message)
|
50
|
-
end
|
51
|
-
it "raises #{exception.name}" do
|
52
|
-
expect { @client.user_timeline('sferik') }.to raise_error { |error| expect(error.code).to be_nil }
|
53
|
-
end
|
54
|
-
context 'when error code is 187' do
|
55
|
-
before do
|
56
|
-
body_message = '{"errors":[{"message":"Client Error","code":187}]}'
|
57
|
-
stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik'}).to_return(:status => status, :body => body_message)
|
58
|
-
end
|
59
|
-
it "raises #{exception.name}" do
|
60
|
-
expect { @client.user_timeline('sferik') }.to raise_error { |error| expect(error.code).to eq(187) }
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
47
|
+
it "raises #{exception}" do
|
48
|
+
expect { @client.user_timeline('sferik') }.to raise_error(exception)
|
64
49
|
end
|
65
50
|
end
|
66
|
-
|
67
51
|
end
|
68
52
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
describe Twitter::REST::
|
3
|
+
describe Twitter::REST::FriendsAndFollowers do
|
4
4
|
|
5
5
|
before do
|
6
6
|
@client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS', :access_token => 'AT', :access_token_secret => 'AS')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
|
-
describe Twitter::REST::
|
3
|
+
describe Twitter::REST::OAuth do
|
4
4
|
|
5
5
|
before do
|
6
6
|
@client = Twitter::REST::Client.new(:consumer_key => 'CK', :consumer_secret => 'CS')
|
@@ -8,17 +8,13 @@ describe Twitter::REST::API::OAuth do
|
|
8
8
|
|
9
9
|
describe '#token' do
|
10
10
|
before do
|
11
|
-
#
|
11
|
+
# Faraday treats Basic Auth differently so we have to use the full URL with credentials
|
12
12
|
@oauth2_token_url = 'https://CK:CS@api.twitter.com/oauth2/token'
|
13
|
-
stub_request(:post, @oauth2_token_url).with(:body => 'grant_type
|
13
|
+
stub_request(:post, @oauth2_token_url).with(:body => {'grant_type' => 'client_credentials'}).to_return(:body => fixture('bearer_token.json'), :headers => {:content_type => 'application/json; charset=utf-8'})
|
14
14
|
end
|
15
15
|
it 'requests the correct resource' do
|
16
16
|
@client.token
|
17
|
-
expect(a_request(:post, @oauth2_token_url).with(:body => {:grant_type => 'client_credentials'})).to have_been_made
|
18
|
-
end
|
19
|
-
it 'requests with the correct headers' do
|
20
|
-
@client.token
|
21
|
-
expect(a_request(:post, @oauth2_token_url).with(:headers => {:content_type => 'application/x-www-form-urlencoded; charset=UTF-8', :accept => '*/*'})).to have_been_made
|
17
|
+
expect(a_request(:post, @oauth2_token_url).with(:body => {:grant_type => 'client_credentials'}, :headers => {:content_type => 'application/x-www-form-urlencoded; charset=UTF-8', :accept => '*/*'})).to have_been_made
|
22
18
|
end
|
23
19
|
it 'returns the bearer token' do
|
24
20
|
bearer_token = @client.token
|