invoiced 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +37 -0
- data/.github/workflows/publish.yml +24 -0
- data/Gemfile +4 -4
- data/README.md +3 -3
- data/invoiced.gemspec +2 -2
- data/lib/invoiced/bank_account.rb +0 -1
- data/lib/invoiced/card.rb +0 -1
- data/lib/invoiced/custom_field.rb +10 -0
- data/lib/invoiced/customer_chasing_cadence.rb +10 -0
- data/lib/invoiced/email_template.rb +10 -0
- data/lib/invoiced/gl_account.rb +10 -0
- data/lib/invoiced/inbox.rb +7 -0
- data/lib/invoiced/invoice_chasing_cadence.rb +10 -0
- data/lib/invoiced/late_fee_schedule.rb +10 -0
- data/lib/invoiced/member.rb +10 -0
- data/lib/invoiced/merchant_account.rb +10 -0
- data/lib/invoiced/object.rb +5 -1
- data/lib/invoiced/payment_method.rb +8 -0
- data/lib/invoiced/pdf_template.rb +10 -0
- data/lib/invoiced/report.rb +7 -0
- data/lib/invoiced/role.rb +10 -0
- data/lib/invoiced/sign_up_page.rb +10 -0
- data/lib/invoiced/sms_template.rb +10 -0
- data/lib/invoiced/tax_rule.rb +10 -0
- data/lib/invoiced/theme.rb +10 -0
- data/lib/invoiced/version.rb +2 -2
- data/lib/invoiced/webhook.rb +10 -0
- data/lib/invoiced.rb +39 -2
- data/test/invoiced/charge_test.rb +8 -6
- data/test/invoiced/contact_test.rb +10 -86
- data/test/invoiced/coupon_test.rb +10 -83
- data/test/invoiced/credit_balance_adjustment_test.rb +17 -0
- data/test/invoiced/credit_note_test.rb +10 -83
- data/test/invoiced/custom_field_test.rb +17 -0
- data/test/invoiced/customer_chasing_cadence_test.rb +17 -0
- data/test/invoiced/customer_test.rb +10 -83
- data/test/invoiced/email_template_test.rb +17 -0
- data/test/invoiced/estimate_test.rb +10 -83
- data/test/invoiced/event_test.rb +6 -21
- data/test/invoiced/file_test.rb +8 -47
- data/test/invoiced/gl_account_test.rb +17 -0
- data/test/invoiced/inbox_test.rb +13 -0
- data/test/invoiced/invoice_chasing_cadence_test.rb +17 -0
- data/test/invoiced/invoice_test.rb +10 -83
- data/test/invoiced/item_test.rb +10 -83
- data/test/invoiced/late_fee_schedule_test.rb +17 -0
- data/test/invoiced/line_item_test.rb +10 -86
- data/test/invoiced/member_test.rb +17 -0
- data/test/invoiced/merchant_account_test.rb +17 -0
- data/test/invoiced/note_test.rb +10 -83
- data/test/invoiced/operations/create_test.rb +22 -0
- data/test/invoiced/operations/delete_test.rb +20 -0
- data/test/invoiced/operations/endpoint_test.rb +13 -0
- data/test/invoiced/operations/list_test.rb +26 -0
- data/test/invoiced/operations/operations.rb +0 -0
- data/test/invoiced/operations/retrieve_test.rb +22 -0
- data/test/invoiced/operations/update_test.rb +29 -0
- data/test/invoiced/payment_method_test.rb +15 -0
- data/test/invoiced/payment_plan_test.rb +7 -0
- data/test/invoiced/payment_test.rb +10 -83
- data/test/invoiced/pdf_template_test.rb +17 -0
- data/test/invoiced/plan_test.rb +10 -83
- data/test/invoiced/refund_test.rb +5 -3
- data/test/invoiced/report_test.rb +14 -0
- data/test/invoiced/role_test.rb +17 -0
- data/test/invoiced/sign_up_page_test.rb +17 -0
- data/test/invoiced/sms_template_test.rb +17 -0
- data/test/invoiced/subscription_test.rb +10 -71
- data/test/invoiced/task_test.rb +10 -83
- data/test/invoiced/tax_rate_test.rb +10 -83
- data/test/invoiced/tax_rule_test.rb +17 -0
- data/test/invoiced/theme_test.rb +17 -0
- data/test/invoiced/webhook_test.rb +17 -0
- data/test/test_helper.rb +6 -0
- metadata +78 -9
- data/.travis.yml +0 -15
- data/test/invoiced/credit_balance_adjustment.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 744fba470fc2c3433167b3af46f8f98da1f33fd23c08b4f971c83681f3605cdb
|
4
|
+
data.tar.gz: c4b6db10643c63fbc3bda83199500afaf99e439a0ae93d74d4f7ddf5cff94906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bcc44f6f0071db5b7b6a28ccf557b8f2ba7c38e2e626a8bb542e447919a634fe346acbb3d273313ecaa4d21db0076d059292023494c67fe6d57af59d5465f1a6
|
7
|
+
data.tar.gz: 2617903b3c510f30a170dece7e004fbb04f12c042cc41310e1af04aa790c3654771b0613308c85281ca077d5597eadda5a6404e1c7b25160aef23b38b0df22e2
|
@@ -0,0 +1,37 @@
|
|
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.3'
|
16
|
+
- '2.4'
|
17
|
+
- '2.5'
|
18
|
+
- '2.6'
|
19
|
+
- '2.7'
|
20
|
+
- '3.0'
|
21
|
+
- '3.1'
|
22
|
+
- '3.2'
|
23
|
+
- '3.3'
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
|
27
|
+
- name: Setup Ruby
|
28
|
+
uses: ruby/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
ruby-version: ${{ matrix.ruby-version }}
|
31
|
+
bundler-cache: true
|
32
|
+
|
33
|
+
- name: Tests
|
34
|
+
env:
|
35
|
+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
|
36
|
+
run: |
|
37
|
+
bundle exec rake
|
@@ -0,0 +1,24 @@
|
|
1
|
+
name: Publish
|
2
|
+
|
3
|
+
on:
|
4
|
+
workflow_dispatch: {}
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
publish:
|
8
|
+
name: Publish
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
steps:
|
11
|
+
- uses: actions/checkout@v2
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.3
|
17
|
+
|
18
|
+
- name: Build
|
19
|
+
run: gem build invoiced.gemspec
|
20
|
+
|
21
|
+
- name: Publish gems to Rubygems
|
22
|
+
run: gem push invoiced-*.gem
|
23
|
+
env:
|
24
|
+
GEM_HOST_API_KEY: ${{secrets.GEM_HOST_API_KEY}}
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
source "https://rubygems.org"
|
2
2
|
gemspec
|
3
3
|
|
4
|
-
gem 'rest-client', '~> 2.
|
4
|
+
gem 'rest-client', '~> 2.1.0'
|
5
5
|
gem 'jwt', '~> 2.0'
|
6
6
|
|
7
7
|
gem 'mocha', '~> 0.13.2', :require => false, :group => :test
|
@@ -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
|
13
|
-
gem 'simplecov-console', '~> 0.3
|
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
|
-
gem 'tins', '~> 1.6.0', :require => false, :group => :test
|
15
|
+
gem 'tins', '~> 1.6.0', :require => false, :group => :test
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ invoiced-ruby
|
|
3
3
|
|
4
4
|
This repository contains the Ruby client library for the [Invoiced](https://invoiced.com) API.
|
5
5
|
|
6
|
-
[](https://github.com/Invoiced/invoiced-ruby/actions/workflows/ci.yml)
|
7
7
|
[](https://coveralls.io/github/Invoiced/invoiced-ruby?branch=master)
|
8
8
|
[](https://badge.fury.io/rb/invoiced)
|
9
9
|
|
@@ -25,7 +25,7 @@ gem 'invoiced'
|
|
25
25
|
|
26
26
|
## Requirements
|
27
27
|
|
28
|
-
- Ruby 2.
|
28
|
+
- Ruby 2.3+
|
29
29
|
- `rest_client` gem
|
30
30
|
- `jwt` gem
|
31
31
|
|
@@ -73,4 +73,4 @@ The gem can be built with:
|
|
73
73
|
gem build invoiced.gemspec
|
74
74
|
```
|
75
75
|
|
76
|
-
The test suite can be ran with `rake test`
|
76
|
+
The test suite can be ran with `rake test`
|
data/invoiced.gemspec
CHANGED
@@ -12,9 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.email = 'support@invoiced.com'
|
13
13
|
s.files = ["lib/invoiced.rb"]
|
14
14
|
s.homepage = 'https://invoiced.com/docs/dev'
|
15
|
-
s.required_ruby_version = '>= 2.
|
15
|
+
s.required_ruby_version = '>= 2.3.0'
|
16
16
|
|
17
|
-
s.add_dependency('rest-client', '~> 2.
|
17
|
+
s.add_dependency('rest-client', '~> 2.1.0')
|
18
18
|
s.add_dependency('jwt', '~> 2.0')
|
19
19
|
|
20
20
|
s.files = `git ls-files`.split("\n")
|
data/lib/invoiced/card.rb
CHANGED
@@ -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 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
|
data/lib/invoiced/object.rb
CHANGED
@@ -35,7 +35,11 @@ module Invoiced
|
|
35
35
|
|
36
36
|
def build_endpoint
|
37
37
|
if self.class.const_defined? "OBJECT_NAME"
|
38
|
-
|
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
|
data/lib/invoiced/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Invoiced
|
2
|
-
VERSION = '
|
3
|
-
end
|
2
|
+
VERSION = '3.0.0'
|
3
|
+
end
|
data/lib/invoiced.rb
CHANGED
@@ -19,6 +19,7 @@ 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'
|
@@ -27,25 +28,43 @@ require 'invoiced/contact'
|
|
27
28
|
require 'invoiced/coupon'
|
28
29
|
require 'invoiced/credit_balance_adjustment'
|
29
30
|
require 'invoiced/credit_note'
|
31
|
+
require 'invoiced/custom_field'
|
30
32
|
require 'invoiced/customer'
|
33
|
+
require 'invoiced/customer_chasing_cadence'
|
31
34
|
require 'invoiced/email'
|
35
|
+
require 'invoiced/email_template'
|
32
36
|
require 'invoiced/estimate'
|
33
37
|
require 'invoiced/event'
|
34
38
|
require 'invoiced/file'
|
39
|
+
require 'invoiced/gl_account'
|
40
|
+
require 'invoiced/inbox'
|
35
41
|
require 'invoiced/invoice'
|
42
|
+
require 'invoiced/invoice_chasing_cadence'
|
36
43
|
require 'invoiced/item'
|
44
|
+
require 'invoiced/late_fee_schedule'
|
37
45
|
require 'invoiced/letter'
|
38
46
|
require 'invoiced/line_item'
|
47
|
+
require 'invoiced/member'
|
48
|
+
require 'invoiced/merchant_account'
|
39
49
|
require 'invoiced/note'
|
40
50
|
require 'invoiced/payment'
|
51
|
+
require 'invoiced/payment_method'
|
41
52
|
require 'invoiced/payment_plan'
|
42
53
|
require 'invoiced/payment_source'
|
54
|
+
require 'invoiced/pdf_template'
|
43
55
|
require 'invoiced/plan'
|
44
56
|
require 'invoiced/refund'
|
57
|
+
require 'invoiced/report'
|
58
|
+
require 'invoiced/role'
|
59
|
+
require 'invoiced/sign_up_page'
|
60
|
+
require 'invoiced/sms_template'
|
45
61
|
require 'invoiced/subscription'
|
46
62
|
require 'invoiced/task'
|
47
63
|
require 'invoiced/tax_rate'
|
64
|
+
require 'invoiced/tax_rule'
|
48
65
|
require 'invoiced/text_message'
|
66
|
+
require 'invoiced/theme'
|
67
|
+
require 'invoiced/webhook'
|
49
68
|
|
50
69
|
module Invoiced
|
51
70
|
class Client
|
@@ -56,7 +75,7 @@ module Invoiced
|
|
56
75
|
ReadTimeout = 80
|
57
76
|
|
58
77
|
attr_reader :api_key, :api_url, :sandbox, :sso_key
|
59
|
-
attr_reader :
|
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
|
60
79
|
|
61
80
|
def initialize(api_key, sandbox=false, sso_key=false)
|
62
81
|
@api_key = api_key
|
@@ -65,23 +84,41 @@ module Invoiced
|
|
65
84
|
@sso_key = sso_key
|
66
85
|
|
67
86
|
# Object endpoints
|
68
|
-
@Item = Invoiced::Item.new(self)
|
69
87
|
@Charge = Invoiced::Charge.new(self)
|
70
88
|
@Coupon = Invoiced::Coupon.new(self)
|
71
89
|
@CreditBalanceAdjustment = Invoiced::CreditBalanceAdjustment.new(self)
|
72
90
|
@CreditNote = Invoiced::CreditNote.new(self)
|
91
|
+
@CustomField = Invoiced::CustomField.new(self)
|
73
92
|
@Customer = Invoiced::Customer.new(self)
|
93
|
+
@CustomerChasingCadence = Invoiced::CustomerChasingCadence.new(self)
|
94
|
+
@EmailTemplate = Invoiced::EmailTemplate.new(self)
|
74
95
|
@Estimate = Invoiced::Estimate.new(self)
|
75
96
|
@Event = Invoiced::Event.new(self)
|
76
97
|
@File = Invoiced::File.new(self)
|
98
|
+
@GlAccount = Invoiced::GlAccount.new(self)
|
99
|
+
@Inbox = Invoiced::Inbox.new(self)
|
77
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)
|
78
106
|
@Note = Invoiced::Note.new(self)
|
79
107
|
@Payment = Invoiced::Payment.new(self)
|
108
|
+
@PaymentMethod = Invoiced::PaymentMethod.new(self)
|
109
|
+
@PdfTemplate = Invoiced::PdfTemplate.new(self)
|
80
110
|
@Plan = Invoiced::Plan.new(self)
|
81
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)
|
82
116
|
@Subscription = Invoiced::Subscription.new(self)
|
83
117
|
@Task = Invoiced::Task.new(self)
|
84
118
|
@TaxRate = Invoiced::TaxRate.new(self)
|
119
|
+
@TaxRule = Invoiced::TaxRule.new(self)
|
120
|
+
@Theme = Invoiced::Theme.new(self)
|
121
|
+
@Webhook = Invoiced::Webhook.new(self)
|
85
122
|
end
|
86
123
|
|
87
124
|
def request(method, endpoint, params={}, opts={})
|
@@ -2,9 +2,11 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
module Invoiced
|
4
4
|
class ChargeTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
include Invoiced::Operations::EndpointTest
|
6
|
+
|
7
|
+
setup do
|
8
|
+
@objectClass = Charge
|
9
|
+
@endpoint = '/charges'
|
8
10
|
end
|
9
11
|
|
10
12
|
should "create a charge" do
|
@@ -16,10 +18,10 @@ module Invoiced
|
|
16
18
|
RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
|
17
19
|
|
18
20
|
charge = Charge.new(@client, 1234)
|
19
|
-
|
21
|
+
payment = charge.create(:amount => 100, :payment_source_type => "card")
|
20
22
|
|
21
|
-
assert_instance_of(Invoiced::Payment,
|
22
|
-
assert_equal(
|
23
|
+
assert_instance_of(Invoiced::Payment, payment)
|
24
|
+
assert_equal(payment.id, "a1b2c3")
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -2,92 +2,16 @@ require File.expand_path('../../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
module Invoiced
|
4
4
|
class ContactTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
|
17
|
-
|
18
|
-
contact = Contact.new(@client)
|
19
|
-
contact = contact.create({:name => "Nancy"})
|
20
|
-
|
21
|
-
assert_instance_of(Invoiced::Contact, contact)
|
22
|
-
assert_equal(123, contact.id)
|
23
|
-
assert_equal("Nancy", contact.name)
|
24
|
-
end
|
25
|
-
|
26
|
-
should "retrieve a contact" do
|
27
|
-
mockResponse = mock('RestClient::Response')
|
28
|
-
mockResponse.stubs(:code).returns(200)
|
29
|
-
mockResponse.stubs(:body).returns('{"id":123,"name":"Nancy"}')
|
30
|
-
mockResponse.stubs(:headers).returns({})
|
31
|
-
|
32
|
-
RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
|
33
|
-
|
34
|
-
contact = Contact.new(@client)
|
35
|
-
contact = contact.retrieve(123)
|
36
|
-
|
37
|
-
assert_instance_of(Invoiced::Contact, contact)
|
38
|
-
assert_equal(123, contact.id)
|
39
|
-
assert_equal("Nancy", contact.name)
|
40
|
-
end
|
41
|
-
|
42
|
-
should "not update a contact when no params" do
|
43
|
-
contact = Contact.new(@client, 123)
|
44
|
-
assert_false(contact.save)
|
45
|
-
end
|
46
|
-
|
47
|
-
should "update a contact" do
|
48
|
-
mockResponse = mock('RestClient::Response')
|
49
|
-
mockResponse.stubs(:code).returns(200)
|
50
|
-
mockResponse.stubs(:body).returns('{"id":123,"name":"Nancy Drew"}')
|
51
|
-
mockResponse.stubs(:headers).returns({})
|
52
|
-
|
53
|
-
RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
|
54
|
-
|
55
|
-
contact = Contact.new(@client, 123)
|
56
|
-
contact.name = "Nancy Drew"
|
57
|
-
assert_true(contact.save)
|
58
|
-
|
59
|
-
assert_equal("Nancy Drew", contact.name)
|
60
|
-
end
|
61
|
-
|
62
|
-
should "list all contacts" do
|
63
|
-
mockResponse = mock('RestClient::Response')
|
64
|
-
mockResponse.stubs(:code).returns(200)
|
65
|
-
mockResponse.stubs(:body).returns('[{"id":123,"name":"Nancy"}]')
|
66
|
-
mockResponse.stubs(:headers).returns(:x_total_count => 15, :link => '<https://api.invoiced.com/contacts?per_page=25&page=1>; rel="self", <https://api.invoiced.com/contacts?per_page=25&page=1>; rel="first", <https://api.invoiced.com/contacts?per_page=25&page=1>; rel="last"')
|
67
|
-
|
68
|
-
RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
|
69
|
-
|
70
|
-
contact = Contact.new(@client)
|
71
|
-
contacts, metadata = contact.list
|
72
|
-
|
73
|
-
assert_instance_of(Array, contacts)
|
74
|
-
assert_equal(1, contacts.length)
|
75
|
-
assert_equal(123, contacts[0].id)
|
76
|
-
|
77
|
-
assert_instance_of(Invoiced::List, metadata)
|
78
|
-
assert_equal(15, metadata.total_count)
|
79
|
-
end
|
80
|
-
|
81
|
-
should "delete a contact" do
|
82
|
-
mockResponse = mock('RestClient::Response')
|
83
|
-
mockResponse.stubs(:code).returns(204)
|
84
|
-
mockResponse.stubs(:body).returns('')
|
85
|
-
mockResponse.stubs(:headers).returns({})
|
86
|
-
|
87
|
-
RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
|
88
|
-
|
89
|
-
contact = Contact.new(@client, 123)
|
90
|
-
assert_true(contact.delete)
|
5
|
+
include Invoiced::Operations::EndpointTest
|
6
|
+
include Invoiced::Operations::CreateTest
|
7
|
+
include Invoiced::Operations::RetrieveTest
|
8
|
+
include Invoiced::Operations::UpdateTest
|
9
|
+
include Invoiced::Operations::DeleteTest
|
10
|
+
include Invoiced::Operations::ListTest
|
11
|
+
|
12
|
+
setup do
|
13
|
+
@objectClass = Contact
|
14
|
+
@endpoint = '/contacts'
|
91
15
|
end
|
92
16
|
end
|
93
17
|
end
|