springboard-retail 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -1
- data/lib/springboard/client/uri.rb +9 -1
- data/spec/springboard/client/resource_spec.rb +44 -1
- data/spec/springboard/client/uri_spec.rb +33 -4
- data/springboard-retail.gemspec +1 -1
- data/vendor/cache/hashie-3.5.7.gem +0 -0
- data/vendor/cache/json-2.1.0.gem +0 -0
- metadata +4 -4
- data/vendor/cache/hashie-3.5.5.gem +0 -0
- data/vendor/cache/json-2.0.3.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75887540f522a54dbca3eb013bffa99780b96d17846797c8072963c2567ebf89
|
4
|
+
data.tar.gz: 9b72a1e965fedce2afd7c25da5a68e85b2caf587916fbccda22f0e9a3dbe1a99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06be6e7ecf83216be6d5200b0044615719e7605911f5c1bf3f1ccf76b8bdf9a7480ae334028254ba49d50134e43ba7c858f5769b6fadde6fa4a9b27a5458121
|
7
|
+
data.tar.gz: 4095a672bdeb383b19cffb6657137456e8dc8801255e7f43548ef0db9a2c3db01491f666d5508dd79e9b6275715b250cb13a683d1cbce812b966bc7fa616b5ad
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
[](https://travis-ci.org/springboardretail/springboard-client-ruby)
|
5
5
|
[](https://codeclimate.com/github/springboardretail/springboard-client-ruby)
|
6
6
|
[](https://coveralls.io/github/springboardretail/springboard-client-ruby?branch=master)
|
7
|
-
[](https://gemnasium.com/springboardretail/springboard-client-ruby)
|
8
7
|
|
9
8
|
This is the [Springboard Retail](http://springboardretail.com/) (a point-of-sale/retail management system) client library for Ruby. It provides access to the Springboard Retail HTTP API.
|
10
9
|
|
@@ -10,7 +10,7 @@ module Springboard
|
|
10
10
|
#
|
11
11
|
# @return [URI]
|
12
12
|
def self.parse(value)
|
13
|
-
return value if value.is_a?(self)
|
13
|
+
return value.dup if value.is_a?(self)
|
14
14
|
new(::Addressable::URI.parse(value))
|
15
15
|
end
|
16
16
|
|
@@ -30,6 +30,14 @@ module Springboard
|
|
30
30
|
@uri = uri
|
31
31
|
end
|
32
32
|
|
33
|
+
##
|
34
|
+
# Clones the URI object
|
35
|
+
#
|
36
|
+
# @return [URI]
|
37
|
+
def dup
|
38
|
+
self.class.new(@uri.dup)
|
39
|
+
end
|
40
|
+
|
33
41
|
##
|
34
42
|
# Returns a new URI with the given subpath appended to it. Ensures a single
|
35
43
|
# forward slash between the URI's path and the given subpath.
|
@@ -48,6 +48,12 @@ describe Springboard::Client::Resource do
|
|
48
48
|
it "should add bracket notation for array parameters" do
|
49
49
|
expect(resource.__send__(method, :somearray => [1, 2, 3]).uri.to_s).to eq("/some/path?somearray[]=1&somearray[]=2&somearray[]=3")
|
50
50
|
end
|
51
|
+
|
52
|
+
it "should return a new resource without modifying the existing URI" do
|
53
|
+
new_resource = resource.query(per_page: 1)
|
54
|
+
expect(new_resource.uri.to_s).to eq("/some/path?per_page=1")
|
55
|
+
expect(resource.uri.to_s).to eq("/some/path")
|
56
|
+
end
|
51
57
|
end
|
52
58
|
|
53
59
|
describe "when called without arguments" do
|
@@ -107,7 +113,7 @@ describe Springboard::Client::Resource do
|
|
107
113
|
end
|
108
114
|
end
|
109
115
|
|
110
|
-
%w{
|
116
|
+
%w{each each_page}.each do |method|
|
111
117
|
describe method do
|
112
118
|
it "should call the client's #{method} method with the resource's URI" do
|
113
119
|
expect(client).to receive(method).with(resource.uri)
|
@@ -134,6 +140,37 @@ describe Springboard::Client::Resource do
|
|
134
140
|
end
|
135
141
|
end
|
136
142
|
|
143
|
+
describe "count" do
|
144
|
+
let(:response_data) {
|
145
|
+
{
|
146
|
+
:status => 200,
|
147
|
+
:body => {total: 123}.to_json
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
it "should call the client's count method with the resource's URI" do
|
152
|
+
expect(client).to receive(:count).with(resource.uri)
|
153
|
+
resource.count
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should set the per_page query string param to 1" do
|
157
|
+
request_stub = stub_request(:get, "#{base_url}/some/path?page=1&per_page=1").to_return(response_data)
|
158
|
+
resource.count
|
159
|
+
expect(request_stub).to have_been_requested
|
160
|
+
end
|
161
|
+
|
162
|
+
it "should return the resource count" do
|
163
|
+
request_stub = stub_request(:get, "#{base_url}/some/path?page=1&per_page=1").to_return(response_data)
|
164
|
+
expect(resource.count).to eq(123)
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should not modify the original resource URI" do
|
168
|
+
request_stub = stub_request(:get, "#{base_url}/some/path?page=1&per_page=1").to_return(response_data)
|
169
|
+
resource.count
|
170
|
+
expect(resource.uri.to_s).to eq("/some/path")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
137
174
|
describe "first" do
|
138
175
|
let(:response_data) {
|
139
176
|
{
|
@@ -152,6 +189,12 @@ describe Springboard::Client::Resource do
|
|
152
189
|
request_stub = stub_request(:get, "#{base_url}/some/path?page=1&per_page=1").to_return(response_data)
|
153
190
|
expect(resource.first).to eq({"id" => "Me first!"})
|
154
191
|
end
|
192
|
+
|
193
|
+
it "should not modify the original resource URI" do
|
194
|
+
request_stub = stub_request(:get, "#{base_url}/some/path?page=1&per_page=1").to_return(response_data)
|
195
|
+
resource.first
|
196
|
+
expect(resource.uri.to_s).to eq("/some/path")
|
197
|
+
end
|
155
198
|
end
|
156
199
|
|
157
200
|
describe "embed" do
|
@@ -12,10 +12,39 @@ describe Springboard::Client::URI do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "parse" do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
describe "when called with a URI object" do
|
16
|
+
it "should return a cloned URI object" do
|
17
|
+
parsed_uri = described_class.parse(uri)
|
18
|
+
expect(uri.class).to eq(parsed_uri.class)
|
19
|
+
expect(uri.object_id).not_to eq(parsed_uri.object_id)
|
20
|
+
expect(parsed_uri.to_s).to eq(uri.to_s)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "when called with a URI string" do
|
25
|
+
it "should return a URI based on the given string" do
|
26
|
+
uri = described_class.parse('/some_path')
|
27
|
+
expect(uri).to be_a(described_class)
|
28
|
+
expect(uri.to_s).to eq('/some_path')
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "dup" do
|
34
|
+
it "should return a duplicate URI object" do
|
35
|
+
dup_uri = uri.dup
|
36
|
+
expect(uri.class).to eq(dup_uri.class)
|
37
|
+
expect(uri.to_s).to eq(dup_uri.to_s)
|
38
|
+
expect(uri.object_id).not_to eq(dup_uri.object_id)
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "when mutating the copy" do
|
42
|
+
it "should not affect the original" do
|
43
|
+
dup_uri = uri.dup
|
44
|
+
dup_uri.query_values = {per_page: 1}
|
45
|
+
expect(uri.to_s).to eq('/relative/path')
|
46
|
+
expect(dup_uri.to_s).to eq('/relative/path?per_page=1')
|
47
|
+
end
|
19
48
|
end
|
20
49
|
end
|
21
50
|
|
data/springboard-retail.gemspec
CHANGED
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: springboard-retail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Stotz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: patron
|
@@ -104,8 +104,8 @@ files:
|
|
104
104
|
- vendor/cache/crack-0.4.2.gem
|
105
105
|
- vendor/cache/diff-lcs-1.2.5.gem
|
106
106
|
- vendor/cache/docile-1.1.5.gem
|
107
|
-
- vendor/cache/hashie-3.5.
|
108
|
-
- vendor/cache/json-2.0.
|
107
|
+
- vendor/cache/hashie-3.5.7.gem
|
108
|
+
- vendor/cache/json-2.1.0.gem
|
109
109
|
- vendor/cache/method_source-0.8.2.gem
|
110
110
|
- vendor/cache/mime-types-2.4.3.gem
|
111
111
|
- vendor/cache/multi_json-1.11.0.gem
|
Binary file
|
data/vendor/cache/json-2.0.3.gem
DELETED
Binary file
|