e_way_client 0.1.0 → 0.1.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: 41dcf6cbd4f4efaeb6ed7d5192a3ae5ebe05219a
4
- data.tar.gz: 313a0c20df81dc1ca32dc673e9a752a95366b7ed
3
+ metadata.gz: 3e658e180737871960d98e2b7160808938645c40
4
+ data.tar.gz: 41fdb507f076b856267692cb1bff2aaf72a697ab
5
5
  SHA512:
6
- metadata.gz: 76fb5c720604b59135bdbd8b41d031ae71105b505aebbc851913536cfe8b70251d374b3d99e0b2a44150a75032909371ad1f6bf58f16452fed76c5d87a1262c5
7
- data.tar.gz: 5e66413f38935b7ae90bc597ca16d524d88275ed2c2367837a4dcbd8cf8998482bde210d114672e577aa8c4a26ce3327d1f47b773857322ff90516511f1dd9f2
6
+ metadata.gz: 26fcc585b285c9cb787594ccec178478e88a58b13fb32d9f5dc1ecc8d75312869b591619b04ab95d51f5e89e85f40ac235ef4e4136a04a20cad133c826a06e77
7
+ data.tar.gz: 6bcf7cf6eaf1495acc8c6e03d9eb82e178822c71c74ada1977ea9de1fde823125351568d9423d136efe0092dfecf164a84f9a7c6d9aac514b1be46e5cc362890
data/CHANGELOG.md CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## [0.1.1] - 2017-01-09
8
+ ### Fixed
9
+ - Do not blow up if `diffgram` in XML response is missing. Return nil instead.
10
+
7
11
  ## [0.1.0] - 2016-12-31
8
12
  ### Added
9
13
  - Initial release
@@ -24,7 +24,7 @@ module EWayClient
24
24
  attribute :districts, Array[String], lazy: true, default: :default_districts
25
25
  TYPES_COUNT.times do |n|
26
26
  count = n+1
27
- attribute(:"districts#{count}", Array[String], {
27
+ attribute(:"districts#{count}", String, {
28
28
  lazy: true,
29
29
  default: :"default_districts#{count}",
30
30
  })
@@ -3,6 +3,23 @@ module EWayClient
3
3
 
4
4
  include APIClientBase::Response.module
5
5
  attribute :success, Boolean, lazy: true, default: :default_success
6
+ attribute :data, Object, lazy: true, default: :default_data
7
+
8
+ private
9
+
10
+ def default_data
11
+ raw_response.body.deep_fetch(
12
+ :"#{action_slug}_response",
13
+ :"#{action_slug}_result",
14
+ :diffgram,
15
+ :document_element,
16
+ action_slug,
17
+ ) { nil }
18
+ end
19
+
20
+ def action_slug
21
+ self.class.name.demodulize.gsub("Response", "").underscore.to_sym
22
+ end
6
23
 
7
24
  end
8
25
  end
@@ -1,21 +1,10 @@
1
1
  module EWayClient
2
2
  class QueryListBanksResponse < BaseResponse
3
3
 
4
- attribute :data, Object, lazy: true, default: :default_data
5
4
  attribute :banks, Array, lazy: true, default: :default_banks
6
5
 
7
6
  private
8
7
 
9
- def default_data
10
- raw_response.body.deep_fetch(*%i[
11
- query_list_banks_response
12
- query_list_banks_result
13
- diffgram
14
- document_element
15
- query_list_banks
16
- ])
17
- end
18
-
19
8
  def default_banks
20
9
  data.map { |hash| Bank.new(hash) }
21
10
  end
@@ -1,21 +1,10 @@
1
1
  module EWayClient
2
2
  class QueryListProvincesResponse < BaseResponse
3
3
 
4
- attribute :data, Object, lazy: true, default: :default_data
5
4
  attribute :provinces, Array, lazy: true, default: :default_provinces
6
5
 
7
6
  private
8
7
 
9
- def default_data
10
- raw_response.body.deep_fetch(*%i[
11
- query_list_provinces_response
12
- query_list_provinces_result
13
- diffgram
14
- document_element
15
- query_list_provinces
16
- ])
17
- end
18
-
19
8
  def default_provinces
20
9
  data.map { |hash| Province.new(hash) }
21
10
  end
@@ -32,7 +32,6 @@ module EWayClient
32
32
  "6006" => "Sender country is blank",
33
33
  }
34
34
 
35
- attribute :data, Object, lazy: true, default: :default_data
36
35
  attribute(:response_code, String, {
37
36
  lazy: true,
38
37
  default: :default_response_code,
@@ -44,16 +43,6 @@ module EWayClient
44
43
 
45
44
  private
46
45
 
47
- def default_data
48
- raw_response.body.deep_fetch(*%i[
49
- send_transaction_response
50
- send_transaction_result
51
- diffgram
52
- document_element
53
- send_transaction
54
- ])
55
- end
56
-
57
46
  def default_success
58
47
  response_code == SUCCESS_RESPONSE_CODE
59
48
  end
@@ -1,3 +1,3 @@
1
1
  module EWayClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: e_way_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-31 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus