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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9db7eb867d466c892152025e4b811a63354945c
4
- data.tar.gz: 5e90a487eb8443caff3e2beac08002fd950b24f0
3
+ metadata.gz: 7e3c024f2f1f31e202e435ff87c8109f52f72991
4
+ data.tar.gz: 8e01bed24a4258c9559a98ba9fc56c268c3c52e9
5
5
  SHA512:
6
- metadata.gz: a587cc2c0d6b2a2352343670eb42b10bba25c78e4c91f0be3b7df6656cde470b84427aab8d098c1d92651c5e39e443cb7d3234621058c5769181c86a60eb14fe
7
- data.tar.gz: 25cc8c537703970c31f29151005b61142078aa94d8edccef69da1edb9e41fdce33e1d95364a9485693cff0b51268bd9bb871eb7ab96e93e36b64877cc4fe9f73
6
+ metadata.gz: f470dd4a4c63cdcd4322d94bf1c725a786c5ac306d0d2dad4ce7c21d10fe7f2b27680a88cc309d02f926d04818e4808eca0ed9c8ad2634c221dca74ab536f52a
7
+ data.tar.gz: dc848ad1ac16d576223a4f0a249abd1aaaf931b31613ff7f68f55b8d5d571a63de840a0b768434e6569dfb32259ef9b153b161ce9973f1cf40f2e2a9af14f446
@@ -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.
@@ -1,3 +1,3 @@
1
1
  module GunBroker
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -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.0
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-03-28 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler