axiomus_api 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/.travis.yml +10 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +67 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/axiomus_api.gemspec +19 -0
- data/lib/axiomus_api/actions.rb +32 -0
- data/lib/axiomus_api/address/dpd_address.rb +8 -0
- data/lib/axiomus_api/address/ems_address.rb +8 -0
- data/lib/axiomus_api/address/post_address.rb +7 -0
- data/lib/axiomus_api/address/region_courier_address.rb +8 -0
- data/lib/axiomus_api/address/region_pickup_address.rb +7 -0
- data/lib/axiomus_api/base.rb +69 -0
- data/lib/axiomus_api/base_auth.rb +9 -0
- data/lib/axiomus_api/errors.rb +14 -0
- data/lib/axiomus_api/item/export_item.rb +5 -0
- data/lib/axiomus_api/item/item.rb +7 -0
- data/lib/axiomus_api/order/base_order.rb +53 -0
- data/lib/axiomus_api/order/carry_order.rb +7 -0
- data/lib/axiomus_api/order/dpd_order.rb +11 -0
- data/lib/axiomus_api/order/ems_order.rb +12 -0
- data/lib/axiomus_api/order/export_order.rb +14 -0
- data/lib/axiomus_api/order/order.rb +8 -0
- data/lib/axiomus_api/order/post_order.rb +12 -0
- data/lib/axiomus_api/order/region_courier_order.rb +8 -0
- data/lib/axiomus_api/order/region_order.rb +8 -0
- data/lib/axiomus_api/order/region_pickup_order.rb +8 -0
- data/lib/axiomus_api/order/self_export_order.rb +15 -0
- data/lib/axiomus_api/request/order_request.rb +17 -0
- data/lib/axiomus_api/request/request.rb +10 -0
- data/lib/axiomus_api/request/status_request.rb +5 -0
- data/lib/axiomus_api/response/order_response.rb +29 -0
- data/lib/axiomus_api/response/regions_response.rb +54 -0
- data/lib/axiomus_api/response/status_response.rb +84 -0
- data/lib/axiomus_api/response_codes.rb +24 -0
- data/lib/axiomus_api/serializable.rb +55 -0
- data/lib/axiomus_api/services/export_services.rb +7 -0
- data/lib/axiomus_api/services/post_services.rb +7 -0
- data/lib/axiomus_api/services/region_services.rb +7 -0
- data/lib/axiomus_api/services/services.rb +7 -0
- data/lib/axiomus_api/session.rb +109 -0
- data/lib/axiomus_api/validated.rb +32 -0
- data/lib/axiomus_api/version.rb +3 -0
- data/lib/axiomus_api.rb +34 -0
- data/spec/factories.rb +200 -0
- data/spec/integration/axiomus_api/session_spec.rb +130 -0
- data/spec/lib/axiomus_api/base_order_spec.rb +55 -0
- data/spec/lib/axiomus_api/session_spec.rb +47 -0
- data/spec/lib/axiomus_api_spec.rb +5 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/dummy_data.rb +61 -0
- data/spec/support/http_mocking.rb +21 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0b6d53d6c8cf127838ed4317dc3b09fd527018f9
|
4
|
+
data.tar.gz: 56ea79ee658e40db0392160837f9beaa4116b90c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89295abdd43eee1f1fc84c3b784ac798b2ff14f32919bd7b2c2776ccee0b176061d83b9a840b09975b40dfa91e097c97cf28548b07ad8095ea249653f50576d3
|
7
|
+
data.tar.gz: f071141c39d1a008c4fd907f8cc07a5902905e97bcc700293b6c731b82ded1c9e48125015e0e8fe7d54bfd953ada873c545c9f02978e83d891f8e4e3c0d724ed
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.1
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
axiomus_api (0.1)
|
5
|
+
nokogiri (~> 1.6)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (4.0.4)
|
11
|
+
i18n (~> 0.6, >= 0.6.9)
|
12
|
+
minitest (~> 4.2)
|
13
|
+
multi_json (~> 1.3)
|
14
|
+
thread_safe (~> 0.1)
|
15
|
+
tzinfo (~> 0.3.37)
|
16
|
+
atomic (1.1.16)
|
17
|
+
codeclimate-test-reporter (0.3.0)
|
18
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
19
|
+
coveralls (0.7.0)
|
20
|
+
multi_json (~> 1.3)
|
21
|
+
rest-client
|
22
|
+
simplecov (>= 0.7)
|
23
|
+
term-ansicolor
|
24
|
+
thor
|
25
|
+
diff-lcs (1.2.5)
|
26
|
+
docile (1.1.3)
|
27
|
+
factory_girl (4.4.0)
|
28
|
+
activesupport (>= 3.0.0)
|
29
|
+
i18n (0.6.9)
|
30
|
+
mime-types (2.2)
|
31
|
+
mini_portile (0.5.3)
|
32
|
+
minitest (4.7.5)
|
33
|
+
multi_json (1.9.2)
|
34
|
+
nokogiri (1.6.1)
|
35
|
+
mini_portile (~> 0.5.0)
|
36
|
+
rest-client (1.6.7)
|
37
|
+
mime-types (>= 1.16)
|
38
|
+
rspec (2.14.1)
|
39
|
+
rspec-core (~> 2.14.0)
|
40
|
+
rspec-expectations (~> 2.14.0)
|
41
|
+
rspec-mocks (~> 2.14.0)
|
42
|
+
rspec-core (2.14.8)
|
43
|
+
rspec-expectations (2.14.5)
|
44
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
45
|
+
rspec-mocks (2.14.6)
|
46
|
+
simplecov (0.8.2)
|
47
|
+
docile (~> 1.1.0)
|
48
|
+
multi_json
|
49
|
+
simplecov-html (~> 0.8.0)
|
50
|
+
simplecov-html (0.8.0)
|
51
|
+
term-ansicolor (1.3.0)
|
52
|
+
tins (~> 1.0)
|
53
|
+
thor (0.19.1)
|
54
|
+
thread_safe (0.3.1)
|
55
|
+
atomic (>= 1.1.7, < 2)
|
56
|
+
tins (1.0.1)
|
57
|
+
tzinfo (0.3.39)
|
58
|
+
|
59
|
+
PLATFORMS
|
60
|
+
ruby
|
61
|
+
|
62
|
+
DEPENDENCIES
|
63
|
+
axiomus_api!
|
64
|
+
codeclimate-test-reporter
|
65
|
+
coveralls
|
66
|
+
factory_girl (~> 4.0)
|
67
|
+
rspec
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Kinderly LTD
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
# Axiomus API
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/kinderly/axiomus_api.svg)](https://travis-ci.org/kinderly/axiomus_api)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/kinderly/axiomus_api/badge.png)](https://coveralls.io/r/kinderly/axiomus_api)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/kinderly/axiomus_api.png)](https://codeclimate.com/github/kinderly/axiomus_api)
|
6
|
+
[![Dependency Status](https://gemnasium.com/kinderly/axiomus_api.svg)](https://gemnasium.com/kinderly/axiomus_api)
|
7
|
+
|
8
|
+
## Description
|
9
|
+
|
10
|
+
This is a Ruby wrapper over [Axiomus](http://www.axiomus.ru "axiomus.ru") delivery service public [API](http://www.axiomus.ru/customers/api/ "Axiomus API").
|
11
|
+
|
12
|
+
All methods exposed by the API by 2014-03-30 are implemented.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
To install this gem type the following in your command line:
|
17
|
+
```bash
|
18
|
+
gem install axiomus_api
|
19
|
+
```
|
20
|
+
If you are using Bundler add the following line to your Gemfile:
|
21
|
+
```ruby
|
22
|
+
gem 'axiomus_api'
|
23
|
+
```
|
24
|
+
|
25
|
+
If you prefer to install the most up-to-date development version, add
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
gem 'axiomus_api', git: 'git@github.com:kinderly/axiomus_api.git', branch: 'master'
|
29
|
+
```
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
To access Axiomus API you have to know two values: **oid** and **ukey**.
|
33
|
+
|
34
|
+
`AxiomusApi::Session` is a main class to communicate with API.
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
@uid = '92' # your uid goes here
|
38
|
+
@ukey = 'XXcd208495d565ef66e7dff9f98764XX' # your ukey goes here
|
39
|
+
@test = true # use test API?
|
40
|
+
@session = AxiomusApi::Session.new(@uid, @ukey, @test)
|
41
|
+
```
|
42
|
+
|
43
|
+
You can construct a test session easily (using test credentials provided by Axiomus):
|
44
|
+
```ruby
|
45
|
+
@session = AxiomusApi.test_session
|
46
|
+
```
|
47
|
+
|
48
|
+
Names of methods of `AxiomusApi::Session` are the same as those described in the [API documentation](http://www.axiomus.ru/customers/api/ "Axiomus API").
|
49
|
+
|
50
|
+
### Getting regions info
|
51
|
+
```ruby
|
52
|
+
@region_info = @session.get_regions()
|
53
|
+
```
|
54
|
+
|
55
|
+
### Creating and updating an order
|
56
|
+
|
57
|
+
To create an order you'll have to construct an order object and fill all its fields according to the documentation. Please note, that different requests use different order types.
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
# Simple delivery order ('new' and 'update' methods)
|
61
|
+
|
62
|
+
@order = AxiomusApi::Order.new
|
63
|
+
# fill order fields
|
64
|
+
@response = @session.new(@order)
|
65
|
+
#update some order fields
|
66
|
+
@response = @session.update(@order)
|
67
|
+
|
68
|
+
# Pickup order ('new_carry' and 'update_carry' methods)
|
69
|
+
@order = AxiomusApi::CarryOrder.new
|
70
|
+
# fill order fields
|
71
|
+
@response = @session.new_carry(@order)
|
72
|
+
#update some order fields
|
73
|
+
@response = @session.update_carry(@order)
|
74
|
+
```
|
75
|
+
|
76
|
+
Here's a list of session methods and their corresponding order types:
|
77
|
+
* `new`, `update` => `AxiomusApi::Order`
|
78
|
+
* `new_carry`, `update_carry` => `AxiomusApi::CarryOrder`
|
79
|
+
* `new_export`, `update_export` => `AxiomusApi::ExportOrder`
|
80
|
+
* `new_self_export`, `update_self_export` => `AxiomusApi::SelfExportOrder`
|
81
|
+
* `new_post`, `update_post` => `AxiomusApi::PostOrder`
|
82
|
+
* `new_dpd`, `update_dpd` => `AxiomusApi::DpdOrder`
|
83
|
+
* `new_ems`, `update_ems` => `AxiomusApi::EmsOrder`
|
84
|
+
* `new_region_courier`, `update_region_courier` => `AxiomusApi::RegionCourierOrder`
|
85
|
+
* `new_region_pickup`, `update_region_pickup` => `AxiomusApi::RegionPickupOrder`
|
86
|
+
|
87
|
+
You can also specify the Axiomus method as a symbol, using `AxiomusApi::Session#send_order_request` method
|
88
|
+
|
89
|
+
```ruby
|
90
|
+
# EMS order ('new_ems' and 'update_ems' methods)
|
91
|
+
@order = AxiomusApi::EmsOrder.new
|
92
|
+
# fill order fields
|
93
|
+
@response = @session.send_order_request(:new_ems, @order)
|
94
|
+
#update some order fields
|
95
|
+
@response = @session.send_order_request(:update_ems, @order)
|
96
|
+
```
|
97
|
+
|
98
|
+
Most orders use `AxiomusApi::Item` as their item type, but some don't. To safely create an item of a proper type, use `#create_item` method of your order object:
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
@order = AxiomusApi::EmsOrder.new
|
102
|
+
@my_item = @order.create_item
|
103
|
+
# set item properties
|
104
|
+
@order.items << @my_item
|
105
|
+
```
|
106
|
+
|
107
|
+
### Getting order status
|
108
|
+
```ruby
|
109
|
+
@okey = '642d208495dtgu8906e7dff9f98764da' # your okey goes here
|
110
|
+
@status = @session.status(@okey)
|
111
|
+
```
|
112
|
+
|
113
|
+
### Error handling
|
114
|
+
|
115
|
+
Before sending a request, the library will validate your order object to check for missing fields or wrong type of parameters. If there are errors, it will raise an `AxiomusApi::Errors::ValidationError` exception. List of errors can be accessed via the order's `#validation_errors` method. Please note that passing validation doesn't neccesary means the order will be accepted by Axiomus.
|
116
|
+
|
117
|
+
If any kind of order request returns with an Axiomus status other than 0, the session will raise an `AxiomusApi::Errors::RequestError` exception.
|
118
|
+
|
119
|
+
|
data/axiomus_api.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.expand_path("../lib/axiomus_api/version", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "axiomus_api"
|
5
|
+
s.version = ::AxiomusApi::VERSION
|
6
|
+
s.authors = ["Kinderly LTD"]
|
7
|
+
s.email = ["nuinuhin@gmail.com"]
|
8
|
+
s.homepage = "https://github.com/kinderly/axiomus_api"
|
9
|
+
|
10
|
+
s.summary = %q{A wrapper for Axiomus API}
|
11
|
+
s.description = %q{This gem provides a Ruby wrapper over Axiomus API.}
|
12
|
+
s.license = "MIT"
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.add_dependency('nokogiri', '~>1.6')
|
19
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative('request/request')
|
2
|
+
require_relative('request/order_request')
|
3
|
+
require_relative('request/status_request')
|
4
|
+
|
5
|
+
module AxiomusApi::Actions
|
6
|
+
ACTIONS = {
|
7
|
+
new: AxiomusApi::OrderRequest,
|
8
|
+
update: AxiomusApi::OrderRequest,
|
9
|
+
new_carry: AxiomusApi::OrderRequest,
|
10
|
+
update_carry: AxiomusApi::OrderRequest,
|
11
|
+
new_export: AxiomusApi::OrderRequest,
|
12
|
+
update_export: AxiomusApi::OrderRequest,
|
13
|
+
new_self_export: AxiomusApi::OrderRequest,
|
14
|
+
update_self_export: AxiomusApi::OrderRequest,
|
15
|
+
new_post: AxiomusApi::OrderRequest,
|
16
|
+
update_post: AxiomusApi::OrderRequest,
|
17
|
+
new_dpd: AxiomusApi::OrderRequest,
|
18
|
+
update_dpd: AxiomusApi::OrderRequest,
|
19
|
+
new_ems: AxiomusApi::OrderRequest,
|
20
|
+
update_ems: AxiomusApi::OrderRequest,
|
21
|
+
get_regions: AxiomusApi::Request,
|
22
|
+
new_region_courier: AxiomusApi::OrderRequest,
|
23
|
+
update_region_courier: AxiomusApi::OrderRequest,
|
24
|
+
new_region_pickup: AxiomusApi::OrderRequest,
|
25
|
+
update_region_pickup: AxiomusApi::OrderRequest,
|
26
|
+
status: AxiomusApi::StatusRequest
|
27
|
+
}
|
28
|
+
|
29
|
+
def create_request(mode)
|
30
|
+
ACTIONS[mode].new.tap{|req| req.mode = mode}
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require_relative('serializable')
|
2
|
+
require_relative('validated')
|
3
|
+
|
4
|
+
class AxiomusApi::Base
|
5
|
+
include AxiomusApi::Serializable
|
6
|
+
include AxiomusApi::Validated
|
7
|
+
|
8
|
+
def self.xml_element(element_name)
|
9
|
+
@xml_element = element_name
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.xml_field(*args)
|
13
|
+
options = extract_options(args)
|
14
|
+
|
15
|
+
options.keys.each do |k|
|
16
|
+
raise "Wrong attribute #{k}" if ![:xml_type, :xml_name, :optional, :type].include?(k)
|
17
|
+
end
|
18
|
+
|
19
|
+
args.each do |attr_name|
|
20
|
+
@attr_info ||= {}
|
21
|
+
@attr_info[attr_name] = options
|
22
|
+
attr_accessor attr_name
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.xml_attribute(*args)
|
27
|
+
options = extract_options(args)
|
28
|
+
args << options.merge({xml_type: :attribute})
|
29
|
+
xml_field(*args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.attribute_meta
|
33
|
+
res = superclass.respond_to?(:attribute_meta) ? superclass.attribute_meta : {}
|
34
|
+
res.merge(@attr_info || {})
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.tag_name
|
38
|
+
if @xml_element.nil?
|
39
|
+
if superclass.respond_to?(:tag_name)
|
40
|
+
superclass.tag_name
|
41
|
+
else
|
42
|
+
raise 'xml_element not specified'
|
43
|
+
end
|
44
|
+
else
|
45
|
+
@xml_element
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def tag_name
|
50
|
+
self.class.tag_name
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.extract_options(args)
|
54
|
+
if args.last.is_a?(Hash) && args.last.instance_of?(Hash)
|
55
|
+
args.pop
|
56
|
+
else
|
57
|
+
{}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def initialize
|
62
|
+
self.class.attribute_meta.each do |k, v|
|
63
|
+
if v[:type]
|
64
|
+
self.send("#{k}=".to_sym, v[:type].new)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative '../base'
|
2
|
+
require_relative '../services/services'
|
3
|
+
|
4
|
+
class AxiomusApi::BaseOrder < AxiomusApi::Base
|
5
|
+
xml_element :order
|
6
|
+
|
7
|
+
xml_field :contacts, :items
|
8
|
+
xml_field :description
|
9
|
+
xml_attribute :inner_id, :okey, optional: true
|
10
|
+
xml_attribute :name, :places
|
11
|
+
xml_field :services, type: AxiomusApi::Services
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
super
|
15
|
+
@items = []
|
16
|
+
end
|
17
|
+
|
18
|
+
def total_quantity
|
19
|
+
@items.inject(0){|sum, it| sum + it.quantity}
|
20
|
+
end
|
21
|
+
|
22
|
+
def checksum(uid)
|
23
|
+
Digest::MD5.hexdigest("#{uid}u#{@items.count}#{total_quantity}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_item
|
27
|
+
AxiomusApi::Item.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.create_by_mode(mode)
|
31
|
+
{
|
32
|
+
new: AxiomusApi::Order,
|
33
|
+
update: AxiomusApi::Order,
|
34
|
+
new_carry: AxiomusApi::CarryOrder,
|
35
|
+
update_carry: AxiomusApi::CarryOrder,
|
36
|
+
new_export: AxiomusApi::ExportOrder,
|
37
|
+
update_export: AxiomusApi::ExportOrder,
|
38
|
+
new_self_export: AxiomusApi::SelfExportOrder,
|
39
|
+
update_self_export: AxiomusApi::SelfExportOrder,
|
40
|
+
new_post: AxiomusApi::PostOrder,
|
41
|
+
update_post: AxiomusApi::PostOrder,
|
42
|
+
new_dpd: AxiomusApi::DpdOrder,
|
43
|
+
update_dpd: AxiomusApi::DpdOrder,
|
44
|
+
new_ems: AxiomusApi::EmsOrder,
|
45
|
+
update_ems: AxiomusApi::EmsOrder,
|
46
|
+
new_region_courier: AxiomusApi::RegionCourierOrder,
|
47
|
+
update_region_courier: AxiomusApi::RegionCourierOrder,
|
48
|
+
new_region_pickup: AxiomusApi::RegionPickupOrder,
|
49
|
+
update_region_pickup: AxiomusApi::RegionPickupOrder
|
50
|
+
}[mode].new
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative('base_order')
|
2
|
+
require_relative('../address/dpd_address')
|
3
|
+
require_relative('../services/post_services')
|
4
|
+
|
5
|
+
class AxiomusApi::DpdOrder < AxiomusApi::BaseOrder
|
6
|
+
|
7
|
+
xml_attribute :d_date, :b_time, :e_time, :post_type
|
8
|
+
xml_field :services, type: AxiomusApi::PostServices
|
9
|
+
xml_attribute :address, type: AxiomusApi::DpdAddress
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'base_order'
|
2
|
+
require_relative '../address/ems_address'
|
3
|
+
require_relative '../services/post_services'
|
4
|
+
|
5
|
+
class AxiomusApi::EmsOrder < AxiomusApi::BaseOrder
|
6
|
+
|
7
|
+
xml_attribute :d_date
|
8
|
+
xml_attribute :incl_delivery_sum, optional: true
|
9
|
+
xml_field :address, type: AxiomusApi::EmsAddress
|
10
|
+
xml_field :services, type: AxiomusApi::PostServices
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative 'base_order'
|
2
|
+
require_relative '../item/export_item'
|
3
|
+
require_relative '../services/export_services'
|
4
|
+
|
5
|
+
class AxiomusApi::ExportOrder < AxiomusApi::BaseOrder
|
6
|
+
|
7
|
+
xml_attribute :from_mkad, :garden_ring, optional: true
|
8
|
+
xml_attribute :export_quantity, :transit, :d_date, :b_time, :e_time, :address
|
9
|
+
xml_field :services, type: AxiomusApi::ExportServices
|
10
|
+
|
11
|
+
def create_item
|
12
|
+
AxiomusApi::ExportItem.new
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require_relative 'base_order'
|
2
|
+
require_relative '../address/post_address'
|
3
|
+
require_relative '../services/post_services'
|
4
|
+
|
5
|
+
class AxiomusApi::PostOrder < AxiomusApi::BaseOrder
|
6
|
+
#уточнить
|
7
|
+
xml_attribute :d_date, :post_type
|
8
|
+
xml_attribute :incl_delivery_sum, optional: true
|
9
|
+
xml_field :address, type: AxiomusApi::PostAddress
|
10
|
+
xml_field :services, type: AxiomusApi::PostServices
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative 'base_order'
|
2
|
+
require_relative '../services/region_services'
|
3
|
+
|
4
|
+
class AxiomusApi::RegionOrder < AxiomusApi::BaseOrder
|
5
|
+
xml_attribute :d_date, :b_time, :e_time
|
6
|
+
xml_attribute :incl_deliv_sum, optional: true
|
7
|
+
xml_field :services, type: AxiomusApi::RegionServices
|
8
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'base_order'
|
2
|
+
|
3
|
+
class AxiomusApi::SelfExportOrder < AxiomusApi::BaseOrder
|
4
|
+
|
5
|
+
xml_attribute :car, :d_date, :b_time, :e_time, :quantity
|
6
|
+
xml_field :services, optional: true
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
services = nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def services=(val); end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative 'request'
|
2
|
+
require_relative '../base_auth'
|
3
|
+
|
4
|
+
class AxiomusApi::OrderRequest < AxiomusApi::Request
|
5
|
+
xml_field :order
|
6
|
+
|
7
|
+
def prepare_checksum(uid)
|
8
|
+
if !auth.nil? && !order.nil?
|
9
|
+
auth.checksum = order.checksum(uid)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
@auth = AxiomusApi::Auth.new
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|