invoiced 1.1.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +35 -0
  3. data/Gemfile +2 -2
  4. data/README.md +21 -5
  5. data/lib/invoiced/bank_account.rb +0 -1
  6. data/lib/invoiced/card.rb +0 -1
  7. data/lib/invoiced/charge.rb +12 -0
  8. data/lib/invoiced/credit_balance_adjustment.rb +10 -0
  9. data/lib/invoiced/custom_field.rb +10 -0
  10. data/lib/invoiced/customer_chasing_cadence.rb +10 -0
  11. data/lib/invoiced/email_template.rb +10 -0
  12. data/lib/invoiced/gl_account.rb +10 -0
  13. data/lib/invoiced/inbox.rb +7 -0
  14. data/lib/invoiced/invoice_chasing_cadence.rb +10 -0
  15. data/lib/invoiced/{catalog_item.rb → item.rb} +2 -2
  16. data/lib/invoiced/late_fee_schedule.rb +10 -0
  17. data/lib/invoiced/member.rb +10 -0
  18. data/lib/invoiced/merchant_account.rb +10 -0
  19. data/lib/invoiced/object.rb +5 -1
  20. data/lib/invoiced/{transaction.rb → payment.rb} +2 -14
  21. data/lib/invoiced/payment_method.rb +8 -0
  22. data/lib/invoiced/pdf_template.rb +10 -0
  23. data/lib/invoiced/refund.rb +11 -0
  24. data/lib/invoiced/report.rb +7 -0
  25. data/lib/invoiced/role.rb +10 -0
  26. data/lib/invoiced/sign_up_page.rb +10 -0
  27. data/lib/invoiced/sms_template.rb +10 -0
  28. data/lib/invoiced/tax_rule.rb +10 -0
  29. data/lib/invoiced/theme.rb +10 -0
  30. data/lib/invoiced/version.rb +1 -1
  31. data/lib/invoiced/webhook.rb +10 -0
  32. data/lib/invoiced.rb +48 -5
  33. data/test/invoiced/charge_test.rb +27 -0
  34. data/test/invoiced/contact_test.rb +10 -86
  35. data/test/invoiced/coupon_test.rb +10 -83
  36. data/test/invoiced/credit_balance_adjustment_test.rb +17 -0
  37. data/test/invoiced/credit_note_test.rb +10 -83
  38. data/test/invoiced/custom_field_test.rb +17 -0
  39. data/test/invoiced/customer_chasing_cadence_test.rb +17 -0
  40. data/test/invoiced/customer_test.rb +10 -83
  41. data/test/invoiced/email_template_test.rb +17 -0
  42. data/test/invoiced/estimate_test.rb +10 -83
  43. data/test/invoiced/event_test.rb +6 -21
  44. data/test/invoiced/file_test.rb +8 -47
  45. data/test/invoiced/gl_account_test.rb +17 -0
  46. data/test/invoiced/inbox_test.rb +13 -0
  47. data/test/invoiced/invoice_chasing_cadence_test.rb +17 -0
  48. data/test/invoiced/invoice_test.rb +10 -83
  49. data/test/invoiced/item_test.rb +17 -0
  50. data/test/invoiced/late_fee_schedule_test.rb +17 -0
  51. data/test/invoiced/line_item_test.rb +10 -86
  52. data/test/invoiced/member_test.rb +17 -0
  53. data/test/invoiced/merchant_account_test.rb +17 -0
  54. data/test/invoiced/note_test.rb +10 -83
  55. data/test/invoiced/operations/create_test.rb +22 -0
  56. data/test/invoiced/operations/delete_test.rb +20 -0
  57. data/test/invoiced/operations/endpoint_test.rb +13 -0
  58. data/test/invoiced/operations/list_test.rb +26 -0
  59. data/test/invoiced/operations/operations.rb +0 -0
  60. data/test/invoiced/operations/retrieve_test.rb +22 -0
  61. data/test/invoiced/operations/update_test.rb +29 -0
  62. data/test/invoiced/payment_method_test.rb +15 -0
  63. data/test/invoiced/payment_plan_test.rb +7 -0
  64. data/test/invoiced/payment_test.rb +34 -0
  65. data/test/invoiced/pdf_template_test.rb +17 -0
  66. data/test/invoiced/plan_test.rb +10 -83
  67. data/test/invoiced/refund_test.rb +27 -0
  68. data/test/invoiced/report_test.rb +14 -0
  69. data/test/invoiced/role_test.rb +17 -0
  70. data/test/invoiced/sign_up_page_test.rb +17 -0
  71. data/test/invoiced/sms_template_test.rb +17 -0
  72. data/test/invoiced/subscription_test.rb +10 -71
  73. data/test/invoiced/task_test.rb +10 -83
  74. data/test/invoiced/tax_rate_test.rb +10 -83
  75. data/test/invoiced/tax_rule_test.rb +17 -0
  76. data/test/invoiced/theme_test.rb +17 -0
  77. data/test/invoiced/webhook_test.rb +17 -0
  78. data/test/test_helper.rb +6 -0
  79. metadata +90 -13
  80. data/.travis.yml +0 -12
  81. data/test/invoiced/catalog_item_test.rb +0 -90
  82. data/test/invoiced/transaction_test.rb +0 -137
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc29d5e9ff33831248d574c23a30169f149ba7b9ed11d2904de174cabba75163
4
- data.tar.gz: 4f2b87a74c4a58dffcadd4b46855089ac928a655f4b11e5e07598ea940d5e4b7
3
+ metadata.gz: 2a4b7176ca132f8c23b695c9f5ab7461400495c89370a953daef96b0e3d72ab6
4
+ data.tar.gz: 542389f7ff24edf9037fd6b380491b0a9431d8447e0f66a072f4dd2e64e0494a
5
5
  SHA512:
6
- metadata.gz: c3ba71d623fd4714ecd4975d29a7aa9730ceb8be5daaf8e7324eace2af003e6a986bab11bc83312cbb2316799ebdbfc922fa48b456ab6bb919c61608c33f04af
7
- data.tar.gz: eb098797e875032bd88e01452bdb2794cbdec350973ed46fb9ce06c3118b0355b2465643b8ec4aaae3212be46715e7f470826a27b0a2d0bf0c855412873afe8b
6
+ metadata.gz: 05a9da20d885430266a929bd26320ff50691e14be9ba3e09bea0209645cd9196fa96a7f7867f5de36fbb7ee4e1abfda28a9912911f0330b34ea86841df4dce49
7
+ data.tar.gz: d716a1e9dfc4256469abb4ca963278f47583a8322ad9a4c0a6c00a66d6ad6b8fd84f718ce0461c7e54d90408eae947ac8941421914df8a4ef6b336762241c60a
@@ -0,0 +1,35 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["master"]
6
+ pull_request:
7
+ branches: ["master"]
8
+
9
+ jobs:
10
+ tests:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ ruby-version:
15
+ - '2.1'
16
+ - '2.2'
17
+ - '2.3'
18
+ - '2.4'
19
+ - '2.5'
20
+ - '2.6'
21
+ - '2.7'
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+
25
+ - name: Setup Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: ${{ matrix.ruby-version }}
29
+ bundler-cache: true
30
+
31
+ - name: Tests
32
+ env:
33
+ COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
34
+ run: |
35
+ bundle exec rake
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gem 'shoulda', '~> 3.4.0', :require => false, :group => :test
9
9
  gem 'test-unit', :require => false, :group => :test
10
10
  gem 'rake', :require => false, :group => :test
11
11
  gem 'coveralls', :require => false, :group => :test
12
- gem 'simplecov', '~> 0.10.0', :require => false, :group => :test
13
- gem 'simplecov-console', '~> 0.3.1', :require => false, :group => :test
12
+ gem 'simplecov', '~> 0.10', :require => false, :group => :test
13
+ gem 'simplecov-console', '~> 0.3', :require => false, :group => :test
14
14
  gem 'term-ansicolor', '~> 1.3.2', :require => false, :group => :test
15
15
  gem 'tins', '~> 1.6.0', :require => false, :group => :test
data/README.md CHANGED
@@ -3,8 +3,9 @@ invoiced-ruby
3
3
 
