bluepan_client 0.2.0 → 0.3.0

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: d3dc8657dca27304e3a13e968527b7babe145533
4
- data.tar.gz: 658d2b82099fbcbdec38e8286e6068a6391215cf
3
+ metadata.gz: 835660a6a72842d94ec8adf908185ef7e21cde23
4
+ data.tar.gz: 5fd3cc2cea70e7ebe8d7d0f5e6df83f32f9facdd
5
5
  SHA512:
6
- metadata.gz: ca313d3006e576d732e16b5a21a23f1f5d92f2953897b64e6375efa31642351771dc75bc0576baf82bfdd4bb563721657d1c86cbb27c7be3c9ea7b978d3ab5bd
7
- data.tar.gz: 82130e7d55dad24fd16f38279583590945f0e13bd52ded86c20a15d0ca2cda717e7812cedf7f748701dfe3abe52b8764e06e83426bc3e08c5d5d42fe20976591
6
+ metadata.gz: 15b91d9c9ed0eb9169d63727585cc22fe1c991fdbc03a91b618b0c08082fd749b030173703210942a5e03fd1a4b1f443d40434a9826e22227fa08f94740222fb
7
+ data.tar.gz: 3cf7fab0ebc60658e5578983631de647be1eaa3fd5798fefd5f1c0f92e56878b4d19c57291346465f4a7d9d75ff8d238593a9f7c073c0503c501d8dcbfaa9597
@@ -4,6 +4,12 @@ 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.3.0] - 2016-11-15
8
+ ### Added
9
+ - Add ability to get error messages in responses
10
+ - Add `bluepan_client_recipient` factory
11
+ - Make `CreateRemittanceResponse`'s `remittance` and `recipient` are lazily evaluated
12
+
7
13
  ## [0.2.0] - 2016-11-14
8
14
  ### Added
9
15
  - Add factory for BluepanClient::Strategy
@@ -13,6 +13,14 @@ FactoryGirl.define do
13
13
  cityname_cn "Chinese Name"
14
14
  end
15
15
 
16
+ factory :bluepan_client_recipient, class: "BluepanClient::Recipient" do
17
+ sequence(:recipientseq) { |n| n }
18
+ firstname "Testy"
19
+ lastname "McTestface"
20
+ mobile "+839199299111"
21
+ email "testy@mctest.face"
22
+ end
23
+
16
24
  factory :bluepan_client_strategy, class: "BluepanClient::Strategy" do
17
25
  sequence(:strategyseq) { |n| n }
18
26
  currency { %w(KRW CNY).sample }
@@ -9,6 +9,7 @@ module BluepanClient
9
9
  default: :default_parsed_body,
10
10
  })
11
11
  attribute :success, Boolean, lazy: true, default: :default_success
12
+ attribute :error_message, String, lazy: true, default: :default_error_message
12
13
 
13
14
  private
14
15
 
@@ -24,6 +25,14 @@ module BluepanClient
24
25
 
25
26
  def default_parsed_body
26
27
  JSON.parse(body)
28
+ rescue JSON::ParserError
29
+ nil
30
+ end
31
+
32
+ def default_error_message
33
+ return nil if success?
34
+ return parsed_body[:error] if parsed_body.present? && parsed_body[:error]
35
+ "Status: #{raw_response.code}; Error message not found in `#{body}`"
27
36
  end
28
37
 
29
38
  end
@@ -1,8 +1,8 @@
1
1
  module BluepanClient
2
2
  class CreateRemittanceResponse < BaseResponse
3
3
 
4
- attribute :remittance, Object, default: :default_remittance
5
- attribute :recipient, Object, default: :default_recipient
4
+ attribute :remittance, Object, lazy: true, default: :default_remittance
5
+ attribute :recipient, Object, lazy: true, default: :default_recipient
6
6
 
7
7
  private
8
8
 
@@ -1,3 +1,3 @@
1
1
  module BluepanClient
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bluepan_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
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-11-14 00:00:00.000000000 Z
11
+ date: 2016-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus