beslist 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/beslist.gemspec +3 -3
- data/lib/beslist/client.rb +4 -1
- data/lib/beslist/connection.rb +4 -12
- data/spec/lib/beslist/client_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c3b4ae204e35ca4560a13eb9fb5bded06424fcc
|
4
|
+
data.tar.gz: 41b71908b26dfef036fc9676485e3e05ec9f542f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d18ab44864c1c7e8eb84fe4df2f7bbff4c24b098b50c38d9e3f46cbd9998ccfe9a9615526edce54550acd5d073c3c68d239f27f8c7c16c7a16542431e30050f3
|
7
|
+
data.tar.gz: 969e9fbaf522e0a4cef73b33a7d5af309f0ed24649f61674e32ada855110bd577f18a38f5a183885717a86ccd23bbfef5027fffd293d5c8a65ceb0939dde1977
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/beslist.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
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.
|
5
|
+
# stub: beslist 0.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "beslist"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.2.0"
|
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"]
|
13
13
|
s.authors = ["Tsyren Ochirov"]
|
14
|
-
s.date = "2015-12-
|
14
|
+
s.date = "2015-12-22"
|
15
15
|
s.description = "A Ruby client for the Beslist API."
|
16
16
|
s.email = "nsu1team@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/beslist/client.rb
CHANGED
@@ -10,15 +10,18 @@ module Beslist
|
|
10
10
|
:shop_id => options[:shop_id])
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def orders(date_from, date_to)
|
14
14
|
response = @connection.request do
|
15
15
|
@connection.interface.get do |req|
|
16
16
|
req.url Beslist::API::Config.prefix + '/shoppingcart/shop_orders/'
|
17
17
|
req.params = {
|
18
18
|
checksum: @connection.checksum(date_from, date_to),
|
19
|
+
client_id: @connection.options[:client_id],
|
20
|
+
shop_id: @connection.options[:shop_id],
|
19
21
|
date_from: date_from,
|
20
22
|
date_to: date_to
|
21
23
|
}
|
24
|
+
req.params.merge!(output_type: 'test', test_orders: '1') if Beslist::API::Config.mode == 'sandbox'
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
data/lib/beslist/connection.rb
CHANGED
@@ -16,18 +16,10 @@ module Beslist
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def interface
|
19
|
-
@interface ||=
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
24
|
-
params.merge!(output_type: 'test', test_orders: '1') if Beslist::API::Config.mode == 'sandbox'
|
25
|
-
|
26
|
-
Faraday.new(url: Beslist::API::Config.endpoint, headers: {'Content-Type' => 'application/xml'}, params: params) do |faraday|
|
27
|
-
faraday.request :url_encoded # form-encode POST params
|
28
|
-
faraday.response :logger # log requests to STDOUT
|
29
|
-
faraday.adapter :httpclient # make requests with HttpClient
|
30
|
-
end
|
19
|
+
@interface ||= Faraday.new(url: Beslist::API::Config.endpoint, headers: {'Content-Type' => 'application/xml'}) do |faraday|
|
20
|
+
faraday.request :url_encoded # form-encode POST params
|
21
|
+
faraday.response :logger # log requests to STDOUT
|
22
|
+
faraday.adapter :httpclient # make requests with HttpClient
|
31
23
|
end
|
32
24
|
end
|
33
25
|
|
@@ -3,9 +3,9 @@ require "spec_helper"
|
|
3
3
|
describe Beslist::API::Client do
|
4
4
|
let(:client){ Beslist::Spec.instance }
|
5
5
|
|
6
|
-
describe "#
|
6
|
+
describe "#orders" do
|
7
7
|
context 'when the checksum is valid' do
|
8
|
-
subject(:orders){ client.
|
8
|
+
subject(:orders){ client.orders(Beslist::Spec.date_from, 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.
|
36
|
+
client.orders(Beslist::Spec.date_from, Beslist::Spec.date_to)
|
37
37
|
end.to raise_error(Beslist::API::Error, 'checksum is invalid')
|
38
38
|
end
|
39
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beslist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsyren Ochirov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_xml
|