ruby_isds 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a999d47b522dec4ef7976e3073d3c2cfbf5d7b9b
4
- data.tar.gz: a0966c93baf6bc5c4c25aa75fb7e04b846ecc286
3
+ metadata.gz: ad64d0bfcc0375d527b372fa7d29e81d34da9e67
4
+ data.tar.gz: bbdf2f25282f94562f4ac4ee6ef843912b26bc08
5
5
  SHA512:
6
- metadata.gz: 95284c717024822d02ab7fd283cdd02fedcc2bf1bd3a4a1a7030e0cee48644d0045b9f5d76bb11c9c0ef6d1f48627a3aa4276f8d1cda865a3c7a51cd82548071
7
- data.tar.gz: 650cb369e47ccfac8fd7c45a9abdad7e823ec5418825457ba0f6db33ff7aee542dfa1311f6e998cbcbaa85503ecfae0e12517e84f73c0e779595da6450ec5078
6
+ metadata.gz: 43369198013fdc412de39051abfb720e2c931112c451d4ec9fa5d5942397da96575b68ac8db41d679e62914fed6228411693b84050bdf16e9ad3981b6711aef3
7
+ data.tar.gz: b9142ffc4070d676b19e89ddd73ae11fc9961fc950bb3f4821ddff29372a8d0d379aa2efcef3019ff0a0226a43b9b8a285e444f4f73b887b6d1f5f539fd19da7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_isds (0.9.0)
4
+ ruby_isds (0.9.1)
5
5
  activesupport
6
6
  nokogiri
7
7
 
@@ -55,7 +55,7 @@ GEM
55
55
  mini_portile2 (2.3.0)
56
56
  minitest (5.11.3)
57
57
  nenv (0.3.0)
58
- nokogiri (1.8.2)
58
+ nokogiri (1.8.4)
59
59
  mini_portile2 (~> 2.3.0)
60
60
  notiffany (0.1.1)
61
61
  nenv (~> 0.1)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Work in Progress
2
2
 
3
- # RubyIsds [![wercker status](https://app.wercker.com/status/04043d3ae16228db7dc8d9d3ae51d1e6/s/master "wercker status")](https://app.wercker.com/project/byKey/04043d3ae16228db7dc8d9d3ae51d1e6)
3
+ # RubyIsds [![wercker status](https://app.wercker.com/status/04043d3ae16228db7dc8d9d3ae51d1e6/s/master "wercker status")](https://app.wercker.com/project/byKey/04043d3ae16228db7dc8d9d3ae51d1e6) [![Maintainability](https://api.codeclimate.com/v1/badges/eb20cde530fb8d1690cd/maintainability)](https://codeclimate.com/github/redrick/ruby_isds/maintainability)
4
4
 
