nuncium 0.13.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.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.overcommit.yml +49 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +26 -0
  6. data/.ruby-gemset +1 -0
  7. data/.ruby-version +1 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/DOCS.md +133 -0
  10. data/Gemfile +6 -0
  11. data/Gemfile.lock +136 -0
  12. data/Guardfile +7 -0
  13. data/LICENSE.txt +21 -0
  14. data/README.md +281 -0
  15. data/Rakefile +6 -0
  16. data/_config.yml +1 -0
  17. data/bin/console +7 -0
  18. data/lib/nuncium.rb +87 -0
  19. data/lib/nuncium/configuration.rb +82 -0
  20. data/lib/nuncium/data_box.rb +41 -0
  21. data/lib/nuncium/data_message.rb +136 -0
  22. data/lib/nuncium/request.rb +120 -0
  23. data/lib/nuncium/response.rb +18 -0
  24. data/lib/nuncium/responses/body.rb +19 -0
  25. data/lib/nuncium/responses/data_box.rb +14 -0
  26. data/lib/nuncium/responses/db/body.rb +9 -0
  27. data/lib/nuncium/responses/db/status.rb +13 -0
  28. data/lib/nuncium/responses/dm/body.rb +9 -0
  29. data/lib/nuncium/responses/dm/status.rb +13 -0
  30. data/lib/nuncium/responses/message.rb +21 -0
  31. data/lib/nuncium/responses/messages/attachment.rb +24 -0
  32. data/lib/nuncium/responses/messages/collection.rb +29 -0
  33. data/lib/nuncium/responses/messages/delivery_info.rb +23 -0
  34. data/lib/nuncium/responses/messages/envelope.rb +23 -0
  35. data/lib/nuncium/responses/messages/event.rb +14 -0
  36. data/lib/nuncium/responses/status.rb +19 -0
  37. data/lib/nuncium/utils/errors.rb +18 -0
  38. data/lib/nuncium/version.rb +3 -0
  39. data/lib/nuncium/web_services/db_access/.gitkeep +0 -0
  40. data/lib/nuncium/web_services/db_access/change_isds_password.rb +21 -0
  41. data/lib/nuncium/web_services/db_access/get_owner_info_from_login.rb +19 -0
  42. data/lib/nuncium/web_services/db_search/check_data_box.rb +17 -0
  43. data/lib/nuncium/web_services/db_search/d_t_info.rb +17 -0
  44. data/lib/nuncium/web_services/db_search/data_box_credit_info.rb +17 -0
  45. data/lib/nuncium/web_services/db_search/find_data_box.rb +25 -0
  46. data/lib/nuncium/web_services/db_search/find_personal_data_box.rb +22 -0
  47. data/lib/nuncium/web_services/db_search/get_data_box_activity_status.rb +17 -0
  48. data/lib/nuncium/web_services/db_search/get_data_box_list.rb +20 -0
  49. data/lib/nuncium/web_services/db_search/isds_search_2.rb +18 -0
  50. data/lib/nuncium/web_services/db_search/p_d_z_info.rb +17 -0
  51. data/lib/nuncium/web_services/db_search/p_d_z_send_info.rb +17 -0
  52. data/lib/nuncium/web_services/db_search/request.rb +19 -0
  53. data/lib/nuncium/web_services/db_search/response.rb +13 -0
  54. data/lib/nuncium/web_services/dm_info/confirm_delivery.rb +17 -0
  55. data/lib/nuncium/web_services/dm_info/erase_message.rb +17 -0
  56. data/lib/nuncium/web_services/dm_info/get_delivery_info.rb +25 -0
  57. data/lib/nuncium/web_services/dm_info/get_list_of_received_messages.rb +26 -0
  58. data/lib/nuncium/web_services/dm_info/get_list_of_sent_messages.rb +26 -0
  59. data/lib/nuncium/web_services/dm_info/get_message_author.rb +17 -0
  60. data/lib/nuncium/web_services/dm_info/get_message_state_changes.rb +17 -0
  61. data/lib/nuncium/web_services/dm_info/get_signed_delivery_info.rb +17 -0
  62. data/lib/nuncium/web_services/dm_info/mark_message_as_downloaded.rb +17 -0
  63. data/lib/nuncium/web_services/dm_info/message_envelope_download.rb +25 -0
  64. data/lib/nuncium/web_services/dm_info/request.rb +19 -0
  65. data/lib/nuncium/web_services/dm_info/response.rb +13 -0
  66. data/lib/nuncium/web_services/dm_info/verify_message.rb +17 -0
  67. data/lib/nuncium/web_services/dm_operations/authenticate_message.rb +17 -0
  68. data/lib/nuncium/web_services/dm_operations/create_message.rb +30 -0
  69. data/lib/nuncium/web_services/dm_operations/create_multiple_messages.rb +30 -0
  70. data/lib/nuncium/web_services/dm_operations/message_download.rb +25 -0
  71. data/lib/nuncium/web_services/dm_operations/ping.rb +15 -0
  72. data/lib/nuncium/web_services/dm_operations/request.rb +19 -0
  73. data/lib/nuncium/web_services/dm_operations/resign_isds_document.rb +17 -0
  74. data/lib/nuncium/web_services/dm_operations/response.rb +13 -0
  75. data/lib/nuncium/web_services/dm_operations/signed_message_download.rb +17 -0
  76. data/lib/nuncium/web_services/dm_operations/signed_sent_message_download.rb +17 -0
  77. data/nuncium.gemspec +47 -0
  78. data/wercker.yml +12 -0
  79. metadata +303 -0
