gun_broker 1.1.2 → 1.1.3.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: bdbc225a8faddca613c61a1d81598020abdefc19
4
- data.tar.gz: 0e9c07e0fc088cc3f4e95cc515a04737a26137f3
3
+ metadata.gz: ef5c51c9081d64a792ac5f6dc071c1c88d3ee28a
4
+ data.tar.gz: 786b854259925ba6a6e693e7bee046d7cf03376f
5
5
  SHA512:
6
- metadata.gz: 7498760b3f7632994a5dad9c440ee5bfba466c60f02d31654ca9aab516d918f97b61b637510b6fc11ee012117af3d54835c442e164e5da6c409aad5fc6c0c4cd
7
- data.tar.gz: 01e9a3660f396d7abb92e5765bcdac2fc8aa05adcde0f2109c2968a207f05dee0a81fa43247fe3dea1f41ba753850df1ab7eb0054fbf155a0e6e12d07d796fba
6
+ metadata.gz: 448d71ea7efba60b16b415e5b127be6bff511bf19cf6c6180cb05f6082708c3c5a6febcc0191dd7c134facfd64f67932912f41d2a805daa103ef7597626c3133
7
+ data.tar.gz: 0424e6adac3448fa85139142ceb793d23e00eca85d8669cac166da344932cac7a4c119bd298dbb79059bbe78f2a167454a9fb09c4e3212d64429b571d40f1381
@@ -15,6 +15,8 @@ module GunBroker
15
15
  # Used to return the maximum number of results from paginated responses.
16
16
  PAGE_SIZE = 300
17
17
 
18
+ USER_AGENT = "gun_broker rubygems.org/gems/gun_broker v(#{GunBroker::VERSION})"
19
+
18
20
  # @param path [String] The requested API endpoint.
19
21
  # @param params [Hash] (optional) URL params for GET requests; form params for POST request.
20
22
  # @param headers [Hash] (optional) Additional headers sent with the request.
@@ -120,7 +122,8 @@ module GunBroker
120
122
 
121
123
  def get_response(request)
122
124
  request['Content-Type'] = 'application/json'
123
- request['X-DevKey'] = GunBroker.dev_key
125
+ request['X-DevKey'] = GunBroker.dev_key
126
+ request["User-Agent"] = USER_AGENT
124
127
 
125
128
  @headers.each { |header, value| request[header] = value }
126
129
 
@@ -60,7 +60,9 @@ module GunBroker
60
60
  # @return [Item] Returns the Item or `nil` if no Item found.
61
61
  def find(item_id)
62
62
  # HACK: This has to filter through `#all`, since the GunBroker API currently has no way to scope the `/Items/{itemID}` endpoint by user.
63
- if all.select { |item| item.id.to_s == item_id.to_s }.first
63
+ @all ||= all
64
+
65
+ if @all.select { |item| item.id.to_s == item_id.to_s }.first
64
66
  GunBroker::Item.find(item_id)
65
67
  else
66
68
  nil
@@ -1,3 +1,3 @@
1
1
  module GunBroker
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3.1"
3
3
  end
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: 1.1.2
4
+ version: 1.1.3.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: 2016-09-08 00:00:00.000000000 Z
11
+ date: 2017-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -220,4 +220,3 @@ test_files:
220
220
  - spec/support/fixtures.rb
221
221
  - spec/support/headers.rb
222
222
  - spec/support/request.rb
223
- has_rdoc: