gun_broker 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gun_broker/user.rb +9 -0
- data/lib/gun_broker/user/items_delegate.rb +1 -1
- data/lib/gun_broker/version.rb +1 -1
- data/spec/gun_broker/user_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e3c024f2f1f31e202e435ff87c8109f52f72991
|
4
|
+
data.tar.gz: 8e01bed24a4258c9559a98ba9fc56c268c3c52e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f470dd4a4c63cdcd4322d94bf1c725a786c5ac306d0d2dad4ce7c21d10fe7f2b27680a88cc309d02f926d04818e4808eca0ed9c8ad2634c221dca74ab536f52a
|
7
|
+
data.tar.gz: dc848ad1ac16d576223a4f0a249abd1aaaf931b31613ff7f68f55b8d5d571a63de840a0b768434e6569dfb32259ef9b153b161ce9973f1cf40f2e2a9af14f446
|
data/lib/gun_broker/user.rb
CHANGED
@@ -62,6 +62,15 @@ module GunBroker
|
|
62
62
|
end
|
63
63
|
alias_method :revoke_access_token!, :deauthenticate!
|
64
64
|
|
65
|
+
# Returns contact information for the given `buyer_id` (GunBroker User ID).
|
66
|
+
# The User *must* be involved in a transaction for the API method to return a response.
|
67
|
+
# @param buyer_id [Integer, String] GunBroker user ID.
|
68
|
+
# @raise (see #contact_info)
|
69
|
+
# @return (see #contact_info)
|
70
|
+
def buyer_info(buyer_id)
|
71
|
+
GunBroker::API.get('/Users/ContactInfo', { 'UserID' => buyer_id }, token_header(@token))
|
72
|
+
end
|
73
|
+
|
65
74
|
# Returns the User's contact information.
|
66
75
|
# @note {API#get! GET} /Users/ContactInfo
|
67
76
|
# @raise [GunBroker::Error::RequestError] If there's an issue with the request (usually a `5xx` response).
|
@@ -148,7 +148,7 @@ module GunBroker
|
|
148
148
|
# @return [GunBroker::Item] The updated Item instance.
|
149
149
|
def update!(item_id, attributes = {})
|
150
150
|
GunBroker::API.put("/Items/#{item_id}", attributes, token_header(@user.token))
|
151
|
-
GunBroker::Item.find(item_id)
|
151
|
+
GunBroker::Item.find!(item_id)
|
152
152
|
end
|
153
153
|
|
154
154
|
# Items the User has won.
|
data/lib/gun_broker/version.rb
CHANGED
@@ -171,6 +171,27 @@ describe GunBroker::User do
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
+
context '#buyer_info' do
|
175
|
+
let(:endpoint) { [GunBroker::API::ROOT_URL, '/Users/ContactInfo'].join }
|
176
|
+
|
177
|
+
context 'on success' do
|
178
|
+
it 'returns a contact info hash' do
|
179
|
+
user = GunBroker::User.new(username, token: token)
|
180
|
+
buyer_id = 123
|
181
|
+
|
182
|
+
stub_request(:get, endpoint)
|
183
|
+
.with(
|
184
|
+
headers: headers('X-AccessToken' => token),
|
185
|
+
query: { 'UserID' => buyer_id }
|
186
|
+
)
|
187
|
+
.to_return(body: response_fixture('contact_info'))
|
188
|
+
|
189
|
+
buyer_info = JSON.parse(response_fixture('contact_info'))
|
190
|
+
expect(user.buyer_info(buyer_id)['email']).to eq(buyer_info['email'])
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
174
195
|
context '#contact_info' do
|
175
196
|
let(:endpoint) { [GunBroker::API::ROOT_URL, '/Users/ContactInfo'].join }
|
176
197
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gun_broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dale Campbell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|