invoiced 1.2.0 → 1.3.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
  SHA256:
3
- metadata.gz: 3c9a2f8ec999dc38fc2d99a9a6c70ed9f908453399e7a1391b139f08d0016c58
4
- data.tar.gz: bded9ce98e08adf08061d9411958f358c2a53622f1c6df96ddbdee4ea34c02b8
3
+ metadata.gz: 96fee7c8ec29ed8496d56e2ad01040962c4e793e03d8746cd1bb33dc9d455310
4
+ data.tar.gz: 24c4ac4cf3671312b13da58e7ffb0798041ff50572d06e49ccbab047f2fe7130
5
5
  SHA512:
6
- metadata.gz: cce64c5c13a67dcfb8d1b693fa915e3927b9785a4f27c9a19dd72c0c36e9b97ad17b1159a0023994d73562e90d8cd0384f51704c890e8f2e849d9e8b9f1a3800
7
- data.tar.gz: 9763afc75104c54d36b1a31cf603d9fd13d8a777b17f3d871cb59eadc8b80fa1e0ebfd2bdfd68de52110e27fd6a35c73a29c4f34fafc0b647386a6073bb17b91
6
+ metadata.gz: f8a1fbde18532af461b0051de5a9a35beeefa4e6b9826cbbc65d8ce4ac73b91ce6d40d81c7b3d3fd6d68a989c74441cd0ee45d9cd1f8d9f1c7e50095a4666cd1
7
+ data.tar.gz: 79c75b2a9c9654ecf61a520aaa1e1bc3c2802d189b540238dd4556108c00255e0d88155f2d96200c11a8ddb870b4ee16be2e8fb0cd1b34e6e80597b7661b357d
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
- [![Build Status](https://travis-ci.org/Invoiced/invoiced-ruby.svg?branch=master)](https://travis-ci.org/Invoiced/invoiced-ruby)
6
+ [![Build Status](https://travis-ci.com/Invoiced/invoiced-ruby.svg?branch=master)](https://travis-ci.com/Invoiced/invoiced-ruby)
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
8
  [![Gem Version](https://badge.fury.io/rb/invoiced.svg)](https://badge.fury.io/rb/invoiced)
9
9
 
@@ -45,10 +45,16 @@ Then, API calls can be made like this:
45
45
  invoice = invoiced.Invoice.retrieve("{INVOICE_ID}")
46
46
 
47
47
  # mark as paid
48
- transaction = invoiced.Transaction.create(
49
- :invoice => invoice.id,
48
+ payment = invoiced.Payment.create(
50
49
  :amount => invoice.balance,
51
- :method => "check")
50
+ :method => "check",
51
+ :applied_to => [
52
+ {
53
+ :type => "invoice",
54
+ :invoice => invoice.id,
55
+ :amount => invoice.balance
56
+ }
57
+ ])
52
58
  ```
53
59
 
54
60
  If you want to use the sandbox API instead then you must set the second argument on the client to `true` like this:
@@ -22,7 +22,7 @@ require 'invoiced/payment_source_object'
22
22
  require 'invoiced/attachment'
23
23
  require 'invoiced/bank_account'
24
24
  require 'invoiced/card'
25
- require 'invoiced/catalog_item'
25
+ require 'invoiced/item'
26
26
  require 'invoiced/charge'
27
27
  require 'invoiced/contact'
28
28
  require 'invoiced/coupon'
@@ -56,7 +56,7 @@ module Invoiced
56
56
  ReadTimeout = 80
57
57
 
58
58
  attr_reader :api_key, :api_url, :sandbox, :sso_key
59
- attr_reader :CatalogItem, :Charge, :Coupon, :CreditNote, :Customer, :Estimate, :Event, :File, :Invoice, :Note, :Payment, :Plan, :Refund, :Subscription, :Task, :TaxRate, :Transaction
59
+ attr_reader :Item, :Charge, :Coupon, :CreditNote, :Customer, :Estimate, :Event, :File, :Invoice, :Note, :Payment, :Plan, :Refund, :Subscription, :Task, :TaxRate, :Transaction
60
60
 
61
61
  def initialize(api_key, sandbox=false, sso_key=false)
62
62
  @api_key = api_key
@@ -65,7 +65,7 @@ module Invoiced
65
65
  @sso_key = sso_key
66
66
 
67
67
  # Object endpoints
68
- @CatalogItem = Invoiced::CatalogItem.new(self)
68
+ @Item = Invoiced::Item.new(self)
69
69
  @Charge = Invoiced::Charge.new(self)
70
70
  @Coupon = Invoiced::Coupon.new(self)
71
71
  @CreditNote = Invoiced::CreditNote.new(self)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Invoiced
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -1,13 +1,13 @@
1
1
  require File.expand_path('../../test_helper', __FILE__)
2
2
 
3
3
  module Invoiced
4
- class CatalogItemTest < Test::Unit::TestCase
4
+ class ItemTest < Test::Unit::TestCase
5
5
  should "return the api endpoint" do
6
- catalogItem = CatalogItem.new(@client, "test")
7
- assert_equal('/catalog_items/test', catalogItem.endpoint())
6
+ item = Item.new(@client, "test")
7
+ assert_equal('/items/test', item.endpoint())
8
8
  end
9
9
 
10
- should "create a catalog item" do
10
+ should "create an item" do
11
11
  mockResponse = mock('RestClient::Response')
12
12
  mockResponse.stubs(:code).returns(201)
13
13
  mockResponse.stubs(:body).returns('{"id":"test","name":"Test Item"}')
@@ -15,14 +15,14 @@ module Invoiced
15
15
 
16
16
  RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
17
17
 
18
- catalogItem = @client.CatalogItem.create({:name => "Test Item"})
18
+ item = @client.Item.create({:name => "Test Item"})
19
19
 
20
- assert_instance_of(Invoiced::CatalogItem, catalogItem)
21
- assert_equal("test", catalogItem.id)
22
- assert_equal('Test Item', catalogItem.name)
20
+ assert_instance_of(Invoiced::Item, item)
21
+ assert_equal("test", item.id)
22
+ assert_equal('Test Item', item.name)
23
23
  end
24
24
 
25
- should "retrieve a catalog item" do
25
+ should "retrieve an item" do
26
26
  mockResponse = mock('RestClient::Response')
27
27
  mockResponse.stubs(:code).returns(200)
28
28
  mockResponse.stubs(:body).returns('{"id":"test","name":"Test Item"}')
@@ -30,19 +30,19 @@ module Invoiced
30
30
 
31
31
  RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
32
32
 
33
- catalogItem = @client.CatalogItem.retrieve("test")
33
+ item = @client.Item.retrieve("test")
34
34
 
35
- assert_instance_of(Invoiced::CatalogItem, catalogItem)
36
- assert_equal("test", catalogItem.id)
37
- assert_equal('Test Item', catalogItem.name)
35
+ assert_instance_of(Invoiced::Item, item)
36
+ assert_equal("test", item.id)
37
+ assert_equal('Test Item', item.name)
38
38
  end
39
39
 
40
- should "not update a catalog item when no params" do
41
- catalogItem = CatalogItem.new(@client, "test")
42
- assert_false(catalogItem.save)
40
+ should "not update an item when no params" do
41
+ item = Item.new(@client, "test")
42
+ assert_false(item.save)
43
43
  end
44
44
 
45
- should "update a catalog item" do
45
+ should "update an item" do
46
46
  mockResponse = mock('RestClient::Response')
47
47
  mockResponse.stubs(:code).returns(200)
48
48
  mockResponse.stubs(:body).returns('{"id":"test","closed":true}')
@@ -50,32 +50,32 @@ module Invoiced
50
50
 
51
51
  RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
52
52
 
53
- catalogItem = CatalogItem.new(@client, "test")
54
- catalogItem.closed = true
55
- assert_true(catalogItem.save)
53
+ item = Item.new(@client, "test")
54
+ item.closed = true
55
+ assert_true(item.save)
56
56
 
57
- assert_true(catalogItem.closed)
57
+ assert_true(item.closed)
58
58
  end
59
59
 
60
- should "list all catalog items" do
60
+ should "list all items" do
61
61
  mockResponse = mock('RestClient::Response')
62
62
  mockResponse.stubs(:code).returns(200)
63
63
  mockResponse.stubs(:body).returns('[{"id":"test","name":"Test Item"}]')
64
- mockResponse.stubs(:headers).returns(:x_total_count => 15, :link => '<https://api.invoiced.com/catalog_items?per_page=25&page=1>; rel="self", <https://api.invoiced.com/catalog_items?per_page=25&page=1>; rel="first", <https://api.invoiced.com/catalog_items?per_page=25&page=1>; rel="last"')
64
+ mockResponse.stubs(:headers).returns(:x_total_count => 15, :link => '<https://api.invoiced.com/items?per_page=25&page=1>; rel="self", <https://api.invoiced.com/items?per_page=25&page=1>; rel="first", <https://api.invoiced.com/items?per_page=25&page=1>; rel="last"')
65
65
 
66
66
  RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
67
67
 
68
- catalogItems, metadata = @client.CatalogItem.list
68
+ items, metadata = @client.Item.list
69
69
 
70
- assert_instance_of(Array, catalogItems)
71
- assert_equal(1, catalogItems.length)
72
- assert_equal("test", catalogItems[0].id)
70
+ assert_instance_of(Array, items)
71
+ assert_equal(1, items.length)
72
+ assert_equal("test", items[0].id)
73
73
 
74
74
  assert_instance_of(Invoiced::List, metadata)
75
75
  assert_equal(15, metadata.total_count)
76
76
  end
77
77
 
78
- should "delete a catalog item" do
78
+ should "delete an item" do
79
79
  mockResponse = mock('RestClient::Response')
80
80
  mockResponse.stubs(:code).returns(204)
81
81
  mockResponse.stubs(:body).returns('')
@@ -83,8 +83,8 @@ module Invoiced
83
83
 
84
84
  RestClient::Request.any_instance.expects(:execute).returns(mockResponse)
85
85
 
86
- catalogItem = CatalogItem.new(@client, "test")
87
- assert_true(catalogItem.delete)
86
+ item = Item.new(@client, "test")
87
+ assert_true(item.delete)
88
88
  end
89
89
  end
90
90
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invoiced
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared King
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-06 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -55,7 +55,6 @@ files:
55
55
  - lib/invoiced/attachment.rb
56
56
  - lib/invoiced/bank_account.rb
57
57
  - lib/invoiced/card.rb
58
- - lib/invoiced/catalog_item.rb
59
58
  - lib/invoiced/charge.rb
60
59
  - lib/invoiced/contact.rb
61
60
  - lib/invoiced/coupon.rb
@@ -72,6 +71,7 @@ files:
72
71
  - lib/invoiced/event.rb
73
72
  - lib/invoiced/file.rb
74
73
  - lib/invoiced/invoice.rb
74
+ - lib/invoiced/item.rb
75
75
  - lib/invoiced/letter.rb
76
76
  - lib/invoiced/line_item.rb
77
77
  - lib/invoiced/list.rb
@@ -94,7 +94,6 @@ files:
94
94
  - lib/invoiced/transaction.rb
95
95
  - lib/invoiced/util.rb
96
96
  - lib/invoiced/version.rb
97
- - test/invoiced/catalog_item_test.rb
98
97
  - test/invoiced/charge_test.rb
99
98
  - test/invoiced/contact_test.rb
100
99
  - test/invoiced/coupon_test.rb
@@ -106,6 +105,7 @@ files:
106
105
  - test/invoiced/file_test.rb
107
106
  - test/invoiced/invoice_test.rb
108
107
  - test/invoiced/invoiced_test.rb
108
+ - test/invoiced/item_test.rb
109
109
  - test/invoiced/line_item_test.rb
110
110
  - test/invoiced/note_test.rb
111
111
  - test/invoiced/object_test.rb
@@ -144,7 +144,6 @@ signing_key:
144
144
  specification_version: 4
145
145
  summary: Ruby client library for the Invoiced API
146
146
  test_files:
147
- - test/invoiced/catalog_item_test.rb
148
147
  - test/invoiced/charge_test.rb
149
148
  - test/invoiced/contact_test.rb
150
149
  - test/invoiced/coupon_test.rb
@@ -156,6 +155,7 @@ test_files:
156
155
  - test/invoiced/file_test.rb
157
156
  - test/invoiced/invoice_test.rb
158
157
  - test/invoiced/invoiced_test.rb
158
+ - test/invoiced/item_test.rb
159
159
  - test/invoiced/line_item_test.rb
160
160
  - test/invoiced/note_test.rb
161
161
  - test/invoiced/object_test.rb