dpd_api 0.1.3 → 0.1.5
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/.env.example +2 -0
- data/.gitignore +1 -0
- data/dpd_api.gemspec +1 -0
- data/lib/dpd_api/client/response.rb +7 -6
- data/lib/dpd_api/configuration.rb +7 -2
- data/lib/dpd_api/debug/inspector.rb +3 -3
- data/lib/dpd_api/version.rb +1 -1
- data/spec/lib/dpd_api/calculator_spec.rb +2 -2
- data/spec/lib/dpd_api/configuration_spec.rb +2 -2
- data/spec/lib/dpd_api/geography_spec.rb +4 -5
- data/spec/lib/dpd_api/order_spec.rb +2 -2
- data/spec/lib/dpd_api/tracing_spec.rb +2 -2
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c1ccaffe0337bc75523c4da9c7faccab238e4fb
|
4
|
+
data.tar.gz: 6884ac90c938972fdb4488b46ef039b17f6fd5a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b31b595ca5d239701d50563b3267fdd6f7496fb94ce0c14576023dcd6be3ff113bfb2766183f3612be33dd45500ee2ea94532a31019e344bb90e6518e0016ba4
|
7
|
+
data.tar.gz: 6f08d0af33e3b955b3909a656b3b3dc1ee9024884dd73a165390d5467c4f515c4f33dcf091cdd519ac9eaabbd0bf91d89b163f313f76d534f83d982814c7ad61
|
data/.env.example
ADDED
data/.gitignore
CHANGED
data/dpd_api.gemspec
CHANGED
@@ -19,20 +19,21 @@ module DpdApi
|
|
19
19
|
rescue Savon::SOAPFault => error
|
20
20
|
{ errors: error.to_s }
|
21
21
|
end
|
22
|
-
notify_observers(@url, builder.
|
22
|
+
notify_observers(@url, builder.request_params, builder.response_body, result)
|
23
23
|
result
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
28
|
class ResourceBuilder
|
29
|
-
attr_reader :merged_params, :response_body
|
29
|
+
attr_reader :merged_params, :response_body, :request_params
|
30
30
|
|
31
31
|
def initialize(client, method, params = {}, options = {})
|
32
32
|
@client = client
|
33
33
|
@method = method
|
34
|
+
@params = params
|
34
35
|
@namespace = options.delete(:namespace)
|
35
|
-
@merged_params = merge_auth_params
|
36
|
+
@merged_params = merge_auth_params
|
36
37
|
end
|
37
38
|
|
38
39
|
def resources
|
@@ -44,9 +45,9 @@ module DpdApi
|
|
44
45
|
|
45
46
|
private
|
46
47
|
|
47
|
-
def merge_auth_params
|
48
|
+
def merge_auth_params
|
48
49
|
auth_params = DpdApi.configuration.auth_params.clone
|
49
|
-
auth_params.deep_merge!(params)
|
50
|
+
auth_params.deep_merge!(@params)
|
50
51
|
end
|
51
52
|
|
52
53
|
def response
|
@@ -55,7 +56,7 @@ module DpdApi
|
|
55
56
|
|
56
57
|
def request
|
57
58
|
namespace = @namespace || :request
|
58
|
-
@
|
59
|
+
@request_params ||= @params.blank? ? @merged_params : { namespace => @merged_params }
|
59
60
|
end
|
60
61
|
end
|
61
62
|
end
|
@@ -1,5 +1,10 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
+
begin
|
4
|
+
require 'dotenv'
|
5
|
+
Dotenv.load
|
6
|
+
end
|
7
|
+
|
3
8
|
module DpdApi
|
4
9
|
class << self
|
5
10
|
attr_accessor :configuration
|
@@ -19,8 +24,8 @@ module DpdApi
|
|
19
24
|
attr_reader :auth_params
|
20
25
|
|
21
26
|
def initialize
|
22
|
-
@client_key = '123'
|
23
|
-
@client_number = '234'
|
27
|
+
@client_key = ENV['DPD_CLIENT_KEY'] || '123'
|
28
|
+
@client_number = ENV['DPD_CLIENT_NUMBER'] || '234'
|
24
29
|
@base_url = 'http://wstest.dpd.ru'
|
25
30
|
@debug = false
|
26
31
|
end
|
@@ -6,11 +6,11 @@ module Debug
|
|
6
6
|
client.add_observer(self)
|
7
7
|
end
|
8
8
|
|
9
|
-
def update(url,
|
9
|
+
def update(url, request, response, result)
|
10
10
|
p '--------------------------'
|
11
11
|
p "SENDING REQUEST TO: #{url}"
|
12
|
-
p "WITH PARAMS: #{
|
13
|
-
p "GETTING RESPONSE: #{
|
12
|
+
p "WITH PARAMS: #{request}"
|
13
|
+
p "GETTING RESPONSE: #{response}"
|
14
14
|
p "RESULT: #{result}"
|
15
15
|
p '--------------------------'
|
16
16
|
end
|
data/lib/dpd_api/version.rb
CHANGED
@@ -10,8 +10,8 @@ describe DpdApi::Calculator do
|
|
10
10
|
let(:auth) do
|
11
11
|
{ request: {
|
12
12
|
auth: {
|
13
|
-
client_number:
|
14
|
-
client_key:
|
13
|
+
client_number: ENV['DPD_CLIENT_NUMBER'] || '234',
|
14
|
+
client_key: ENV['DPD_CLIENT_KEY'] || '123'
|
15
15
|
} } }
|
16
16
|
end
|
17
17
|
let(:message) { auth.clone.deep_merge!({ request: params }) }
|
@@ -3,8 +3,8 @@
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe DpdApi do
|
6
|
-
let(:client_key) { '123' }
|
7
|
-
let(:client_number) { '234' }
|
6
|
+
let(:client_key) { ENV['DPD_CLIENT_KEY'] || '123' }
|
7
|
+
let(:client_number) { ENV['DPD_CLIENT_NUMBER'] || '234' }
|
8
8
|
let(:base_url) { 'http://wstest.dpd.ru' }
|
9
9
|
let(:auth_params) do
|
10
10
|
{
|
@@ -8,11 +8,10 @@ describe DpdApi::Geography do
|
|
8
8
|
after(:all) { savon.unmock! }
|
9
9
|
|
10
10
|
let(:auth) do
|
11
|
-
{
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
} } }
|
11
|
+
{ auth: {
|
12
|
+
client_number: ENV['DPD_CLIENT_NUMBER'] || '234',
|
13
|
+
client_key: ENV['DPD_CLIENT_KEY'] || '123'
|
14
|
+
} }
|
16
15
|
end
|
17
16
|
let(:message) { auth }
|
18
17
|
|
@@ -10,8 +10,8 @@ describe DpdApi::Order do
|
|
10
10
|
let(:auth) do
|
11
11
|
{ request: {
|
12
12
|
auth: {
|
13
|
-
client_number:
|
14
|
-
client_key:
|
13
|
+
client_number: ENV['DPD_CLIENT_NUMBER'] || '234',
|
14
|
+
client_key: ENV['DPD_CLIENT_KEY'] || '123'
|
15
15
|
} } }
|
16
16
|
end
|
17
17
|
let(:message) { auth.clone.deep_merge!({ request: params }) }
|
@@ -10,8 +10,8 @@ describe DpdApi::Order do
|
|
10
10
|
let(:auth) do
|
11
11
|
{ request: {
|
12
12
|
auth: {
|
13
|
-
client_number:
|
14
|
-
client_key:
|
13
|
+
client_number: ENV['DPD_CLIENT_NUMBER'] || '234',
|
14
|
+
client_key: ENV['DPD_CLIENT_KEY'] || '123'
|
15
15
|
} } }
|
16
16
|
end
|
17
17
|
let(:message) { auth.clone.deep_merge!({ request: params }) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpd_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ponomarev Nikolay
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: dotenv
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: Ruby / Rails wrapper for Dpd's SOAP API
|
70
84
|
email:
|
71
85
|
- itsnikolay@gmail.com
|
@@ -73,6 +87,7 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
90
|
+
- ".env.example"
|
76
91
|
- ".gitignore"
|
77
92
|
- ".rspec"
|
78
93
|
- ".travis.yml"
|