paid 0.0.2 → 0.0.3

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: e2120c7b926756b082e104665c021f7ffcd0d5a8
4
- data.tar.gz: 47a4d29a2a673391a407e3029c400fdaf99de80e
3
+ metadata.gz: 5d1bce0b8dfa8caf72176df4abcdfd7be9b30262
4
+ data.tar.gz: 1000696410a8767e4389df95c9e0caa93b8b9e41
5
5
  SHA512:
6
- metadata.gz: 72315d74c0d7f32910b264617aa42624d6ad2c36a4c7df7a6fe90eb08a31d1ba1ed3a7bbe7d5a7dcb54759108981c7e74e51a07c3d289e742b3788f52054d707
7
- data.tar.gz: 3695119c7cbda98a5d8c23f9779aad3539bf841851fa825dbaf192cb9ac93669f307b73fedb092b874fabdc67c7add030fccfb6414439b10783412ba1c292b50
6
+ metadata.gz: 16e2274c632fc723c6302c2a61c90e3be32dfdbb0279761c404cc72c76058099c1ce6a45c201b207025c953bfda16e8458716a57c33378d5528cb5731f1f974d
7
+ data.tar.gz: 6a1eac1770128a35eee7602396a33f2466bba79e3442390b302f6817582767eaea24de8045dff5278df111493637ee1115ff81cd9e9a30f1555415ca5e911fb8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- paid (0.0.2)
4
+ paid (0.0.3)
5
5
  json (~> 1.8.1)
6
6
  mime-types (>= 1.25, < 3.0)
7
7
  rest-client (~> 1.4)
@@ -5,6 +5,15 @@ module Paid
5
5
  include Paid::APIOperations::Update
6
6
  include Paid::APIOperations::List
7
7
 
8
+ def generate_invoice(params={}, opts={})
9
+ api_key, headers = Util.parse_opts(opts)
10
+ response, api_key = Paid.request(
11
+ :post, generate_invoice_url, api_key || @api_key, params, headers)
12
+ # refresh_from(response, api_key)
13
+ refresh_from({ :invoice => response }, api_key, true)
14
+ invoice
15
+ end
16
+
8
17
  def invoices
9
18
  Invoice.all({ :customer => id }, @api_key)
10
19
  end
@@ -12,5 +21,11 @@ module Paid
12
21
  def transactions
13
22
  Transaction.all({ :customer => id }, @api_key)
14
23
  end
24
+
25
+ private
26
+
27
+ def generate_invoice_url
28
+ url + '/generate_invoice'
29
+ end
15
30
  end
16
31
  end
@@ -1,3 +1,3 @@
1
1
  module Paid
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
Binary file
@@ -31,5 +31,14 @@ module Paid
31
31
  c = Paid::Customer.create
32
32
  assert_equal "c_test_customer", c.id
33
33
  end
34
+
35
+ should "be able to generate invoice" do
36
+ @mock.expects(:get).never
37
+ @mock.expects(:post).once.returns(test_response(test_customer))
38
+ c = Paid::Customer.create
39
+ @mock.expects(:post).once.returns(test_response(test_invoice))
40
+ i = c.generate_invoice
41
+ assert i.kind_of?(Paid::Invoice)
42
+ end
34
43
  end
35
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Jackson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-27 00:00:00.000000000 Z
11
+ date: 2015-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -154,6 +154,7 @@ files:
154
154
  - lib/tasks/paid_tasks.rake
155
155
  - paid.gemspec
156
156
  - pkg/paid-0.0.1.gem
157
+ - pkg/paid-0.0.2.gem
157
158
  - test/paid/account_test.rb
158
159
  - test/paid/alias_test.rb
159
160
  - test/paid/api_resource_test.rb