chargify_api_ares 1.3.5 → 1.4.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: 8d122946e163261c491583b731f6ea5a573c33df
4
- data.tar.gz: e125acbd900516438a642d6c36d72def8c1072f1
3
+ metadata.gz: 62367586e39de024a3245e8153701eea9e7dd851
4
+ data.tar.gz: 37ba219d0657aadc41105b87bde8296b5fc113a8
5
5
  SHA512:
6
- metadata.gz: f9e8fc0a59ff6bd917e2d7f65ee4a775d7f403c132378ad722bfb297f4907a686497d96b5dde261867cc6714134d549848bca5a07080100b0d8bceee34f6dfcf
7
- data.tar.gz: 3f8a78dbb9a25403c828b6dfdd5e283bcd3a2c14b6b3170b23c7c0b160d5e6986a8bd6204e48354ed09c0b74d6b4c5f84422c7df9e5731ad99a963de04d69e65
6
+ metadata.gz: 8a4d9d6fc46fc921fc178c69a88d9e816a67b90546e9b1780e8eb1572d7afddd32446afad673c4878e88510d032c5366c347a14ce56b2b06da55c667ae1c6913
7
+ data.tar.gz: 4124335f71a4cfca894b5fd58e864926b32ecf4fb7785c3f26de7b7461af249672eb159b9d1155f73eae7202126256ca6ef4449ba8fe720e51d695d1f06db202
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- chargify_api_ares (1.3.4)
4
+ chargify_api_ares (1.4.0)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -65,3 +65,6 @@ DEPENDENCIES
65
65
  rake (~> 10.0.3)
66
66
  rspec (~> 2.12.0)
67
67
  vcr
68
+
69
+ BUNDLED WITH
70
+ 1.10.5
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.3.5 / Aug 12 2015
2
+
3
+ * Adds support for customer metadata
4
+
1
5
  ## 1.3.4 / May 14 2015
2
6
 
3
7
  * Adds duplicate prevention support
data/README.md CHANGED
@@ -139,6 +139,13 @@ subscription = Chargify::Subscription.create(
139
139
  )
140
140
  ```
141
141
 
142
+ ### Statements PDF retrieving
143
+ ```ruby
144
+ File.open(file_path, 'wb+') do |f|
145
+ f.write Chargify::Statement.find_pdf(statement.id)
146
+ end
147
+ ```
148
+
142
149
  ### Compatibility
143
150
 
144
151
  * Rails/ActiveResource 2.3.x, use 0.5.x
@@ -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.3.5'
8
- s.date = '2015-08-12'
7
+ s.version = '1.4.0'
8
+ s.date = '2015-10-06'
9
9
  s.summary = 'A Chargify API wrapper for Ruby using ActiveResource'
10
10
  s.description = ''
11
11
  s.authors = ["Chargify Development Team"]
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- chargify_api_ares (1.3.4)
4
+ chargify_api_ares (1.4.0)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -126,3 +126,6 @@ DEPENDENCIES
126
126
  rake (~> 10.0.3)
127
127
  rspec (~> 2.12.0)
128
128
  vcr
129
+
130
+ BUNDLED WITH
131
+ 1.10.5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- chargify_api_ares (1.3.4)
4
+ chargify_api_ares (1.4.0)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -126,3 +126,6 @@ DEPENDENCIES
126
126
  rake (~> 10.0.3)
127
127
  rspec (~> 2.12.0)
128
128
  vcr
129
+
130
+ BUNDLED WITH
131
+ 1.10.5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- chargify_api_ares (1.3.4)
4
+ chargify_api_ares (1.4.0)
5
5
  activeresource (>= 3.2.16)
6
6
 
7
7
  GEM
@@ -120,3 +120,6 @@ DEPENDENCIES
120
120
  rake (~> 10.0.3)
121
121
  rspec (~> 2.12.0)
122
122
  vcr
123
+
124
+ BUNDLED WITH
125
+ 1.10.5
@@ -12,19 +12,6 @@ module Chargify
12
12
 
13
13
  private
14
14
 
15
- # Chargify returns a non-standard XML error response for Migration. Since the API wants to maintain
16
- # backwards compatibility, we will work around that when we parse errors here by overriding the
17
- # framework's `load_remote_errors` with our own for just XML
18
- def load_remote_errors(remote_errors, save_cache = false)
19
- case self.class.format
20
- when ActiveResource::Formats[:xml]
21
- array = [Hash.from_xml(remote_errors.response.body)["errors"]] rescue []
22
- errors.from_array array, save_cache
23
- else
24
- super
25
- end
26
- end
27
-
28
15
  class Preview < Base
29
16
  self.prefix = "/subscriptions/:subscription_id/migrations/"
30
17
 
@@ -1,4 +1,12 @@
1
1
  module Chargify
2
2
  class Statement < Base
3
+
4
+ # Returns raw PDF data. Usage example:
5
+ # File.open(file_path, 'wb+'){ |f| f.write Chargify::Statement.find_pdf(statement.id) }
6
+ def self.find_pdf(scope, options = {})
7
+ prefix_options, query_options = split_options(options[:params])
8
+ path = element_path(scope, prefix_options, query_options).gsub(/\.\w+$/, ".pdf")
9
+ connection.get(path, headers).body
10
+ end
3
11
  end
4
12
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chargify::Statement, :fake_resource do
4
+
5
+ context '.find_pdf' do
6
+ before(:each) do
7
+ FakeWeb.register_uri(:get, "#{test_domain}/statements/1.pdf", :body => 'fake_pdf')
8
+ end
9
+
10
+ it 'downloads pdf statement' do
11
+ pdf = Chargify::Statement.find_pdf(1)
12
+ pdf.should == 'fake_pdf'
13
+ end
14
+ end
15
+
16
+ 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.3.5
4
+ version: 1.4.0
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: 2015-08-12 00:00:00.000000000 Z
11
+ date: 2015-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -236,6 +236,7 @@ files:
236
236
  - spec/resources/product_family_spec.rb
237
237
  - spec/resources/product_spec.rb
238
238
  - spec/resources/renewal_preview_spec.rb
239
+ - spec/resources/statement_spec.rb
239
240
  - spec/resources/subscription_component_spec.rb
240
241
  - spec/resources/subscription_metadata_spec.rb
241
242
  - spec/resources/subscription_metafield_spec.rb
@@ -287,6 +288,7 @@ test_files:
287
288
  - spec/resources/product_family_spec.rb
288
289
  - spec/resources/product_spec.rb
289
290
  - spec/resources/renewal_preview_spec.rb
291
+ - spec/resources/statement_spec.rb
290
292
  - spec/resources/subscription_component_spec.rb
291
293
  - spec/resources/subscription_metadata_spec.rb
292
294
  - spec/resources/subscription_metafield_spec.rb