postal_transfers_pl 0.1.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2719f13e983aa26d079bccbd0c5832976cbeb0054d5b57f78d90ee90e34442c8
4
+ data.tar.gz: 9953c76be2796909d400e8d6387b554025bbe60455143830b4910293d9c5eb14
5
+ SHA512:
6
+ metadata.gz: 59c5396d3c6770aff4634a88ff5ecf592f503f507e9328fcdcba254de59cc69479cc0625eba17bebf01314620f341114d00703b3d88787236a8dbde0def68ced
7
+ data.tar.gz: '0988645e8a10472ad3f735ad8f8f5212e4022ba6ef670f406ab063bb239901660c09067c414714a638b2a3e62709ce6300cb6f2d524f2b1f570b222081873a56'
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ .idea
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ setup
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at michalandros@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in postal_transfers_pl.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,68 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ postal_transfers_pl (0.1.0)
5
+ savon (~> 2.11, >= 2.11.1)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ akami (1.3.1)
11
+ gyoku (>= 0.4.0)
12
+ nokogiri
13
+ builder (3.2.3)
14
+ coderay (1.1.2)
15
+ diff-lcs (1.3)
16
+ gyoku (1.3.1)
17
+ builder (>= 2.1.2)
18
+ httpi (2.4.4)
19
+ rack
20
+ socksify
21
+ method_source (0.9.2)
22
+ mini_portile2 (2.3.0)
23
+ nokogiri (1.8.5)
24
+ mini_portile2 (~> 2.3.0)
25
+ nori (2.6.0)
26
+ pry (0.12.2)
27
+ coderay (~> 1.1.0)
28
+ method_source (~> 0.9.0)
29
+ rack (2.0.6)
30
+ rake (12.3.1)
31
+ rspec (3.8.0)
32
+ rspec-core (~> 3.8.0)
33
+ rspec-expectations (~> 3.8.0)
34
+ rspec-mocks (~> 3.8.0)
35
+ rspec-core (3.8.0)
36
+ rspec-support (~> 3.8.0)
37
+ rspec-expectations (3.8.2)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.8.0)
40
+ rspec-mocks (3.8.0)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.8.0)
43
+ rspec-support (3.8.0)
44
+ savon (2.12.0)
45
+ akami (~> 1.2)
46
+ builder (>= 2.1.2)
47
+ gyoku (~> 1.2)
48
+ httpi (~> 2.3)
49
+ nokogiri (>= 1.8.1)
50
+ nori (~> 2.4)
51
+ wasabi (~> 3.4)
52
+ socksify (1.7.1)
53
+ wasabi (3.5.0)
54
+ httpi (~> 2.0)
55
+ nokogiri (>= 1.4.2)
56
+
57
+ PLATFORMS
58
+ ruby
59
+
60
+ DEPENDENCIES
61
+ bundler (~> 1.11, >= 1.11.2)
62
+ postal_transfers_pl!
63
+ pry
64
+ rake (~> 12.3, >= 12.3.1)
65
+ rspec (~> 3.4)
66
+
67
+ BUNDLED WITH
68
+ 1.16.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Michael Andros
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # PostalTransfersPl
2
+
3
+ This gem was made for the purpose of sending a mass postal order, using a properly generated csv file
4
+ windows-1250 encoded in/out, string windows-1250 or utf-8 with a bom.
5
+ Sample files provided in spec directory, good and bad (partially utf / windows encoded)
6
+ Sample responses for main methods also provided with tests.
7
+ It wraps most of the available soap api methods regarding PPE services. (https://www.pzw.poczta-polska.pl/mkpwww/Uslugi/ObslugaPakietow.wsdl)
8
+ All methods to run a successful csv bulk postal order creation and payment monitoring afterwards.
9
+ Also it contains a 'automated' method triggered after the creation of the order,
10
+ that if succeeds orders tracking of payment in the postal system for further monitoring,
11
+ if fails either raises errors (http or soap with messages) or reads generated error reports file on the api side.
12
+ Regardless all returned at the end (unless raised errors).
13
+ Every single method can be run separately with similar outcomes.
14
+
15
+ ## Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ ```ruby
20
+ gem 'postal_transfers_pl'
21
+ ```
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install postal_transfers_pl
30
+
31
+ When bundled, set up a initializer to provide CLIENT CREDENTIALS
32
+
33
+ Simply create a polish_post_pl.rb file in the initializers directory, and set it up like this:
34
+
35
+ ```ruby
36
+ PostalTransfersPl::Client.configure do |c|
37
+ c.wsdl = ENV['PTP_WSDL'] - 'the wsdl address'
38
+ c.namespace = ENV['PTP_NAMESPACE'] - 'methods namespacing (string converted to symbol in gem)'
39
+ c.namespace_uri = ENV['PTP_NAMESPACE_URI'] - 'the uri used in namespaces'
40
+ c.user = ENV['PTP_USER'] - 'User/login same as in web)'
41
+ c.password = ENV['PTP_PASSWORD'] - 'Password (same as in web)'
42
+ c.track = ENV['PTP_TRACK'] - 'the SOAP method to track data You need (string converted to symbol in gem)'
43
+ c.create = ENV['PTP_CREATE'] - 'the SOAP method to create mass order You need (string converted to symbol in gem)'
44
+ c.delete = ENV['PTP_DELETE'] - 'the SOAP method to delete order (string converted to symbol in gem)'
45
+ c.confirm = ENV['PTP_CONFIRM'] - 'the SOAP method to confirm order (string converted to symbol in gem)'
46
+ c.payment_tracking_trigger = ENV['PTP_PAYMENT_TRACKING_TRIGGER'] - 'the SOAP method to trigger payment tracking for new order (string converted to symbol in gem)'
47
+ c.payment_tracking = ENV['PTP_PAYMENT_TRACKING'] - 'the SOAP method to check payment tracking for order (string converted to symbol in gem)'
48
+ c.list_documents = ENV['PTP_LIST_DOCUMENTS'] - 'the SOAP method to list all generated documents aside order (needed if failed to create) (string converted to symbol in gem)'
49
+ c.read_document = ENV['PTP_READ_DOCUMENT'] - 'the SOAP method to read generated document regarding csv file errors for order (needed if failed to create) (string converted to symbol in gem)'
50
+ c.ssl_version = ENV['PTP_SSL_VERSION'] - 'the version of TLS used by server You are connecting to'
51
+ end
52
+ ```
53
+ If no initializer is provided exception will be raised. In this example I store all my credentialsin env variables.
54
+
55
+ ## Usage
56
+
57
+ Set of examples for PostalTransfersPl::Client methods responses
58
+
59
+ ```ruby
60
+ PostalTransfersPl::Client.track_mass_order(id: 'uip')
61
+ ```
62
+ example success response :
63
+ ```ruby
64
+ {
65
+ :uip=>"B123456789123456789012",
66
+ :data_utworzenia=>"2000-12-31T00:00:00+00:00",
67
+ :nazwa_pliku=>"001231_120001_client.csv",
68
+ :numer_umowy=>"ID 123456/A",
69
+ :procent_opustu=>"0.00",
70
+ :stan=>"ZweryfikowanyOczekujacyNaZatwierdzenie",
71
+ :usluga=>"PPE",
72
+ :"@xmlns:i"=>"http://www.w3.org/2001/XMLSchema-instance"
73
+ }
74
+ ```
75
+
76
+ ```ruby
77
+ PostalTransfersPl::Client.payment_tracking(id: 'uip')
78
+ ```
79
+ example success response :
80
+ ```ruby
81
+ {
82
+ :opis_stan_pakietu=>"Zarejestrowany",
83
+ :stan=>"BrakWplaty",
84
+ :"@xmlns:i"=>"http://www.w3.org/2001/XMLSchema-instance"
85
+ }
86
+ ```
87
+ example partialy failed response - the tracking was triggered too early ( order in creation in the api )
88
+ Easy to fix just rerun the method in a couple of minutes ;)
89
+ ```ruby
90
+ {
91
+ :stan=>"BrakPakietu",
92
+ :"@xmlns:i"=>"http://www.w3.org/2001/XMLSchema-instance"
93
+ }
94
+ ```
95
+
96
+ ```ruby
97
+ PostalTransfersPl::Client.create_mass_order(service_name: 'PPE', file_path: 'path to file / or url', auto_approve: false)
98
+ ```
99
+ example success response :
100
+ ```ruby
101
+ {
102
+ :uip=>"B1234567890123456789012",
103
+ :data_graniczna_wplaty=>"2000-12-31T00:00:00+00:00",
104
+ :data_utworzenia=>"2000-12-28T00:00:00+00:00",
105
+ :liczba_przekazow_poprawnych=>"1",
106
+ :nazwa_pliku=>"001228_155346_user.csv",
107
+ :numer_rachunku_bankowego_wplaty=>"66 1234 5678 9101 1001 0000 1111",
108
+ :numer_umowy=>"ID 123456/A",
109
+ :oplata_za_nadanie=>"5.47",
110
+ :procent_opustu=>"0.00",
111
+ :stan=>"Zamkniety",
112
+ :usluga=>"PPE",
113
+ :wartosc_przekazow_poprawnych=>"46.82",
114
+ :"@xmlns:i"=>"http://www.w3.org/2001/XMLSchema-instance"
115
+ }
116
+ ```
117
+ example fail response for creation - when file is bad, parsed from error report file from the api side
118
+ ```ruby
119
+ {
120
+ error: "\r\n Raport Kontroli Formalnej\r\n\r\nNazwa pliku: 181231_123055_useraaa.csv \r\nGrupa kontrahent\xF3w: R\xF3\xBFne \r\nKontrahent: XXXXXXX Sp.z o.o. Numer: 0000001757\r\nWynik kontroli: Plik niepoprawny\r\n-------------------------------------------------------------------------------\r\nStwierdzone b\xB3\xEAdy:\r\n\r\nOpis nag\xB3\xF3wka w linii 1:\r\n > Dla kolumny o nr 2/B jej opis powinien by\xE6 r\xF3wny Us\xB3uga\r\n\r\nData wygenerowania dokumentu 29-11-2018.\r\nDokument zosta\xB3 wygenerowany elektronicznie i nie wymaga podpisu ani stempla."
121
+ }
122
+ ```
123
+
124
+ example fail responses - most cases:
125
+
126
+ invalid id provided or no id provided
127
+
128
+ ```ruby
129
+ RuntimeError || ArgumentError
130
+ ```
131
+ invalid file when creating or http errors
132
+
133
+ ```ruby
134
+ Savon::SOAPFault || Savon::HTTPError
135
+ ```
136
+
137
+ ALL other methods come with a simple hash response or raise one of the common errors.
138
+
139
+ ## Development
140
+
141
+ run rspec for tests.
142
+
143
+ ## Contributing
144
+
145
+ Bug reports and pull requests are welcome on GitHub at https://github.com/justcodeio/postal_transfers_pl.
146
+ 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.
147
+ Feel free to fork and expand it to Your needs !
148
+
149
+ ## License
150
+
151
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "postal_transfers_pl"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module PostalTransfersPl
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,138 @@
1
+ require 'postal_transfers_pl/version'
2
+ require 'savon'
3
+ require 'pry'
4
+
5
+ module PostalTransfersPl
6
+ class Client
7
+ attr_accessor :client
8
+
9
+ class << self
10
+ attr_accessor :configuration, :response, :error_report
11
+ end
12
+
13
+ def self.configure
14
+ self.configuration ||= Configuration.new
15
+ yield(configuration)
16
+ end
17
+
18
+ class Configuration
19
+ attr_accessor :wsdl, :namespace_uri, :namespace,
20
+ :list_documents, :read_document,
21
+ :payment_tracking_trigger, :payment_tracking,
22
+ :user, :password, :track, :create,
23
+ :delete, :confirm, :ssl_version
24
+
25
+ def initialize
26
+ @wsdl = nil
27
+ @namespace = nil
28
+ @namespace_uri = nil
29
+ @user = nil
30
+ @password = nil
31
+ @track = nil
32
+ @create = nil
33
+ @delete = nil
34
+ @confirm = nil
35
+ @payment_tracking_trigger = nil
36
+ @payment_tracking = nil
37
+ @list_documents = nil
38
+ @read_document = nil
39
+ @ssl_version = nil
40
+ end
41
+ end
42
+
43
+ def initialize
44
+ raise 'No configuration credentials provided !' if PostalTransfersPl::Client.configuration.blank?
45
+ @client = Savon.client(
46
+ wsdl: PostalTransfersPl::Client.configuration.wsdl,
47
+ ssl_version: PostalTransfersPl::Client.configuration.ssl_version.to_sym,
48
+ log: true,
49
+ pretty_print_xml: true,
50
+ namespace_identifier: PostalTransfersPl::Client.configuration.namespace.to_sym,
51
+ namespaces: {"xmlns:#{PostalTransfersPl::Client.configuration.namespace}" => PostalTransfersPl::Client.configuration.namespace_uri},
52
+ wsse_auth: [PostalTransfersPl::Client.configuration.user, PostalTransfersPl::Client.configuration.password],
53
+ headers: {'Content-Type' => 'text/xml;charset=utf-8;'}
54
+ )
55
+ end
56
+
57
+ def self.track_mass_order(id:)
58
+ self.new.client.call(
59
+ PostalTransfersPl::Client.configuration.track.to_sym,
60
+ message: { 'v1:UIP' => id }
61
+ ).to_hash.fetch((PostalTransfersPl::Client.configuration.track.to_s + '_response').to_sym).fetch(:pakiet)
62
+ end
63
+
64
+ def self.payment_tracking(id:)
65
+ self.trigger_payment_tracking(id: id)
66
+ self.new.client.call(
67
+ PostalTransfersPl::Client.configuration.payment_tracking.to_sym,
68
+ message: { 'v1:UIP' => id }
69
+ ).to_hash.fetch((PostalTransfersPl::Client.configuration.payment_tracking.to_s + '_response').to_sym).fetch(:stan_oplacenia_pakietu)
70
+ end
71
+
72
+ def self.create_mass_order(service_name:, file_path:, auto_approve: false)
73
+ file_name = File.basename(URI.parse(file_path).path)
74
+ base = Base64.encode64(open(file_path).read)
75
+ resp = self.new.client.call(
76
+ PostalTransfersPl::Client.configuration.create.to_sym,
77
+ message: { 'v1:RodzajUslugi' => service_name, 'v1:NazwaPliku' => file_name, 'v1:ZawartoscPliku' => base, 'v1:ZatwierdzenieAutomatyczne' => auto_approve }
78
+ ).to_hash.fetch((PostalTransfersPl::Client.configuration.create.to_s + '_response').to_sym)
79
+ self.confirm_or_destroy_mass_order(id: resp.fetch(:uip))
80
+ end
81
+
82
+ def self.confirm_or_destroy_mass_order(id:)
83
+ @response = self.track_mass_order(id: id)
84
+ case response.fetch(:stan)
85
+ when 'OdrzuconyZPowoduBleduWeryfikacji', 'NIEOBSLUGIWANY'
86
+ self.destroy_mass_order(id: id)
87
+ when 'UtworzonyCzekaNaWeryfikacjeMKP'
88
+ sleep 5
89
+ self.confirm_or_destroy_mass_order(id: id)
90
+ when 'ZweryfikowanyOczekujacyNaZatwierdzenie'
91
+ self.confirm_mass_order(id: id)
92
+ else
93
+ @error_report = 'File is invalid!'
94
+ end
95
+ error_report.blank? ? response : { error: error_report }
96
+ end
97
+
98
+ def self.destroy_mass_order(id:)
99
+ doc = self.list_documents(id: id)[:opis_dokumentu]
100
+ doc_id = doc[:identyfikator]
101
+ @error_report = doc_id.blank? ? nil : Base64.decode64(self.read_document(id: doc_id))
102
+ self.new.client.call(
103
+ PostalTransfersPl::Client.configuration.delete.to_sym,
104
+ message: { 'v1:UIP' => id }
105
+ )
106
+ end
107
+
108
+ def self.confirm_mass_order(id:)
109
+ self.new.client.call(
110
+ PostalTransfersPl::Client.configuration.confirm.to_sym,
111
+ message: { 'v1:UIP' => id }
112
+ )
113
+ @response = self.track_mass_order(id: id)
114
+ self.trigger_payment_tracking(id: id)
115
+ end
116
+
117
+ def self.trigger_payment_tracking(id:)
118
+ self.new.client.call(
119
+ PostalTransfersPl::Client.configuration.payment_tracking_trigger.to_sym,
120
+ message: { 'v1:UIP' => id }
121
+ )
122
+ end
123
+
124
+ def self.list_documents(id:)
125
+ self.new.client.call(
126
+ PostalTransfersPl::Client.configuration.list_documents.to_sym,
127
+ message: { 'v1:UIP' => id }
128
+ ).to_hash.fetch((PostalTransfersPl::Client.configuration.list_documents.to_s + '_response').to_sym).fetch(:lista_dokumentow)
129
+ end
130
+
131
+ def self.read_document(id:)
132
+ self.new.client.call(
133
+ PostalTransfersPl::Client.configuration.read_document.to_sym,
134
+ message: { 'v1:IdentyfikatorDokumentu' => id }
135
+ ).to_hash.fetch((PostalTransfersPl::Client.configuration.read_document.to_s + '_response').to_sym).fetch(:zawartosc_dokumentu)
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,29 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "postal_transfers_pl/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'postal_transfers_pl'
8
+ spec.version = PostalTransfersPl::VERSION
9
+ spec.authors = ['Filip Stybel', 'Michal Andros']
10
+ spec.email = ['filip.stybel@justcode.io', 'michalandros@gmail.com']
11
+
12
+ spec.summary = %q{Send mass postal orders using a csv via Polish Post Office API}
13
+ spec.description = %q{Send mass postal orders using a csv via Polish Post Office API, create and check for mass postal orders statuses via the API relay}
14
+ spec.homepage = 'https://github.com/justcodeio/postal_transfers_pl'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.11', '>= 1.11.2'
25
+ spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.1'
26
+ spec.add_development_dependency 'rspec', '~> 3.4'
27
+ spec.add_development_dependency 'pry'
28
+ spec.add_runtime_dependency 'savon', '~> 2.11', '>= 2.11.1'
29
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: postal_transfers_pl
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Filip Stybel
8
+ - Michal Andros
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2018-11-30 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.11'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.11.2
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - "~>"
29
+ - !ruby/object:Gem::Version
30
+ version: '1.11'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.11.2
34
+ - !ruby/object:Gem::Dependency
35
+ name: rake
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.3'
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 12.3.1
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: '12.3'
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 12.3.1
54
+ - !ruby/object:Gem::Dependency
55
+ name: rspec
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.4'
61
+ type: :development
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.4'
68
+ - !ruby/object:Gem::Dependency
69
+ name: pry
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: savon
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.11'
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 2.11.1
92
+ type: :runtime
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '2.11'
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: 2.11.1
102
+ description: Send mass postal orders using a csv via Polish Post Office API, create
103
+ and check for mass postal orders statuses via the API relay
104
+ email:
105
+ - filip.stybel@justcode.io
106
+ - michalandros@gmail.com
107
+ executables: []
108
+ extensions: []
109
+ extra_rdoc_files: []
110
+ files:
111
+ - ".gitignore"
112
+ - ".rspec"
113
+ - ".travis.yml"
114
+ - CODE_OF_CONDUCT.md
115
+ - Gemfile
116
+ - Gemfile.lock
117
+ - LICENSE.txt
118
+ - README.md
119
+ - Rakefile
120
+ - bin/console
121
+ - bin/setup
122
+ - lib/postal_transfers_pl.rb
123
+ - lib/postal_transfers_pl/version.rb
124
+ - postal_transfers_pl.gemspec
125
+ homepage: https://github.com/justcodeio/postal_transfers_pl
126
+ licenses:
127
+ - MIT
128
+ metadata: {}
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 2.7.8
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Send mass postal orders using a csv via Polish Post Office API
149
+ test_files: []