beslist 0.2.0 → 0.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/VERSION +1 -1
- data/beslist.gemspec +2 -2
- data/lib/beslist/client.rb +6 -4
- data/spec/lib/beslist/client_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7b6cc574fd51500223839a47fcbabb144410c9f
|
4
|
+
data.tar.gz: 981c6b76f818d0a10d785401216446e43460c201
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a815e9018c86f8d2175bab8a7b7fcf7621a6761c278b3909aa17fd0c773d39a8e370f78ccada9545a6236793e9190d49d61bfd921786f63667960103fecfa142
|
7
|
+
data.tar.gz: 805d5c7fcc41c074450edf23399415b313176dafdfc6ff53985441cb03960d7286c5fff784b038006bc008ca3c40d1b8449c3e8e87766b14212e1723ebc2132c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/beslist.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: beslist 0.2.
|
5
|
+
# stub: beslist 0.2.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "beslist"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
data/lib/beslist/client.rb
CHANGED
@@ -10,17 +10,19 @@ module Beslist
|
|
10
10
|
:shop_id => options[:shop_id])
|
11
11
|
end
|
12
12
|
|
13
|
-
def orders(
|
13
|
+
def orders(options)
|
14
|
+
date_from, date_to = options.delete(:date_from), options.delete(:date_to)
|
14
15
|
response = @connection.request do
|
15
16
|
@connection.interface.get do |req|
|
16
17
|
req.url Beslist::API::Config.prefix + '/shoppingcart/shop_orders/'
|
17
18
|
req.params = {
|
18
19
|
checksum: @connection.checksum(date_from, date_to),
|
19
20
|
client_id: @connection.options[:client_id],
|
20
|
-
shop_id: @connection.options[:shop_id]
|
21
|
-
date_from: date_from,
|
22
|
-
date_to: date_to
|
21
|
+
shop_id: @connection.options[:shop_id]
|
23
22
|
}
|
23
|
+
|
24
|
+
req.params.merge!(date_from: date_from) if date_from
|
25
|
+
req.params.merge!(date_to: date_to) if date_to
|
24
26
|
req.params.merge!(output_type: 'test', test_orders: '1') if Beslist::API::Config.mode == 'sandbox'
|
25
27
|
end
|
26
28
|
end
|
@@ -5,7 +5,7 @@ describe Beslist::API::Client do
|
|
5
5
|
|
6
6
|
describe "#orders" do
|
7
7
|
context 'when the checksum is valid' do
|
8
|
-
subject(:orders){ client.orders(Beslist::Spec.date_from, Beslist::Spec.date_to) }
|
8
|
+
subject(:orders){ client.orders(date_from: Beslist::Spec.date_from, date_to: Beslist::Spec.date_to) }
|
9
9
|
before do
|
10
10
|
stubs = Faraday::Adapter::Test::Stubs.new do |stub|
|
11
11
|
stub.get("/xml/shoppingcart/shop_orders/?checksum=5439de2fa578c75d1d9ba4195efc663c&client_id=99999&date_from=2015-09-01&date_to=2015-09-03&shop_id=88888") { |env| [200, {}, Beslist::Spec.shop_orders] }
|
@@ -33,7 +33,7 @@ describe Beslist::API::Client do
|
|
33
33
|
|
34
34
|
it "raises a Beslist::API::Error" do
|
35
35
|
expect do
|
36
|
-
client.orders(Beslist::Spec.date_from, Beslist::Spec.date_to)
|
36
|
+
client.orders(date_from: Beslist::Spec.date_from, date_to: Beslist::Spec.date_to)
|
37
37
|
end.to raise_error(Beslist::API::Error, 'checksum is invalid')
|
38
38
|
end
|
39
39
|
end
|