beslist 0.1.1 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6b3e9696e5dea81a2aa83d2fdafb07149609182
4
- data.tar.gz: 0f64c757393476baee15b1437392786502b0d35c
3
+ metadata.gz: 8c3b4ae204e35ca4560a13eb9fb5bded06424fcc
4
+ data.tar.gz: 41b71908b26dfef036fc9676485e3e05ec9f542f
5
5
  SHA512:
6
- metadata.gz: 3d7d29d727095123187a43e7a68ca4450f884e0cb8f0a8dd560a6ed7fab2110b2901999d25157e9a41dcb5059c98450b994673e6f5f729ce1c1dc63a401be128
7
- data.tar.gz: eac60f8f38c8581dc71d96c423e1842e85712be2c20e93f00daa82422875a7a21a77a712f28039d9eeae26240e569acee29c5378d1b63faad2d5c51c32979e5c
6
+ metadata.gz: d18ab44864c1c7e8eb84fe4df2f7bbff4c24b098b50c38d9e3f46cbd9998ccfe9a9615526edce54550acd5d073c3c68d239f27f8c7c16c7a16542431e30050f3
7
+ data.tar.gz: 969e9fbaf522e0a4cef73b33a7d5af309f0ed24649f61674e32ada855110bd577f18a38f5a183885717a86ccd23bbfef5027fffd293d5c8a65ceb0939dde1977
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
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.1.1 ruby lib
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.1.1"
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-21"
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 = [
@@ -10,15 +10,18 @@ module Beslist
10
10
  :shop_id => options[:shop_id])
11
11
  end
12
12
 
13
- def shoppingcart_shop_orders(date_from, date_to)
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
 
@@ -16,18 +16,10 @@ module Beslist
16
16
  end
17
17
 
18
18
  def interface
19
- @interface ||= begin
20
- params = {
21
- client_id: @connection.options[:client_id],
22
- shop_id: @connection.options[:shop_id]
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 "#shoppingcart_shop_orders" do
6
+ describe "#orders" do
7
7
  context 'when the checksum is valid' do
8
- subject(:orders){ client.shoppingcart_shop_orders(Beslist::Spec.date_from, Beslist::Spec.date_to) }
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.shoppingcart_shop_orders(Beslist::Spec.date_from, Beslist::Spec.date_to)
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.1.1
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-21 00:00:00.000000000 Z
11
+ date: 2015-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_xml