4
4
  This repository contains the Ruby client library for the [Invoiced](https://invoiced.com) API.
5
5
 
6
- [![Build Status](https://travis-ci.org/Invoiced/invoiced-ruby.svg?branch=master)](https://travis-ci.org/Invoiced/invoiced-ruby)
6
+ [![CI](https://github.com/Invoiced/invoiced-php/actions/workflows/ci.yml/badge.svg)](https://github.com/Invoiced/invoiced-php/actions/workflows/ci.yml)
7
7
  [![Coverage Status](https://coveralls.io/repos/Invoiced/invoiced-ruby/badge.svg?branch=master&service=github)](https://coveralls.io/github/Invoiced/invoiced-ruby?branch=master)
8
+ [![Gem Version](https://badge.fury.io/rb/invoiced.svg)](https://badge.fury.io/rb/invoiced)
8
9
 
9
10
  ## Installing
10
11
 
@@ -44,10 +45,16 @@ Then, API calls can be made like this:
44
45
  invoice = invoiced.Invoice.retrieve("{INVOICE_ID}")
45
46
 
46
47
  # mark as paid
47
- transaction = invoiced.Transaction.create(
48
- :invoice => invoice.id,
48
+ payment = invoiced.Payment.create(
49
49
  :amount => invoice.balance,
50
- :method => "check")
50
+ :method => "check",
51
+ :applied_to => [
52
+ {
53
+ :type => "invoice",
54
+ :invoice => invoice.id,
55
+ :amount => invoice.balance
56
+ }
57
+ ])
51
58
  ```
52
59
 
53
60
  If you want to use the sandbox API instead then you must set the second argument on the client to `true` like this:
@@ -66,4 +73,13 @@ The gem can be built with:
66
73
  gem build invoiced.gemspec
67
74
  ```
68
75
 
69
- The test suite can be ran with `rake test`
76
+ The test suite can be ran with `rake test`
77
+
78
+ ## Deploying
79
+
80
+ The package can be uploaded to pypi with the following commands:
81
+
82
+ ```
83
+ gem build invoiced.gemspec
84
+ gem push invoiced-X.Y.Z.gem
85
+ ```
@@ -1,6 +1,5 @@
1
1
  module Invoiced
2
2
  class BankAccount < PaymentSourceObject
3
-
4
3
  OBJECT_NAME = 'bank_account'
5
4
  end
6
5
  end
data/lib/invoiced/card.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module Invoiced
2
2
  class Card < PaymentSourceObject
3
-
4
3
  OBJECT_NAME = 'card'
5
4
  end
6
5
  end
@@ -0,0 +1,12 @@
1
+ module Invoiced
2
+ class Charge < Object
3
+ OBJECT_NAME = 'charge'
4
+
5
+ def create(body={}, opts={})
6
+ response = @client.request(:post, endpoint(), body, opts)
7
+
8
+ payment = Payment.new(@client)
9
+ Util.convert_to_object(payment, response[:body])
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class CreditBalanceAdjustment < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'credit_balance_adjustment'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class CustomField < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'custom_field'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class CustomerChasingCadence < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'customer_chasing_cadence'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class EmailTemplate < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'email_template'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class GlAccount < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'gl_account'
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ module Invoiced
2
+ class Inbox < Object
3
+ include Invoiced::Operations::List
4
+
5
+ OBJECT_NAME = 'inbox'
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class InvoiceChasingCadence < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'invoice_chasing_cadence'
9
+ end
10
+ end
@@ -1,10 +1,10 @@
1
1
  module Invoiced
2
- class CatalogItem < Object
2
+ class Item < Object
3
3
  include Invoiced::Operations::List
4
4
  include Invoiced::Operations::Create
5
5
  include Invoiced::Operations::Update
6
6
  include Invoiced::Operations::Delete
7
7
 
8
- OBJECT_NAME = 'catalog_item'
8
+ OBJECT_NAME = 'item'
9
9
  end
10
10
  end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class LateFeeSchedule < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'late_fee_schedule'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class Member < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'member'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class MerchantAccount < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'merchant_account'
9
+ end
10
+ end
@@ -35,7 +35,11 @@ module Invoiced
35
35
 
36
36
  def build_endpoint
37
37
  if self.class.const_defined? "OBJECT_NAME"
38
- '/' + self.class::OBJECT_NAME + 's'
38
+ if self.class::OBJECT_NAME == 'inbox'
39
+ '/inboxes'
40
+ else
41
+ '/' + self.class::OBJECT_NAME + 's'
42
+ end
39
43
  else
40
44
  '/objects'
41
45
  end
@@ -1,11 +1,11 @@
1
1
  module Invoiced
2
- class Transaction < Object
2
+ class Payment < Object
3
3
  include Invoiced::Operations::List
4
4
  include Invoiced::Operations::Create
5
5
  include Invoiced::Operations::Update
6
6
  include Invoiced::Operations::Delete
7
7
 
8
- OBJECT_NAME = 'transaction'
8
+ OBJECT_NAME = 'payment'
9
9
 
10
10
  def send(params={}, opts={})
11
11
  response = @client.request(:post, "#{self.endpoint()}/emails", params, opts)
@@ -14,17 +14,5 @@ module Invoiced
14
14
  email = Email.new(@client)
15
15
  Util.build_objects(email, response[:body])
16
16
  end
17
-
18
- def refund(params={}, opts={})
19
- response = @client.request(:post, "#{self.endpoint()}/refunds", params, opts)
20
-
21
- Util.convert_to_object(self, response[:body])
22
- end
23
-
24
- def initiate_charge(params={}, opts={})
25
- response = @client.request(:post, "/charges", params, opts)
26
-
27
- Util.convert_to_object(self, response[:body])
28
- end
29
17
  end
30
18
  end
@@ -0,0 +1,8 @@
1
+ module Invoiced
2
+ class PaymentMethod < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Update
5
+
6
+ OBJECT_NAME = 'payment_method'
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class PdfTemplate < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'pdf_template'
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ module Invoiced
2
+ class Refund < Object
3
+ OBJECT_NAME = 'refund'
4
+
5
+ def create(chargeId, body={}, opts={})
6
+ response = @client.request(:post, @endpoint_base + "/charges/#{chargeId}/refunds", body, opts)
7
+
8
+ Util.convert_to_object(self, response[:body])
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ module Invoiced
2
+ class Report < Object
3
+ include Invoiced::Operations::Create
4
+
5
+ OBJECT_NAME = 'report'
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class Role < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'role'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class SignUpPage < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'sign_up_page'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class SmsTemplate < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'sms_template'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class TaxRule < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'tax_rule'
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class Theme < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'theme'
9
+ end
10
+ end
@@ -1,3 +1,3 @@
1
1
  module Invoiced
2
- VERSION = '1.1.0'
2
+ VERSION = '2.1.0'
3
3
  end
@@ -0,0 +1,10 @@
1
+ module Invoiced
2
+ class Webhook < Object
3
+ include Invoiced::Operations::List
4
+ include Invoiced::Operations::Create
5
+ include Invoiced::Operations::Update
6
+ include Invoiced::Operations::Delete
7
+
8
+ OBJECT_NAME = 'webhook'
9
+ end
10
+ end
data/lib/invoiced.rb CHANGED
@@ -19,30 +19,52 @@ require 'invoiced/operations/update'
19
19
 
20
20
  require 'invoiced/object'
21
21
  require 'invoiced/payment_source_object'
22
+
22
23
  require 'invoiced/attachment'
23
24
  require 'invoiced/bank_account'
24
25
  require 'invoiced/card'
25
- require 'invoiced/catalog_item'
26
+ require 'invoiced/charge'
26
27
  require 'invoiced/contact'
27
28
  require 'invoiced/coupon'
29
+ require 'invoiced/credit_balance_adjustment'
28
30
  require 'invoiced/credit_note'
31
+ require 'invoiced/custom_field'
29
32
  require 'invoiced/customer'
33
+ require 'invoiced/customer_chasing_cadence'
30
34
  require 'invoiced/email'
35
+ require 'invoiced/email_template'
31
36
  require 'invoiced/estimate'
32
37
  require 'invoiced/event'
33
38
  require 'invoiced/file'
39
+ require 'invoiced/gl_account'
40
+ require 'invoiced/inbox'
34
41
  require 'invoiced/invoice'
42
+ require 'invoiced/invoice_chasing_cadence'
43
+ require 'invoiced/item'
44
+ require 'invoiced/late_fee_schedule'
35
45
  require 'invoiced/letter'
36
46
  require 'invoiced/line_item'
47
+ require 'invoiced/member'
48
+ require 'invoiced/merchant_account'
37
49
  require 'invoiced/note'
50
+ require 'invoiced/payment'
51
+ require 'invoiced/payment_method'
38
52
  require 'invoiced/payment_plan'
39
53
  require 'invoiced/payment_source'
54
+ require 'invoiced/pdf_template'
40
55
  require 'invoiced/plan'
56
+ require 'invoiced/refund'
57
+ require 'invoiced/report'
58
+ require 'invoiced/role'
59
+ require 'invoiced/sign_up_page'
60
+ require 'invoiced/sms_template'
41
61
  require 'invoiced/subscription'
42
62
  require 'invoiced/task'
43
63
  require 'invoiced/tax_rate'
64
+ require 'invoiced/tax_rule'
44
65
  require 'invoiced/text_message'
45
- require 'invoiced/transaction'
66
+ require 'invoiced/theme'
67
+ require 'invoiced/webhook'
46
68
 
47
69
  module Invoiced
48
70
  class Client
@@ -53,7 +75,7 @@ module Invoiced
53
75
  ReadTimeout = 80
54
76
 
55
77
  attr_reader :api_key, :api_url, :sandbox, :sso_key
56
- attr_reader :CatalogItem, :Coupon, :CreditNote, :Customer, :Estimate, :Event, :File, :Invoice, :Note, :Plan, :Subscription, :Task, :TaxRate, :Transaction
78
+ attr_reader :Charge, :Coupon, :CreditBalanceAdjustment, :CreditNote, :CustomField, :Customer, :CustomerChasingCadence, :EmailTemplate, :Estimate, :Event, :File, :GlAccount, :Inbox, :Invoice, :InvoiceChasingCadence, :Item, :LateFeeSchedule, :Member, :MerchantAccount, :Note, :Payment, :PaymentMethod, :PdfTemplate, :Plan, :Refund, :Report, :Role, :SignUpPage, :SmsTemplate, :Subscription, :Task, :TaxRate, :TaxRule, :Theme, :Webhook
57
79
 
58
80
  def initialize(api_key, sandbox=false, sso_key=false)
59
81
  @api_key = api_key
@@ -62,20 +84,41 @@ module Invoiced
62
84
  @sso_key = sso_key
63
85
 
64
86
  # Object endpoints
65
- @CatalogItem = Invoiced::CatalogItem.new(self)
87
+ @Charge = Invoiced::Charge.new(self)
66
88
  @Coupon = Invoiced::Coupon.new(self)
89
+ @CreditBalanceAdjustment = Invoiced::CreditBalanceAdjustment.new(self)
67
90
  @CreditNote = Invoiced::CreditNote.new(self)
91
+ @CustomField = Invoiced::CustomField.new(self)
68
92
  @Customer = Invoiced::Customer.new(self)
93
+ @CustomerChasingCadence = Invoiced::CustomerChasingCadence.new(self)
94
+ @EmailTemplate = Invoiced::EmailTemplate.new(self)
69
95
  @Estimate = Invoiced::Estimate.new(self)
70
96
  @Event = Invoiced::Event.new(self)
71
97
  @File = Invoiced::File.new(self)
98
+ @GlAccount = Invoiced::GlAccount.new(self)
99
+ @Inbox = Invoiced::Inbox.new(self)
72
100
  @Invoice = Invoiced::Invoice.new(self)
101
+ @InvoiceChasingCadence = Invoiced::InvoiceChasingCadence.new(self)
102
+ @Item = Invoiced::Item.new(self)
103
+ @LateFeeSchedule = Invoiced::LateFeeSchedule.new(self)
104
+ @Member = Invoiced::Member.new(self)
105
+ @MerchantAccount = Invoiced::MerchantAccount.new(self)
73
106
  @Note = Invoiced::Note.new(self)
107
+ @Payment = Invoiced::Payment.new(self)
108
+ @PaymentMethod = Invoiced::PaymentMethod.new(self)
109
+ @PdfTemplate = Invoiced::PdfTemplate.new(self)
74
110
  @Plan = Invoiced::Plan.new(self)
111
+ @Refund = Invoiced::Refund.new(self)
112
+ @Report = Invoiced::Report.new(self)
113
+ @Role = Invoiced::Role.new(self)
114
+ @SignUpPage = Invoiced::SignUpPage.new(self)
115
+ @SmsTemplate = Invoiced::SmsTemplate.new(self)
75
116
  @Subscription = Invoiced::Subscription.new(self)
76
117
  @Task = Invoiced::Task.new(self)
77
118
  @TaxRate = Invoiced::TaxRate.new(self)
78
- @Transaction = Invoiced::Transaction.new(self)
119
+ @TaxRule = Invoiced::TaxRule.new(self)
120
+ @Theme = Invoiced::Theme.new(self)
121
+ @Webhook = Invoiced::Webhook.new(self)
79
122
  end
80
123
 
81
124
  def request(method, endpoint, params={}, opts={})
@@ -0,0 +1,27 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Invoiced
4
+ class ChargeTest < Test::Unit::TestCase
5
+ include Invoiced::Operations::EndpointTest
6
+
7
+ setup do
8
+ @objectClass = Charge
9
+ @endpoint = '/charges'
10
+ end
11
+
12
+ should "create a charge" do
13
+ mockResponse = mock('RestClient::Response')
14
+ mockResponse.stubs(:code).returns(201)
15
+ mockResponse.stubs(:body).returns('{"id":"a1b2c3","amount":100,"object":"charge"}')
16
+ mockResponse.stubs(:headers).returns({})
17
+
18
+ RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
19
+
20
+ charge = Charge.new(@client, 1234)
21
+ payment = charge.create(:amount => 100, :payment_source_type => "card")
22
+
23
+ assert_instance_of(Invoiced::Payment, payment)
24
+ assert_equal(payment.id, "a1b2c3")
25
+ end
26
+ end
27
+ end