gun_broker 1.2.0 → 1.2.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: 35088d1521500d853c13b13d7e54afde855e103d
4
- data.tar.gz: fc53414ee8fd9799d8f28e51e0fcc5cb63c45948
3
+ metadata.gz: 594d61c845151e8b420555245091fd08320d2da9
4
+ data.tar.gz: 533ff44282f602ed59255bb4fd3a0262d6c562b3
5
5
  SHA512:
6
- metadata.gz: 4190c49fd7a4da4bfdaff0a0a091c455a8b3863d941afc2dfd146d049927386df8ec57944305e9a7b5628e7d8b4288849cac1ed439611e16efc36845b3923636
7
- data.tar.gz: 3e7e5427e40f43a13bc2a839b4587424e864998a5f39d03bc0a40b2c2369e342d359ac09025d7e1a070baca741ed807c0f86d56f5cc899f26563eeb2e204dbd1
6
+ metadata.gz: dcf4143c53ede55533dadfe48ade5c7bb4ffda5d205269878f9ed9145deab9e8d4a7a0b41eadc8909a746e93c64e929913377a2f76b1dec82391c0546fb4a854
7
+ data.tar.gz: f593f7546e4732dbd5c345c40e9e27ce8b3b6c29307bb5b017ae265fc0bfa6a3cf06cdc45cab9f4a4359e15f1e0259d62422442f600988c8146647ddad8377a2
@@ -22,7 +22,7 @@ module GunBroker
22
22
  endpoint = :Items
23
23
  params = { 'SellerName' => @user.username }
24
24
 
25
- fetch_items(endpoint, params)
25
+ @all ||= fetch_items(endpoint, params)
26
26
  end
27
27
 
28
28
  # Returns all the items the User has bid on.
@@ -32,7 +32,7 @@ module GunBroker
32
32
  def bid_on
33
33
  endpoint = :ItemsBidOn
34
34
 
35
- fetch_items(endpoint)
35
+ @bid_on ||= fetch_items(endpoint)
36
36
  end
37
37
 
38
38
  # Sends a multipart/form-data POST request to create an Item with the given `attributes`.
@@ -58,9 +58,7 @@ module GunBroker
58
58
  # @return [Item] Returns the Item or `nil` if no Item found.
59
59
  def find(item_id)
60
60
  # HACK: This has to filter through `#all`, since the GunBroker API currently has no way to scope the `/Items/{itemID}` endpoint by user.
61
- @all ||= all
62
-
63
- if @all.select { |item| item.id.to_s == item_id.to_s }.first
61
+ if all.select { |item| item.id.to_s == item_id.to_s }.first
64
62
  GunBroker::Item.find(item_id)
65
63
  else
66
64
  nil
@@ -84,7 +82,7 @@ module GunBroker
84
82
  def not_won
85
83
  endpoint = :ItemsNotWon
86
84
 
87
- fetch_items(endpoint)
85
+ @not_won ||= fetch_items(endpoint)
88
86
  end
89
87
 
90
88
  # Returns Items that are currently selling.
@@ -100,7 +98,7 @@ module GunBroker
100
98
  'SellerName' => @user.username,
101
99
  }.delete_if { |k, v| v.nil? }
102
100
 
103
- fetch_items(endpoint, params)
101
+ @selling ||= fetch_items(endpoint, params)
104
102
  end
105
103
 
106
104
  # Items the User has sold.
@@ -114,7 +112,7 @@ module GunBroker
114
112
  'ItemID' => (options[:item_id] || options["ItemID"])
115
113
  }.delete_if { |k, v| v.nil? }
116
114
 
117
- fetch_items(endpoint, params)
115
+ @sold ||= fetch_items(endpoint, params)
118
116
  end
119
117
 
120
118
  # Items that were listed, but not sold.
@@ -127,7 +125,7 @@ module GunBroker
127
125
  'ItemID' => (options[:item_id] || options["ItemID"])
128
126
  }.delete_if { |k, v| v.nil? }
129
127
 
130
- fetch_items(endpoint, params)
128
+ @unsold ||= fetch_items(endpoint, params)
131
129
  end
132
130
 
133
131
  # Updates an {Item} with the given attributes.
@@ -157,7 +155,7 @@ module GunBroker
157
155
  def won
158
156
  endpoint = :ItemsWon
159
157
 
160
- fetch_items(endpoint)
158
+ @won ||= fetch_items(endpoint)
161
159
  end
162
160
 
163
161
  private
@@ -83,7 +83,7 @@ module GunBroker
83
83
  # See the {ItemsDelegate} docs.
84
84
  # @return [ItemsDelegate]
85
85
  def items
86
- ItemsDelegate.new(self)
86
+ @items_delegate ||= ItemsDelegate.new(self)
87
87
  end
88
88
 
89
89
  private
@@ -1,3 +1,3 @@
1
1
  module GunBroker
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gun_broker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Campbell