postat 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rspec +2 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +48 -31
- data/Readme.md +3 -3
- data/lib/generators/postat/templates/initializer.rb +4 -10
- data/lib/generators/postat/templates/initializer.yml +20 -20
- data/lib/postat.rb +69 -82
- data/postat.gemspec +8 -8
- data/spec/postat_spec.rb +103 -7
- data/spec/spec_helper.rb +19 -1
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5aedca46767504fc502f80ef1881dce529a3dfd4b88ac7ee415329a87ba5e70c
|
4
|
+
data.tar.gz: f2deec1775b8b854ee497c7fc37d604f638b2ac8bb742f20d78149eb477d94b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4135bcdae2852044a12201c694a3352ce188d5cbbd2bdce4accfbb03f422ee89a17d834b1fdb289dc65e276b6253c4e7e764ed4bd6dc833fd6d1e994a2dae8c0
|
7
|
+
data.tar.gz: 5ddf55186d6a79dd413d47e60cf3e26657ffc4df5593ce17a3aacc2cc603282853881453a39e8e78a87a2b5e01f23b952b7102e6a94307402e59e9833019cd5f
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,45 +1,58 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
activesupport (5.2.3)
|
5
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
6
|
+
i18n (>= 0.7, < 2)
|
7
|
+
minitest (~> 5.1)
|
8
|
+
tzinfo (~> 1.1)
|
4
9
|
akami (1.3.1)
|
5
10
|
gyoku (>= 0.4.0)
|
6
11
|
nokogiri
|
7
|
-
ast (2.
|
12
|
+
ast (2.4.0)
|
8
13
|
builder (3.2.3)
|
9
|
-
|
14
|
+
concurrent-ruby (1.1.5)
|
15
|
+
diff-lcs (1.3)
|
10
16
|
gyoku (1.3.1)
|
11
17
|
builder (>= 2.1.2)
|
12
|
-
httpi (2.4.
|
18
|
+
httpi (2.4.4)
|
13
19
|
rack
|
14
20
|
socksify
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
i18n (1.6.0)
|
22
|
+
concurrent-ruby (~> 1.0)
|
23
|
+
jaro_winkler (1.5.2)
|
24
|
+
mini_portile2 (2.4.0)
|
25
|
+
minitest (5.11.3)
|
26
|
+
nokogiri (1.10.3)
|
27
|
+
mini_portile2 (~> 2.4.0)
|
18
28
|
nori (2.6.0)
|
19
|
-
parallel (1.
|
20
|
-
parser (2.
|
21
|
-
ast (~> 2.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
rspec-
|
29
|
-
|
30
|
-
rspec-
|
31
|
-
rspec-
|
32
|
-
|
33
|
-
|
34
|
-
rspec-mocks (
|
35
|
-
|
29
|
+
parallel (1.17.0)
|
30
|
+
parser (2.6.3.0)
|
31
|
+
ast (~> 2.4.0)
|
32
|
+
rack (2.0.7)
|
33
|
+
rainbow (3.0.0)
|
34
|
+
rake (12.3.2)
|
35
|
+
rspec (3.8.0)
|
36
|
+
rspec-core (~> 3.8.0)
|
37
|
+
rspec-expectations (~> 3.8.0)
|
38
|
+
rspec-mocks (~> 3.8.0)
|
39
|
+
rspec-core (3.8.0)
|
40
|
+
rspec-support (~> 3.8.0)
|
41
|
+
rspec-expectations (3.8.3)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.8.0)
|
44
|
+
rspec-mocks (3.8.0)
|
45
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
+
rspec-support (~> 3.8.0)
|
47
|
+
rspec-support (3.8.0)
|
48
|
+
rubocop (0.70.0)
|
49
|
+
jaro_winkler (~> 1.5.1)
|
36
50
|
parallel (~> 1.10)
|
37
|
-
parser (>= 2.
|
38
|
-
|
39
|
-
rainbow (>= 2.2.2, < 3.0)
|
51
|
+
parser (>= 2.6)
|
52
|
+
rainbow (>= 2.2.2, < 4.0)
|
40
53
|
ruby-progressbar (~> 1.7)
|
41
|
-
unicode-display_width (
|
42
|
-
ruby-progressbar (1.
|
54
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
55
|
+
ruby-progressbar (1.10.0)
|
43
56
|
savon (2.11.2)
|
44
57
|
akami (~> 1.2)
|
45
58
|
builder (>= 2.1.2)
|
@@ -49,7 +62,10 @@ GEM
|
|
49
62
|
nori (~> 2.4)
|
50
63
|
wasabi (~> 3.4)
|
51
64
|
socksify (1.7.1)
|
52
|
-
|
65
|
+
thread_safe (0.3.6)
|
66
|
+
tzinfo (1.2.5)
|
67
|
+
thread_safe (~> 0.1)
|
68
|
+
unicode-display_width (1.6.0)
|
53
69
|
wasabi (3.5.0)
|
54
70
|
httpi (~> 2.0)
|
55
71
|
nokogiri (>= 1.4.2)
|
@@ -58,10 +74,11 @@ PLATFORMS
|
|
58
74
|
ruby
|
59
75
|
|
60
76
|
DEPENDENCIES
|
77
|
+
activesupport
|
61
78
|
rake
|
62
|
-
rspec
|
79
|
+
rspec
|
63
80
|
rubocop
|
64
81
|
savon (~> 2.11.1)
|
65
82
|
|
66
83
|
BUNDLED WITH
|
67
|
-
1.
|
84
|
+
1.17.1
|
data/Readme.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Rylos Post AT Soap Wrapper for ruby
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
@@ -41,12 +41,12 @@ config/postat.yml
|
|
41
41
|
```
|
42
42
|
|
43
43
|
## Usage
|
44
|
-
This Gem provides you with a Wrapper for the
|
44
|
+
This Gem provides you with a Wrapper for the Rylos PostAT-Soap-Api
|
45
45
|
|
46
46
|
|
47
47
|
## Contributing
|
48
48
|
|
49
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
49
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ReverseRetail/postat. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
50
50
|
|
51
51
|
|
52
52
|
## License
|
@@ -1,16 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
guid: ENV['POSTAT_GUID'] || 'guid',
|
5
|
-
username: ENV['POSTAT_USERNAME'] || 'username',
|
6
|
-
password: ENV['POSTAT_PASSWORD'] || 'password',
|
7
|
-
namespace: ENV['POSTAT_NAMESPACE'] || 'http://example.com/',
|
8
|
-
wsdl: ENV['POSTAT_WSDL'] || 'http://example.com/soap?WSDL'
|
9
|
-
}
|
10
|
-
|
3
|
+
config = {}
|
11
4
|
config_file = File.expand_path("#{Rails.root}/config/postat.yml", __FILE__)
|
12
5
|
if File.exist?(config_file)
|
13
6
|
configs_from_file = YAML.safe_load(File.read(config_file))
|
14
|
-
|
15
|
-
|
7
|
+
config.merge!(configs_from_file[Rails.env])
|
8
|
+
config.symbolize_keys!
|
16
9
|
end
|
10
|
+
POSTAT_CONFIG = config
|
@@ -1,29 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
development:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
wsdl:
|
4
|
+
client_id: 'guid'
|
5
|
+
org_unit_id: 'username'
|
6
|
+
org_unit_guid: 'password'
|
7
|
+
endpoint: 'http://example.com/secure'
|
8
|
+
wsdl: 'http://example.com/soap?WSDL'
|
9
9
|
|
10
10
|
test:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
wsdl:
|
11
|
+
client_id: 'guid'
|
12
|
+
org_unit_id: 'username'
|
13
|
+
org_unit_guid: 'password'
|
14
|
+
endpoint: 'http://example.com/secure'
|
15
|
+
wsdl: 'http://example.com/soap?WSDL'
|
16
16
|
|
17
17
|
beta:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
wsdl:
|
18
|
+
client_id: 'guid'
|
19
|
+
org_unit_id: 'username'
|
20
|
+
org_unit_guid: 'password'
|
21
|
+
endpoint: 'http://example.com/secure'
|
22
|
+
wsdl: 'http://example.com/soap?WSDL'
|
23
23
|
|
24
24
|
production:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
wsdl:
|
25
|
+
client_id: 'guid'
|
26
|
+
org_unit_id: 'username'
|
27
|
+
org_unit_guid: 'password'
|
28
|
+
endpoint: 'http://example.com/secure'
|
29
|
+
wsdl: 'http://example.com/soap?WSDL'
|
data/lib/postat.rb
CHANGED
@@ -6,101 +6,92 @@ class Postat
|
|
6
6
|
attr_reader :client
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
@client = Savon.client(wsdl: POSTAT_CONFIG[:wsdl],
|
10
|
+
convert_request_keys_to: :none,
|
11
|
+
env_namespace: :soapenv,
|
12
|
+
namespace_identifier: :post,
|
13
|
+
log: true,
|
14
|
+
pretty_print_xml: true,
|
15
|
+
endpoint: POSTAT_CONFIG[:endpoint],
|
16
|
+
namespaces: {
|
17
|
+
'xmlns:post' => 'http://post.ondot.at',
|
18
|
+
'xmlns:arr' => 'http://schemas.microsoft.com/2003/10/Serialization/Arrays',
|
19
|
+
'xmlns:core' => 'http://Core.Model',
|
20
|
+
'xmlns:ser' => 'http://schemas.microsoft.com/2003/10/Serialization/'
|
21
|
+
}
|
22
|
+
)
|
13
23
|
end
|
14
24
|
|
15
25
|
def delete_label(options = {})
|
16
|
-
message =
|
26
|
+
message = []
|
17
27
|
options[:shipments]&.each do |shipment|
|
18
|
-
|
28
|
+
row = init_message
|
29
|
+
row['post:Number'] = shipment[:reference_number]
|
30
|
+
add_common_params(row)
|
31
|
+
message<< { 'post:CancelShipmentRow' => row }
|
19
32
|
end
|
20
|
-
response = client.call(:
|
21
|
-
handle_response
|
33
|
+
response = client.call(:cancel_shipments, message: { 'post:shipments' => message })
|
34
|
+
handle_response(response, action: :cancel_shipments)
|
22
35
|
end
|
23
36
|
|
37
|
+
# NOTE: be careful with the order of attributes to avoid fake missing attribute errors
|
24
38
|
def generate_label(options = {})
|
25
|
-
message =
|
26
|
-
message[:
|
27
|
-
message[:
|
28
|
-
message[:
|
29
|
-
|
30
|
-
|
39
|
+
message = init_message
|
40
|
+
message['post:DeliveryServiceThirdPartyID'] = options[:delivery_code]
|
41
|
+
message['post:Number'] = options[:reference_number]
|
42
|
+
message['post:ColloList'] = add_packages(options[:package])
|
43
|
+
# message['post:ShippingDateTimeFrom'] = (Time.zone.now + 180).iso8601
|
44
|
+
message['post:OURecipientAddress'] = add_address(options[:to])
|
45
|
+
message['post:OUShipperAddress'] = add_address(options[:from])
|
46
|
+
add_common_params(message)
|
47
|
+
message['post:PrinterObject'] = add_printing_details
|
48
|
+
# TODO: Look for the new attrs names for: PaymentType, Commodities
|
49
|
+
|
50
|
+
response = client.call(:import_shipment, message: { 'post:row' => message })
|
31
51
|
handle_response response
|
32
52
|
end
|
33
53
|
|
34
54
|
private
|
35
55
|
|
36
|
-
def handle_response(response)
|
56
|
+
def handle_response(response, action: :import_shipment)
|
57
|
+
action_name = "#{action}_response".to_sym
|
37
58
|
response = response.to_hash
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
raise StandardError,
|
59
|
+
error = response&.dig(action_name, :error_message)
|
60
|
+
error ||= response&.dig(action_name, :error_code)
|
61
|
+
return response if error.blank?
|
62
|
+
raise StandardError, [error]
|
42
63
|
end
|
43
64
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
shipment[:CustomerReference] = options[:reference_number] if options[:delivery_code]
|
51
|
-
shipment[:ReturnReference] = options[:reference_number] if options[:return_code]
|
52
|
-
shipment[:CurrencyCode] = 'EUR'
|
53
|
-
shipment[:AdditionalInsurance] = 0
|
54
|
-
commodities = add_commodities(options[:commodities])
|
55
|
-
shipment[:Commodities] = commodities unless commodities.empty?
|
56
|
-
packages = add_packages(options[:package])
|
57
|
-
shipment[:Packages] = packages unless packages.empty?
|
58
|
-
shipment[:Label] = { ImageType: 'PDF', PaperFormat: 'A5' }
|
59
|
-
shipment
|
65
|
+
def add_printing_details
|
66
|
+
{
|
67
|
+
'post:LanguageID' => 'pdf',
|
68
|
+
'post:LabelFormatID' => '100x200',
|
69
|
+
'post:PaperLayoutID' => 'A5'
|
70
|
+
}
|
60
71
|
end
|
61
72
|
|
62
|
-
def
|
63
|
-
{
|
64
|
-
Guid: @guid,
|
65
|
-
Username: @user,
|
66
|
-
Password: @password
|
67
|
-
},
|
68
|
-
Carrier: 'POSTAT',
|
69
|
-
Shipments: {} }
|
73
|
+
def init_message
|
74
|
+
{ 'post:ClientID' => POSTAT_CONFIG[:client_id] || raise('postat config missing :client_id') }
|
70
75
|
end
|
71
76
|
|
72
|
-
def
|
73
|
-
|
74
|
-
|
75
|
-
CareOf: address[:care_of].to_s,
|
76
|
-
PhoneNumber: address[:phone].to_s,
|
77
|
-
EMailAddress: address[:email].to_s,
|
78
|
-
CountryCode: address[:country].to_s,
|
79
|
-
StateCode: address[:state_code].to_s,
|
80
|
-
PostalCode: address[:zip_code].to_s,
|
81
|
-
CityName: address[:city].to_s,
|
82
|
-
StreetName: address[:street].to_s,
|
83
|
-
StreetNo: address[:street_no].to_s }
|
77
|
+
def add_common_params(data)
|
78
|
+
data['post:OrgUnitGuid'] = POSTAT_CONFIG[:org_unit_guid] || raise('postat config missing :org_unit_guid')
|
79
|
+
data['post:OrgUnitID'] = POSTAT_CONFIG[:org_unit_id] || raise('postat config missing :org_unit_id')
|
84
80
|
end
|
85
81
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
Quantity: 1
|
100
|
-
}
|
101
|
-
}
|
102
|
-
end
|
103
|
-
commodity_array
|
82
|
+
def add_address(address)
|
83
|
+
{
|
84
|
+
'post:AddressLine1' => address[:street].to_s,
|
85
|
+
'post:City' => address[:city].to_s,
|
86
|
+
'post:CountryID' => address[:country].to_s,
|
87
|
+
'post:HouseNumber' => address[:street_no].to_s,
|
88
|
+
'post:Name1' => "#{address[:first_name]} #{address[:last_name]}".squish,
|
89
|
+
'post:Name2' => address[:company].to_s,
|
90
|
+
'post:PostalCode' => address[:zip_code].to_s,
|
91
|
+
'post:Tel1' => address[:phone].to_s,
|
92
|
+
'post:Email' => address[:email].to_s,
|
93
|
+
# TODO: look for the new attrs names: CareOf, StateCode
|
94
|
+
}
|
104
95
|
end
|
105
96
|
|
106
97
|
def add_packages(packages = [])
|
@@ -108,15 +99,11 @@ class Postat
|
|
108
99
|
packages = [packages] if packages.is_a?(Hash)
|
109
100
|
[*packages].each_with_index do |package, i|
|
110
101
|
package_array << {
|
111
|
-
'
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
Width: package[:width].to_i,
|
117
|
-
Height: package[:height].to_i,
|
118
|
-
DimensionType: 'CM',
|
119
|
-
PackageType: 'CARTON'
|
102
|
+
'post:ColloRow' => {
|
103
|
+
'post:Weight' => package[:weight].to_i,
|
104
|
+
'post:Length' => package[:length].to_i,
|
105
|
+
'post:Width' => package[:width].to_i,
|
106
|
+
'post:Height' => package[:height].to_i,
|
120
107
|
}
|
121
108
|
}
|
122
109
|
end
|
data/postat.gemspec
CHANGED
@@ -3,26 +3,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'postat'
|
6
|
-
s.version = '0.0.
|
7
|
-
s.authors = ['
|
8
|
-
s.email = ['
|
6
|
+
s.version = '0.0.2'
|
7
|
+
s.authors = ['Yves Goizet','Oewn Peredo']
|
8
|
+
s.email = ['it@buddyandselly.com']
|
9
9
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
10
10
|
|
11
|
-
s.homepage = 'https://github.com/
|
11
|
+
s.homepage = 'https://github.com/ReverseRetail/postat'
|
12
12
|
s.license = 'MIT'
|
13
13
|
s.require_paths = ['lib']
|
14
|
-
s.summary = 'Wrapper for
|
14
|
+
s.summary = 'Wrapper for PostAT SOAP Api'
|
15
15
|
s.test_files = ['spec/postat_spec.rb', 'spec/spec_helper.rb']
|
16
16
|
|
17
17
|
if s.respond_to? :specification_version
|
18
18
|
s.specification_version = 3
|
19
19
|
|
20
20
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0')
|
21
|
-
s.add_runtime_dependency('savon',
|
21
|
+
s.add_runtime_dependency('savon', '~> 2.10')
|
22
22
|
else
|
23
|
-
s.add_dependency('savon',
|
23
|
+
s.add_dependency('savon', '~> 2.10')
|
24
24
|
end
|
25
25
|
else
|
26
|
-
s.add_dependency('savon',
|
26
|
+
s.add_dependency('savon', '~> 2.10')
|
27
27
|
end
|
28
28
|
end
|
data/spec/postat_spec.rb
CHANGED
@@ -1,16 +1,112 @@
|
|
1
1
|
require File.expand_path('spec/spec_helper')
|
2
|
+
require 'active_support/all'
|
2
3
|
|
3
4
|
describe Postat do
|
4
|
-
let(:
|
5
|
-
|
5
|
+
let(:postat) { double(:postat) }
|
6
|
+
before { stub_settings }
|
7
|
+
before do
|
8
|
+
allow(Savon).to receive(:client).and_return(postat)
|
9
|
+
allow(Time).to receive(:zone).and_return(Time)
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '#delete_label' do
|
13
|
+
it 'success label' do
|
14
|
+
data = {
|
15
|
+
cancel_shipments_response: { error_message: nil, success: true }
|
16
|
+
}
|
17
|
+
stub_postat(:cancel_shipments, data)
|
18
|
+
res = Postat.new.delete_label(shipments: [{ reference_number: 1 }])
|
19
|
+
expect(res[:cancel_shipments_response][:error_message].nil?).to be_truthy
|
20
|
+
end
|
6
21
|
|
7
|
-
|
8
|
-
|
22
|
+
it 'error label' do
|
23
|
+
data = {
|
24
|
+
cancel_shipments_response: { error_message: 'err msg', success: true }
|
25
|
+
}
|
26
|
+
stub_postat(:cancel_shipments, data)
|
27
|
+
expect { Postat.new.delete_label(shipments: [{ reference_number: 1 }]) }
|
28
|
+
.to raise_error(StandardError)
|
29
|
+
end
|
9
30
|
end
|
10
31
|
|
11
|
-
describe
|
12
|
-
it '
|
13
|
-
|
32
|
+
describe '#generate_label' do
|
33
|
+
it 'success label' do
|
34
|
+
stub_postat(:import_shipment, success_res_label)
|
35
|
+
res = Postat.new.generate_label(label_options)
|
36
|
+
expect(res[:import_shipment_response][:error_message].nil?).to be_truthy
|
14
37
|
end
|
38
|
+
|
39
|
+
it 'error label' do
|
40
|
+
data = {
|
41
|
+
import_shipment_response: { error_message: 'err msg', success: true }
|
42
|
+
}
|
43
|
+
stub_postat(:import_shipment, data)
|
44
|
+
expect { Postat.new.generate_label(shipments: [{ reference_number: 1 }]) }
|
45
|
+
.to raise_error(StandardError)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def stub_postat(action, return_data)
|
52
|
+
allow(postat).to receive(:call).with(action, anything)
|
53
|
+
.and_return(return_data)
|
54
|
+
end
|
55
|
+
|
56
|
+
def stub_settings
|
57
|
+
config = {
|
58
|
+
client_id: '1',
|
59
|
+
org_unit_id: '1',
|
60
|
+
org_unit_guid: '1'
|
61
|
+
}
|
62
|
+
stub_const('POSTAT_CONFIG', config)
|
63
|
+
end
|
64
|
+
|
65
|
+
def label_options
|
66
|
+
package = {
|
67
|
+
length: 1,
|
68
|
+
width: 1,
|
69
|
+
height: 1,
|
70
|
+
weight: 1,
|
71
|
+
description: 'Clothing'
|
72
|
+
}
|
73
|
+
|
74
|
+
address = {
|
75
|
+
first_name: 'lorem',
|
76
|
+
last_name: 'ipsum',
|
77
|
+
street: 'str',
|
78
|
+
street_no: 10,
|
79
|
+
zip_code: '0000',
|
80
|
+
city: 'Hamburg',
|
81
|
+
country: 'de'
|
82
|
+
}
|
83
|
+
|
84
|
+
{
|
85
|
+
delivery_code: 28,
|
86
|
+
package: [package],
|
87
|
+
reference_number: 'Inbound',
|
88
|
+
create_shipping_label: true,
|
89
|
+
from: address,
|
90
|
+
to: address
|
91
|
+
}
|
92
|
+
end
|
93
|
+
|
94
|
+
def success_res_label
|
95
|
+
data = {
|
96
|
+
pdfData: '......',
|
97
|
+
import_shipment_result: {
|
98
|
+
collo_row: [
|
99
|
+
{
|
100
|
+
collo_code_list: {
|
101
|
+
collo_code_row: {
|
102
|
+
code: '010052000000280964922303',
|
103
|
+
number_type_id: '0fcbf432-c95b-467d-b397-aef3d862b5a3'
|
104
|
+
}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
]
|
108
|
+
}
|
109
|
+
}
|
110
|
+
{ import_shipment_response: data }
|
15
111
|
end
|
16
112
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,20 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
1
7
|
$LOAD_PATH.unshift 'lib'
|
2
|
-
require '
|
8
|
+
require 'Postat'
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
17
|
+
# the seed, which is printed after each run.
|
18
|
+
# --seed 1234
|
19
|
+
config.order = 'random'
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Yves Goizet
|
8
|
+
- Oewn Peredo
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2019-05-24 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: savon
|
@@ -16,22 +17,23 @@ dependencies:
|
|
16
17
|
requirements:
|
17
18
|
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.10
|
20
|
+
version: '2.10'
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - "~>"
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.10
|
27
|
+
version: '2.10'
|
27
28
|
description:
|
28
29
|
email:
|
29
|
-
-
|
30
|
+
- it@buddyandselly.com
|
30
31
|
executables: []
|
31
32
|
extensions: []
|
32
33
|
extra_rdoc_files: []
|
33
34
|
files:
|
34
35
|
- ".gitignore"
|
36
|
+
- ".rspec"
|
35
37
|
- Gemfile
|
36
38
|
- Gemfile.lock
|
37
39
|
- Rakefile
|
@@ -43,7 +45,7 @@ files:
|
|
43
45
|
- postat.gemspec
|
44
46
|
- spec/postat_spec.rb
|
45
47
|
- spec/spec_helper.rb
|
46
|
-
homepage: https://github.com/
|
48
|
+
homepage: https://github.com/ReverseRetail/postat
|
47
49
|
licenses:
|
48
50
|
- MIT
|
49
51
|
metadata: {}
|
@@ -63,10 +65,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
65
|
version: '0'
|
64
66
|
requirements: []
|
65
67
|
rubyforge_project:
|
66
|
-
rubygems_version: 2.
|
68
|
+
rubygems_version: 2.7.9
|
67
69
|
signing_key:
|
68
70
|
specification_version: 3
|
69
|
-
summary: Wrapper for
|
71
|
+
summary: Wrapper for PostAT SOAP Api
|
70
72
|
test_files:
|
71
73
|
- spec/postat_spec.rb
|
72
74
|
- spec/spec_helper.rb
|