bloom_remit_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: bf0cd6b7a3e7919d1cf2424a676cf5dec9a1a308
4
- data.tar.gz: 87b7e333204589009ec8ad99c8feb823e89bd37c
3
+ metadata.gz: 9cf3bdf11ae936af4cbce95367f78077bd3ba046
4
+ data.tar.gz: 87970217a5a5aa828ad0b5be52f15cfa19b1b105
5
5
  SHA512:
6
- metadata.gz: 93ba9929ce8a13d2c00c18ad37f80db1fe36b9b9e0d9b2f708236ab7da909d0633d6dba560dfe5bb07677648d99dd572514f8c41b5a1cad1b2603f65c000037e
7
- data.tar.gz: 0d0d3d334bc5bf1d6df8861218cf81be1a1725d8b6a3612824b52caeb74aa6a33c7a5c503009d085902010c2cdded315e6da67c862893d38ec85b39a10eb352a
6
+ metadata.gz: 27671383f4825bf63e170a06eca5d15bf3c93aa3020973656ead1cd6708bd69cce0a90d1436f66138314dcba0b4011b012ea0f382474abfe8e19a352553d1125
7
+ data.tar.gz: 0a8113dcb8a7819ee1ef89b6a3f8a3c69bd76498c246dab4c7b38c5789d1820a0e0ecf0c9d81880129a14f725e3be0932b322068f343dfaaf896ad7789ae67f9
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
+ ## [0.3.0] - 2016-08-06
6
+ ### Added
7
+ - Factories for app development
8
+
9
+ ### Changed
10
+ - Use BaseResponse#body to access the `to_hash`ed json response
11
+
5
12
  ## [0.2.0] - 2016-07-29
6
13
  ### Added
7
14
  - Add ability to create sender
data/README.md CHANGED
@@ -24,6 +24,10 @@ Or install it yourself as:
24
24
 
25
25
  TODO: Write usage instructions here
26
26
 
27
+ ## Factories
28
+
29
+ To make testing easier, you may `require 'bloom_remit_client/factories'` in your app.
30
+
27
31
  ## Development
28
32
 
29
33
  - Copy `spec/config.yml.sample` to `spec/config.yml` and put your credentials
@@ -3,6 +3,7 @@ require 'httparty'
3
3
  require 'active_model'
4
4
  require 'active_support/core_ext/hash/indifferent_access'
5
5
  require 'active_support/core_ext/object/try'
6
+ require 'bloom_remit_client/coercers/indifferent_hash'
6
7
  require "bloom_remit_client/version"
7
8
  require "bloom_remit_client/client"
8
9
  require "bloom_remit_client/models/biller"
@@ -0,0 +1,11 @@
1
+ module BloomRemitClient
2
+ module Coercers
3
+ class IndifferentHash < Virtus::Attribute
4
+
5
+ def coerce(value)
6
+ value.is_a?(::Hash) ? value.with_indifferent_access : value
7
+ end
8
+
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ FactoryGirl.define do
2
+
3
+ factory :bloom_remit_client_biller, class: "BloomRemitClient::Biller" do
4
+ sequence(:slug) {|n| "biller_#{n}" }
5
+ first_field "Account No."
6
+ first_field_format "Alphanumeric"
7
+ first_field_width 30
8
+ second_field "Account Name"
9
+ second_field_format "Alphanumeric"
10
+ second_field_width 50
11
+ end
12
+
13
+ factory(:bloom_remit_client_create_payment_response, {
14
+ class: "BloomRemitClient::CreatePaymentResponse",
15
+ }) do
16
+ body { {"json" => "value"} }
17
+ end
18
+
19
+ end
@@ -3,10 +3,15 @@ module BloomRemitClient
3
3
 
4
4
  include Virtus.model
5
5
  attribute :raw_response, Object
6
+ attribute(:body, {
7
+ Coercers::IndifferentHash,
8
+ lazy: true,
9
+ default: :default_body,
10
+ })
6
11
 
7
12
  private
8
13
 
9
- def data
14
+ def default_body
10
15
  json = JSON.parse(raw_response.body)
11
16
 
12
17
  if json.is_a?(Array)
@@ -6,7 +6,7 @@ module BloomRemitClient
6
6
  private
7
7
 
8
8
  def default_billers
9
- data.map { |hash| Biller.new(hash) }
9
+ body.map { |hash| Biller.new(hash) }
10
10
  end
11
11
 
12
12
  end
@@ -10,7 +10,7 @@ module BloomRemitClient
10
10
  private
11
11
 
12
12
  def default_payment
13
- Payment.new(data[:payment])
13
+ Payment.new(body[:payment])
14
14
  end
15
15
 
16
16
  end
@@ -10,7 +10,7 @@ module BloomRemitClient
10
10
  private
11
11
 
12
12
  def default_sender
13
- User.new(data[:sender])
13
+ User.new(body[:sender])
14
14
  end
15
15
 
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module BloomRemitClient
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: bloom_remit_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-07-29 00:00:00.000000000 Z
11
+ date: 2016-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -174,6 +174,8 @@ files:
174
174
  - bloom_remit_client.gemspec
175
175
  - lib/bloom_remit_client.rb
176
176
  - lib/bloom_remit_client/client.rb
177
+ - lib/bloom_remit_client/coercers/indifferent_hash.rb
178
+ - lib/bloom_remit_client/factories.rb
177
179
  - lib/bloom_remit_client/models/biller.rb
178
180
  - lib/bloom_remit_client/models/payment.rb
179
181
  - lib/bloom_remit_client/models/user.rb
@@ -207,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
209
  version: '0'
208
210
  requirements: []
209
211
  rubyforge_project:
210
- rubygems_version: 2.5.1
212
+ rubygems_version: 2.6.4
211
213
  signing_key:
212
214
  specification_version: 4
213
215
  summary: Ruby wrapper around Bloom Remit's API