bloom_remit_client 0.6.0 → 0.7.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: 95d75896514499a9ed04e5ce11fd4f456669e518
4
- data.tar.gz: b045e5dd7adf94cc9f8932d2c1961fa16f0fa907
3
+ metadata.gz: 381621671f656368bfb2b8976655091a1a3078e9
4
+ data.tar.gz: b9d06f402e637681cd3c2fafbf65d783dffb9e45
5
5
  SHA512:
6
- metadata.gz: 4531d4b578608cbdb0cc6c080ef2963a67d21bde7c24091a8763f04f66030d261a52c1f5eb8df2e548fc873fb4cbb705edad1bd547f2c43dd9306ff666ef256b
7
- data.tar.gz: b6ec98c01559adb3bc7aea1242ec4cd7c5bd5b9c23752374e25d783fc4570218c0d14cba0de49c977d279fb7a537b59d8d642dba396543fc793b1104b24920f9
6
+ metadata.gz: 7455a4f09a719d55031b3d0632dd8bdd79aa94e21321b8f81cc6b40849ad99442c349f14c1df932a1e542dd1128e8a36b0064356520f30399829a7a424bec4b4
7
+ data.tar.gz: 41bca790360402850b7dbf130a3f752a03378269a4b5db08c4896e62daafb018cb61e6cf01b90cd25d5bceae3c26448d55341d78879286e358f2148f8f0ca2d6
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
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.7.0] - 2016-09-16
6
+ ### Changed
7
+ - Heavy lifting of sandbox and host defaults fall on BloomRemitClient::Client
8
+ - Default sandbox is true. Must set to false to be on production mode
9
+
5
10
  ## [0.6.0] - 2016-09-15
6
11
  ### Changed
7
12
  - Default to staging URL
@@ -39,21 +39,19 @@ module BloomRemitClient
39
39
  STAGING = 'bloomremit-staging.herokuapp.com'
40
40
 
41
41
  class << self
42
+ attr_accessor :host
42
43
  attr_accessor :sandbox
43
- attr_writer :host
44
44
 
45
45
  def new(args)
46
- client_args = args
47
- client_args[:host] ||= self.host
46
+ client_args = {}
47
+ client_args[:host] = self.host if self.host.present?
48
+ client_args[:sandbox] = self.sandbox if self.sandbox.present?
49
+ client_args.merge!(args)
50
+
48
51
  client = Client.new(client_args)
49
52
  raise ArgumentError, client.errors.full_messages if client.invalid?
50
53
  client
51
54
  end
52
55
 
53
- def host
54
- return @host if @host
55
- return STAGING if sandbox.nil? || sandbox
56
- PRODUCTION
57
- end
58
56
  end
59
57
  end
@@ -7,9 +7,11 @@ module BloomRemitClient
7
7
  attribute :api_token, String
8
8
  attribute :api_secret, String
9
9
  attribute :agent_id, String
10
- attribute :host, String
10
+ attribute :host, String, lazy: true, default: :default_host
11
+ attribute :sandbox, Boolean, default: true
11
12
 
12
13
  validates :api_token, :api_secret, :host, presence: true
14
+ validates :sandbox, inclusion: {in: [true, false]}
13
15
 
14
16
  # GET
15
17
  # /api/v1/partners/:api_token/credits
@@ -93,5 +95,11 @@ module BloomRemitClient
93
95
  def default_params
94
96
  @default_params ||= attributes.slice(:agent_id)
95
97
  end
98
+
99
+ def default_host
100
+ return BloomRemitClient::STAGING if self.sandbox.nil? || self.sandbox
101
+ BloomRemitClient::PRODUCTION
102
+ end
103
+
96
104
  end
97
105
  end
@@ -1,3 +1,3 @@
1
1
  module BloomRemitClient
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.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.6.0
4
+ version: 0.7.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-09-15 00:00:00.000000000 Z
11
+ date: 2016-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel