chargify_api_ares 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/HISTORY.md +4 -0
- data/chargify_api_ares.gemspec +2 -2
- data/gemfiles/rails_3.gemfile.lock +1 -1
- data/gemfiles/rails_4.1.gemfile.lock +1 -1
- data/gemfiles/rails_4.gemfile.lock +1 -1
- data/lib/chargify_api_ares/resources/allocation.rb +20 -6
- data/spec/resources/allocation_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b4fea9191725abc5d611228e64fc1d1c73e85f9
|
4
|
+
data.tar.gz: b9d5ff10e502d79443298f550a39abce9fca60e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f087abf32692cdcd9fd417a549f9521dd5fb1f32cc83cddff01209928bd518e78eb5ca5eae237802916d2b9f3a5d403fa15859af3f2a57bc1a6014f41f1e8ee6
|
7
|
+
data.tar.gz: 04218486fb72dcede36967a1bf49a677203387ee896209149e6d9f944ead7f12e2bf57e1f2c4e020323e3b9910cd40cb04d69ab51c5ab527c09289bd1b9ecc9a
|
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 1.4.3 / Jan 5 2016
|
2
|
+
|
3
|
+
* Force json format for bulk allocations endpoints [PR 126](https://github.com/chargify/chargify_api_ares/pull/126) by @ryansch
|
4
|
+
|
1
5
|
## 1.4.2 / Jan 4 2016
|
2
6
|
|
3
7
|
* Adds `Chargify::Allocations.bulk_create` to work with https://docs.chargify.com/api-allocations#create-multiple-allocations. [PR 125](https://github.com/chargify/chargify_api_ares/pull/125) by @ryansch
|
data/chargify_api_ares.gemspec
CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.rubygems_version = '1.3.7'
|
5
5
|
|
6
6
|
s.name = 'chargify_api_ares'
|
7
|
-
s.version = '1.4.
|
8
|
-
s.date = '2016-01-
|
7
|
+
s.version = '1.4.3'
|
8
|
+
s.date = '2016-01-05'
|
9
9
|
s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
|
10
10
|
s.description = ''
|
11
11
|
s.authors = ["Chargify Development Team"]
|
@@ -15,12 +15,26 @@ module Chargify
|
|
15
15
|
subscription_id = opts.delete(:subscription_id)
|
16
16
|
raise ArgumentError, 'subscription_id required' if subscription_id.nil?
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
with_json_format do |format|
|
19
|
+
response = connection.post(
|
20
|
+
bulk_create_prefix(subscription_id: subscription_id),
|
21
|
+
format.encode(opts),
|
22
|
+
headers
|
23
|
+
)
|
24
|
+
instantiate_collection(format.decode(response.body))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.with_json_format(&block)
|
29
|
+
# Force json processing for this api request
|
30
|
+
json_format = ActiveResource::Formats[:json]
|
31
|
+
orig_format = connection.format
|
32
|
+
begin
|
33
|
+
connection.format = json_format
|
34
|
+
block.call(json_format)
|
35
|
+
ensure
|
36
|
+
connection.format = orig_format
|
37
|
+
end
|
24
38
|
end
|
25
39
|
end
|
26
40
|
end
|
@@ -88,4 +88,26 @@ describe Chargify::Allocation do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
91
|
+
|
92
|
+
describe '.with_json_format' do
|
93
|
+
before do
|
94
|
+
Chargify.configure do |config|
|
95
|
+
config.format = :xml
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'forces json format' do
|
100
|
+
ran = false
|
101
|
+
block_format = nil
|
102
|
+
block = proc do |format|
|
103
|
+
ran = true
|
104
|
+
block_format = format
|
105
|
+
end
|
106
|
+
|
107
|
+
Chargify::Allocation.with_json_format(&block)
|
108
|
+
expect(ran).to be_true
|
109
|
+
expect(block_format).to be_an ActiveResource::Formats[:json]
|
110
|
+
expect(Chargify::Allocation.connection.format).to be_an ActiveResource::Formats[:xml]
|
111
|
+
end
|
112
|
+
end
|
91
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chargify_api_ares
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chargify Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeresource
|