@@ -0,0 +1,29 @@
1
+ module Nuncium
2
+ module Responses
3
+ module Messages
4
+ class Collection < ::Nuncium::Response
5
+ attr_accessor :messages
6
+
7
+ def initialize(response)
8
+ super
9
+ @messages = load_messages
10
+ @status = ::Nuncium::Responses::Dm::Status.new(parsed_body)
11
+ end
12
+
13
+ def load_messages
14
+ return [] if results.blank?
15
+ return [::Nuncium::DataMessage.new(results)] if results.is_a?(Hash)
16
+ results.map do |result|
17
+ ::Nuncium::DataMessage.new(result)
18
+ end
19
+ end
20
+
21
+ private
22
+
23
+ def results
24
+ parsed_body['dmRecords'].try(:[], 'dmRecord')
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ module Nuncium
2
+ module Responses
3
+ module Messages
4
+ class DeliveryInfo < ::Nuncium::Response
5
+ def initialize(response)
6
+ super
7
+ end
8
+
9
+ def message
10
+ ::Nuncium::DataMessage.new(message_hash)
11
+ end
12
+
13
+ private
14
+
15
+ def message_hash
16
+ hash = parsed_body['dmDelivery']
17
+ hash['dmDm'].delete('xmlns:p')
18
+ hash
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Nuncium
2
+ module Responses
3
+ module Messages
4
+ class Envelope < ::Nuncium::Response
5
+ def initialize(response)
6
+ super
7
+ end
8
+
9
+ def message
10
+ ::Nuncium::DataMessage.new(message_hash)
11
+ end
12
+
13
+ private
14
+
15
+ def message_hash
16
+ hash = parsed_body['dmReturnedMessageEnvelope']
17
+ hash['dmDm'].delete('xmlns:p')
18
+ hash
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ module Nuncium
2
+ module Responses
3
+ module Messages
4
+ class Event < ::Nuncium::Response
5
+ attr_accessor :dmEventTime, :dmEventDescr
6
+
7
+ def initialize(hash)
8
+ @dmEventTime = hash['dmEventTime']
9
+ @dmEventDescr = hash['dmEventDescr']
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ module Nuncium
2
+ module Responses
3
+ class Status
4
+ attr_accessor :code, :message
5
+
6
+ def initialize(response)
7
+ status = response["#{namespace}Status"]
8
+ @code = status["#{namespace}StatusCode"]
9
+ @message = status["#{namespace}StatusMessage"]
10
+ end
11
+
12
+ private
13
+
14
+ def namespace
15
+ raise NotImplementedError, "#{self.class} must implement #namespace!"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ module Nuncium
2
+ class Error < StandardError; end
3
+
4
+ class ConfigNotSet < Error
5
+ def initialize(param)
6
+ msg = "Please check if you set #{param}, seems it is missing."
7
+ super(msg)
8
+ end
9
+ end
10
+
11
+ class HtmlResponseReceived < Error
12
+ def initialize(param)
13
+ msg = 'Please check if you set credentials correctly, '\
14
+ "seems like a typo or something:\n #{param}"
15
+ super(msg)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ module Nuncium
2
+ VERSION = '0.13.0'.freeze
3
+ end
@@ -0,0 +1,21 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbAccess
4
+ class ChangeIsdsPassword < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = %i[dbOldPassword dbNewPassword].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].ChangeISDSPassword do
11
+ values(xml)
12
+ end
13
+ end
14
+
15
+ def api_url
16
+ '/DS/DsManage'
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbAccess
4
+ class GetOwnerInfoFromLogin < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = [].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].GetOwnerInfoFromLogin {}
11
+ end
12
+
13
+ def api_url
14
+ '/DS/DsManage'
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class CheckDataBox < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = %i[dbID dbApproved dbExternRefNumber].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].CheckDataBox do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class DTInfo < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = [:dbId].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].DTInfo do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class DataBoxCreditInfo < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = %i[dbID ciFromDate ciTodate].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].DataBoxCreditInfo do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,25 @@
1
+ ##
2
+ # FIXME: Owner info not parsed correctly, just Hash of stuff
3
+ module Nuncium
4
+ module WebServices
5
+ module DbSearch
6
+ class FindDataBox < ::Nuncium::WebServices::DbSearch::Request
7
+ ATTRS = %i[dbID dbType ic pnFirstName pnMiddleName
8
+ pnLastName pnLastNameAtBirth firmName biDate biCity biCounty
9
+ biState adCity adStreet adNumberInStreet adNumberInMunicipality
10
+ adZipCode adState nationality email telNumber identifier
11
+ registryCode dbState dbEffectiveOVM dbOpenAddressing].freeze
12
+
13
+ attr_accessor(*ATTRS)
14
+
15
+ def body(xml)
16
+ xml[:v20].FindDataBox do
17
+ xml[:v20].dbOwnerInfo do
18
+ values(xml)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class FindPersonalDataBox < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = %i[dbID aifoIsds pnFirstName pnMiddleName pnLastName
6
+ biDate biCity biCounty biState adCode adCity adDistrict
7
+ adStreet adNumberInStreet adNumberInMunicipality
8
+ adNumberInMunicipality adZipCode adState nationality].freeze
9
+
10
+ attr_accessor(*ATTRS)
11
+
12
+ def body(xml)
13
+ xml[:v20].FindPersonalDataBox do
14
+ xml[:v20].dbOwnerInfo do
15
+ values(xml)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class GetDataBoxActivityStatus < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = %i[dbID baFrom baTo].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].GetDataBoxActivityStatus do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ ##
2
+ # I don't think this is ever going to work... that is what they provide thou...
3
+ #
4
+ module Nuncium
5
+ module WebServices
6
+ module DbSearch
7
+ class GetDataBoxList < ::Nuncium::WebServices::DbSearch::Request
8
+ ATTRS = [:dblType].freeze
9
+
10
+ attr_accessor(*ATTRS)
11
+
12
+ def body(xml)
13
+ xml[:v20].GetDataBoxList do
14
+ values(xml)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class IsdsSearch2 < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = %i[searchText searchType searchScope page pageSize
6
+ highlighting].freeze
7
+
8
+ attr_accessor(*ATTRS)
9
+
10
+ def body(xml)
11
+ xml[:v20].ISDSSearch2 do
12
+ values(xml)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class PDZInfo < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = [:PDZSender].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].PDZInfo do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class PDZSendInfo < ::Nuncium::WebServices::DbSearch::Request
5
+ ATTRS = %i[dbId PDZType].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].PDZSendInfo do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class Request < ::Nuncium::Request
5
+ def response_wrapper
6
+ ::Nuncium::WebServices::DbSearch::Response
7
+ end
8
+
9
+ def api_url
10
+ '/DS/df'
11
+ end
12
+
13
+ def xml_url
14
+ "https://isds.#{Nuncium.configuration.xml_url}/v20"
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DbSearch
4
+ class Response < ::Nuncium::Response
5
+ def initialize(response)
6
+ super
7
+ @status = ::Nuncium::Responses::Db::Status.new(parsed_body)
8
+ @body = ::Nuncium::Responses::Db::Body.new(parsed_body)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DmInfo
4
+ class ConfirmDelivery < ::Nuncium::WebServices::DmInfo::Request
5
+ ATTRS = [:dmID].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].ConfirmDelivery do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module Nuncium
2
+ module WebServices
3
+ module DmInfo
4
+ class EraseMessage < ::Nuncium::WebServices::DmInfo::Request
5
+ ATTRS = %i[dmID dmIncoming].freeze
6
+
7
+ attr_accessor(*ATTRS)
8
+
9
+ def body(xml)
10
+ xml[:v20].EraseMessage do
11
+ values(xml)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end