5
5
  Wrapper for API love [ISDS](https://www.datoveschranky.info/) shares with us through this XML API.
6
6
 
@@ -85,16 +85,108 @@ checking the status
85
85
  ```
86
86
 
87
87
 
88
- #### .find
88
+ #### .find_by
89
+
90
+ You can find any data box by searching like so:
91
+
92
+ ```ruby
93
+ > RubyIsds::DataBox.find_by(dbType: 'FO', pnLastName: 'Anta')
94
+
95
+ => #<RubyIsds::WebServices::DbSearch::Response:0x00007f9986b4c090
96
+ @body=#<RubyIsds::Responses::Db::Body:0x00007f9987823f98 @dbResults=false>,
97
+ @response=
98
+ {"Envelope"=>
99
+ {"xmlns:SOAP_ENV"=>"http://schemas.xmlsoap.org/soap/envelope/",
100
+ "xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
101
+ "Body"=>
102
+ {"FindDataBoxResponse"=>
103
+ {"xmlns:p"=>"http://isds.czechpoint.cz/v20",
104
+ "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance",
105
+ "dbResults"=>
106
+ {"dbOwnerInfo"=>
107
+ {"dbID"=>"mxbf8u6",
108
+ "dbType"=>"FO",
109
+ "ic"=>{"xsi:nil"=>"true"},
110
+ "pnFirstName"=>"Andrej",
111
+ "pnMiddleName"=>{"xsi:nil"=>"true"},
112
+ "pnLastName"=>"Antaš",
113
+ "pnLastNameAtBirth"=>{"xsi:nil"=>"true"},
114
+ "firmName"=>{"xsi:nil"=>"true"},
115
+ "biDate"=>"1990-01-16",
116
+ "biCity"=>"*",
117
+ "biCounty"=>"*",
118
+ "biState"=>"*",
119
+ "adCity"=>"Praha 5",
120
+ "adStreet"=>"Pekařská",
121
+ "adNumberInStreet"=>"10a",
122
+ "adNumberInMunicipality"=>"695",
123
+ "adZipCode"=>"15500",
124
+ "adState"=>"CZ",
125
+ "nationality"=>"*",
126
+ "identifier"=>{"xsi:nil"=>"true"},
127
+ "registryCode"=>{"xsi:nil"=>"true"},
128
+ "dbState"=>"1",
129
+ "dbEffectiveOVM"=>"false",
130
+ "dbOpenAddressing"=>"true"}},
131
+ "dbStatus"=>{"dbStatusCode"=>"0000", "dbStatusMessage"=>"Provedeno úspěšně."}}}}},
132
+ @status=#<RubyIsds::Responses::Db::Status:0x00007f9987828c50 @code="0000", @message="Provedeno úspěšně.">>
133
+ ```
89
134
 
90
135
  #### .credit_info
91
136
 
137
+ For checking your balance (post messages need payments), so you can make sure you have enough before sending a message:
138
+
139
+ ```ruby
140
+ > RubyIsds::DataBox.credit_info
141
+
142
+ => #<RubyIsds::WebServices::DbSearch::Response:0x00007f8dd69b6e08
143
+ @body=#<RubyIsds::Responses::Db::Body:0x00007f8dd699c1e8 @ciRecords=nil, @currentCredit="596400", @notifEmail=nil>,
144
+ @response=
145
+ {"Envelope"=>
146
+ {"xmlns:SOAP_ENV"=>"http://schemas.xmlsoap.org/soap/envelope/",
147
+ "xmlns:xsd"=>"http://www.w3.org/2001/XMLSchema",
148
+ "Body"=>{"DataBoxCreditInfoResponse"=>{"xmlns:p"=>"http://isds.czechpoint.cz/v20", "xmlns:xsi"=>"http://www.w3.org/2001/XMLSchema-instance", "currentCredit"=>"596400", "notifEmail"=>{"xsi:nil"=>"true"}, "ciRecords"=>nil, "dbStatus"=>{"dbStatusCode"=>"0000", "dbStatusMessage"=>"Provedeno úspěšně."}}}}},
149
+ @status=#<RubyIsds::Responses::Db::Status:0x00007f8dd699c3a0 @code="0000", @message="Provedeno úspěšně.">>
150
+ ```
151
+
92
152
  #### .received
93
153
 
154
+ Listing all received messages:
155
+
156
+ ```ruby
157
+ > RubyIsds::DataBox.received
158
+
159
+ => #<RubyIsds::Responses::Messages::Collection:0x00007f99882e6048
160
+ @messages=
161
+ [
162
+ ...
163
+ ],
164
+ @status=#<RubyIsds::Responses::Dm::Status:0x00007f9986c26718 @code="0000", @message="Provedeno úspěšně.">>
165
+ ```
166
+
167
+ Message responses are stubbed here in response, will be explain down in DataMessage docs
168
+
94
169
  #### .sent
95
170
 
171
+
172
+ Listing all received messages:
173
+
174
+ ```ruby
175
+ > RubyIsds::DataBox.sent
176
+
177
+ => #<RubyIsds::Responses::Messages::Collection:0x00007f99882e6048
178
+ @messages=
179
+ [
180
+ ...
181
+ ],
182
+ @status=#<RubyIsds::Responses::Dm::Status:0x00007f9986c26718 @code="0000", @message="Provedeno úspěšně.">>
183
+ ```
184
+
185
+ Message responses are stubbed here in response, will be explain down in DataMessage docs
186
+
96
187
  #### .state_changes
97
188
 
189
+ TODO
98
190
 
99
191
  ### RubyIsds::DataMessage
100
192
 
@@ -26,10 +26,10 @@ module RubyIsds
26
26
 
27
27
  def initialize(params = {})
28
28
  @params = params.dup
29
- status_info = @params.delete('dmDm')
29
+ @status_info = @params.delete('dmDm')
30
30
  @dmAttachments = load_attachments
31
31
  @dmEvents = load_events
32
- unified_params = status_info ? status_info.merge(@params) : params
32
+ unified_params = @status_info ? @status_info.merge(@params) : params
33
33
  unified_params.each do |key, value|
34
34
  raise "Not valid attribute of DataMessage #{key}" unless ATTRIBUTES.include?(key)
35
35
  instance_variable_set("@#{key}", parsed_value(value))
@@ -104,8 +104,8 @@ module RubyIsds
104
104
  end
105
105
 
106
106
  def load_attachments
107
- return {} if @params['dmFiles'].blank?
108
- attachments_hash = @params.delete('dmFiles')['dmFile']
107
+ return {} if @status_info&.dig('dmFiles').blank?
108
+ attachments_hash = @status_info.delete('dmFiles')['dmFile']
109
109
  if attachments_hash.is_a?(Array)
110
110
  attachments_hash.map do |attachment|
111
111
  ::RubyIsds::Responses::Messages::Attachment.new(attachment)
@@ -1,3 +1,3 @@
1
1
  module RubyIsds
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_isds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrej Antas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2018-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler