russianpost 0.4.3 → 0.4.4
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/README.md +4 -2
- data/lib/russianpost/country_factory.rb +18 -0
- data/lib/russianpost/operations_factory.rb +4 -6
- data/lib/russianpost/version.rb +1 -1
- data/russianpost.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 595a6fbe6c70c7bf03e14593ead155e90ff97a43
|
4
|
+
data.tar.gz: decf63446a5161e4af60fdea6b45e133eb8d2eda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0805d8eb588ffb9fdd532a3108fb460450ba34a7d930f0a605935400a5c4d1b36d941748def570b6ac188b8b984bf0bef84327adffa8dbc63ad13bb8a2973136
|
7
|
+
data.tar.gz: 10b56196608dcac4ba2718bdbc28bfbbe97e992f3591ea68afb228a68e52fda0ff9479ec3af4fa3e3dfdf48ad922926fc784a74598f686b96394544f17954eed
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/artemshitov/russianpost) [](https://codeclimate.com/github/artemshitov/russianpost)
|
4
4
|
|
5
|
-
Ruby
|
5
|
+
Ruby client for Russian Post package tracking SOAP API. Works on a per-package basis (contrary to the bulk ticket-based API). The client tries to be smart and fills gaps in the information provided by Russian Post using external knowledge.
|
6
|
+
|
7
|
+
Use it at your own risk, since the API may appear unstable and require authorization in future.
|
6
8
|
|
7
9
|
## Installation
|
8
10
|
|
@@ -12,7 +14,7 @@ To install gem stand-alone:
|
|
12
14
|
|
13
15
|
To use gem in a Rails app, add the following to your `Gemfile`:
|
14
16
|
|
15
|
-
gem "russianpost", "~> 0.4.
|
17
|
+
gem "russianpost", "~> 0.4.4"
|
16
18
|
|
17
19
|
This gem uses [Savon](http://savonrb.com/), which in turn uses [HTTPI](https://github.com/savonrb/httpi) internally. HTTPI chooses the best HTTP library of those you have installed. For the fastest results, make sure you add [Curb](https://github.com/taf2/curb) to your `Gemfile`:
|
18
20
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "iso3166_ru"
|
2
|
+
require "russianpost/operation"
|
3
|
+
|
4
|
+
module RussianPost
|
5
|
+
module CountryFactory
|
6
|
+
def self.build(country_config, opts = {})
|
7
|
+
country_list = opts[:country_list] || Iso3166Ru::CountryList.new
|
8
|
+
proxy = country_list.find_by(iso: country_config[:id])
|
9
|
+
|
10
|
+
RussianPost::Country.new(
|
11
|
+
proxy.iso.to_i,
|
12
|
+
proxy.alpha2,
|
13
|
+
proxy.alpha3,
|
14
|
+
proxy.name,
|
15
|
+
proxy.english)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,9 +1,12 @@
|
|
1
|
+
require "iso3166_ru"
|
1
2
|
require "russianpost/operation"
|
3
|
+
require "russianpost/country_factory"
|
2
4
|
|
3
5
|
module RussianPost
|
4
6
|
module OperationsFactory
|
5
7
|
class << self
|
6
8
|
def build(operations_hash)
|
9
|
+
@country_list = Iso3166Ru::CountryList.new
|
7
10
|
operations_hash.map { |o| build_operation(o) }
|
8
11
|
end
|
9
12
|
|
@@ -50,12 +53,7 @@ module RussianPost
|
|
50
53
|
|
51
54
|
def process_country(key, value)
|
52
55
|
if [:mail_direct, :country_from, :country_oper].include? key
|
53
|
-
RussianPost::
|
54
|
-
value[:id] ? value[:id].to_i : nil,
|
55
|
-
value[:code_2a],
|
56
|
-
value[:code_3a],
|
57
|
-
value[:name_ru],
|
58
|
-
value[:name_en])
|
56
|
+
RussianPost::CountryFactory.build(value, country_list: @country_list)
|
59
57
|
end
|
60
58
|
end
|
61
59
|
|
data/lib/russianpost/version.rb
CHANGED
data/russianpost.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: russianpost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Shitov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: iso3166_ru
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.1.1
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.1.1
|
83
97
|
description: Thin wrapper around Russian Post package tracking SOAP API. Works on
|
84
98
|
a per-package basis (contrary to the bulk ticket-based API). Use it at your own
|
85
99
|
risk, since the API may appear unstable and require authorization in future.
|
@@ -99,6 +113,7 @@ files:
|
|
99
113
|
- lib/russianpost/barcode.rb
|
100
114
|
- lib/russianpost/barcode_validator.rb
|
101
115
|
- lib/russianpost/client.rb
|
116
|
+
- lib/russianpost/country_factory.rb
|
102
117
|
- lib/russianpost/operation.rb
|
103
118
|
- lib/russianpost/operations_factory.rb
|
104
119
|
- lib/russianpost/parcel.rb
|