gun_broker 0.5.5 → 0.6.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9db7eb867d466c892152025e4b811a63354945c
|
4
|
+
data.tar.gz: 5e90a487eb8443caff3e2beac08002fd950b24f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a587cc2c0d6b2a2352343670eb42b10bba25c78e4c91f0be3b7df6656cde470b84427aab8d098c1d92651c5e39e443cb7d3234621058c5769181c86a60eb14fe
|
7
|
+
data.tar.gz: 25cc8c537703970c31f29151005b61142078aa94d8edccef69da1edb9e41fdce33e1d95364a9485693cff0b51268bd9bb871eb7ab96e93e36b64877cc4fe9f73
|
@@ -7,12 +7,19 @@ module GunBroker
|
|
7
7
|
|
8
8
|
include GunBroker::TokenHeader
|
9
9
|
|
10
|
+
# Constants to use with the `SellingStatus` param.
|
11
|
+
SELLING_STATUS = {
|
12
|
+
both: 0,
|
13
|
+
selling: 1,
|
14
|
+
not_selling: 2,
|
15
|
+
}
|
16
|
+
|
10
17
|
# @param user [User] A {User} instance to scope items by.
|
11
18
|
def initialize(user)
|
12
19
|
@user = user
|
13
20
|
end
|
14
21
|
|
15
|
-
# Returns all the User's items.
|
22
|
+
# Returns all the User's items (both selling and not selling).
|
16
23
|
# @note {API#get! GET} /Items
|
17
24
|
# @raise [GunBroker::Error::NotAuthorized] If the {User#token} isn't valid.
|
18
25
|
# @raise [GunBroker::Error::RequestError] If there's an issue with the request (usually a `5xx` response).
|
@@ -20,6 +27,7 @@ module GunBroker
|
|
20
27
|
def all
|
21
28
|
response = GunBroker::API.get('/Items', {
|
22
29
|
'SellerName' => @user.username,
|
30
|
+
'SellingStatus' => SELLING_STATUS[:both],
|
23
31
|
'PageSize' => GunBroker::API::PAGE_SIZE
|
24
32
|
}, token_header(@user.token))
|
25
33
|
items_from_results(response['results'])
|
@@ -87,6 +95,20 @@ module GunBroker
|
|
87
95
|
items_from_results(response['results'])
|
88
96
|
end
|
89
97
|
|
98
|
+
# Returns Items that are currently selling.
|
99
|
+
# @note {API#get! GET} /Items
|
100
|
+
# @raise [GunBroker::Error::NotAuthorized] If the {User#token} isn't valid.
|
101
|
+
# @raise [GunBroker::Error::RequestError] If there's an issue with the request (usually a `5xx` response).
|
102
|
+
# @return [Array<Item>]
|
103
|
+
def selling
|
104
|
+
response = GunBroker::API.get('/Items', {
|
105
|
+
'SellerName' => @user.username,
|
106
|
+
'SellingStatus' => SELLING_STATUS[:selling],
|
107
|
+
'PageSize' => GunBroker::API::PAGE_SIZE
|
108
|
+
}, token_header(@user.token))
|
109
|
+
items_from_results(response['results'])
|
110
|
+
end
|
111
|
+
|
90
112
|
# Items the User has sold.
|
91
113
|
# @note {API#get! GET} /ItemsSold
|
92
114
|
# @raise (see #all)
|
data/lib/gun_broker/version.rb
CHANGED
@@ -17,6 +17,7 @@ describe GunBroker::User::ItemsDelegate do
|
|
17
17
|
headers: headers('X-AccessToken' => token),
|
18
18
|
query: {
|
19
19
|
'SellerName' => user.username,
|
20
|
+
'SellingStatus' => GunBroker::User::ItemsDelegate::SELLING_STATUS[:both],
|
20
21
|
'PageSize' => GunBroker::API::PAGE_SIZE
|
21
22
|
}
|
22
23
|
)
|
@@ -34,6 +35,7 @@ describe GunBroker::User::ItemsDelegate do
|
|
34
35
|
headers: headers('X-AccessToken' => token),
|
35
36
|
query: {
|
36
37
|
'SellerName' => user.username,
|
38
|
+
'SellingStatus' => GunBroker::User::ItemsDelegate::SELLING_STATUS[:both],
|
37
39
|
'PageSize' => GunBroker::API::PAGE_SIZE
|
38
40
|
}
|
39
41
|
)
|
@@ -89,6 +91,7 @@ describe GunBroker::User::ItemsDelegate do
|
|
89
91
|
headers: headers('X-AccessToken' => token),
|
90
92
|
query: {
|
91
93
|
'SellerName' => user.username,
|
94
|
+
'SellingStatus' => GunBroker::User::ItemsDelegate::SELLING_STATUS[:both],
|
92
95
|
'PageSize' => GunBroker::API::PAGE_SIZE
|
93
96
|
}
|
94
97
|
)
|
@@ -110,6 +113,7 @@ describe GunBroker::User::ItemsDelegate do
|
|
110
113
|
headers: headers('X-AccessToken' => token),
|
111
114
|
query: {
|
112
115
|
'SellerName' => user.username,
|
116
|
+
'SellingStatus' => GunBroker::User::ItemsDelegate::SELLING_STATUS[:both],
|
113
117
|
'PageSize' => GunBroker::API::PAGE_SIZE
|
114
118
|
}
|
115
119
|
)
|
@@ -134,6 +138,7 @@ describe GunBroker::User::ItemsDelegate do
|
|
134
138
|
headers: headers('X-AccessToken' => token),
|
135
139
|
query: {
|
136
140
|
'SellerName' => user.username,
|
141
|
+
'SellingStatus' => GunBroker::User::ItemsDelegate::SELLING_STATUS[:both],
|
137
142
|
'PageSize' => GunBroker::API::PAGE_SIZE
|
138
143
|
}
|
139
144
|
)
|
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.
|
4
|
+
version: 0.6.0
|
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-
|
11
|
+
date: 2015-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|