octobat 2.0.18 → 2.0.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 346d7f40d07e9514915f5752d92de705bd6d3875
4
- data.tar.gz: c0e09511acf91497cbe1d3dac2e30073e5480cce
3
+ metadata.gz: 34920a5c3e02774dc3c34f466dd9976748a83d01
4
+ data.tar.gz: 874a799adf02044785ee24bdb1ba40293d60cb10
5
5
  SHA512:
6
- metadata.gz: 9ad71a3790764557809ccc97b339d1492efd6ee5524e24bb88ee63e478a09db741ce70e9eaa1fb4918e33df6f78b06cfc51b3b446a0fe8e1b59ff9cdc55feaae
7
- data.tar.gz: 533fde0cda76b7581715078d0d6c8eefb3a0aa9cbeaa0b35ffb209bd1370b3e87a969c62c4edbff3a27f24f3ed7d0d062d1ecf2623970ca46329fb2457a2aa60
6
+ metadata.gz: 00e77e52e4ec757ad3a643361cf1b926a0f1003cf59d8649e6ffa36c7c45ef68b7e2486bf915e390684a14baa19357df51218bb12de0be1e5b37210d13edce95
7
+ data.tar.gz: 949f9a01bc21c9eb3f38d6a693cf35c785bcbde52ca64fb8723a307e95e0404be59e30fae72c76c5f32c7a3817f807b9f459c4074089b94f9368e4c89fc72541
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- octobat (2.0.18)
4
+ octobat (2.0.19)
5
5
  rest-client (>= 1.4, < 4.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,9 @@
1
+ === 2.0.19 2020-05-28
2
+ * 2 major enhancements:
3
+ * Add { opts } param for all nested methods, so you can include headers such as the Connected Octobat Account ID in subrequests
4
+ * Add support for CreditNote#cancel endpoint
5
+
6
+
1
7
  === 2.0.18 2020-05-25
2
8
  * 3 major enhancements:
3
9
  * Add support for multipart encoder (file upload)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.18
1
+ 2.0.19
@@ -4,20 +4,21 @@ module Octobat
4
4
  include Octobat::APIOperations::Create
5
5
  include Octobat::APIOperations::Update
6
6
 
7
- def activate
8
- response, api_key = Octobat.request(:patch, activate_url, @api_key)
7
+ def activate(params = {}, opts = {})
8
+ response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
9
9
  refresh_from(response, api_key)
10
10
  end
11
11
 
12
- def unactivate
13
- response, api_key = Octobat.request(:patch, unactivate_url, @api_key)
12
+ def unactivate(params = {}, opts = {})
13
+ response, api_key = Octobat.request(:patch, unactivate_url, @api_key, params, opts)
14
14
  refresh_from(response, api_key)
15
15
  end
16
16
 
17
- def delete
18
- response, api_key = Octobat.request(:delete, url, @api_key)
17
+ def delete(params = {}, opts = {})
18
+ response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
19
19
  refresh_from(response, api_key)
20
20
  end
21
+
21
22
 
22
23
  private
23
24
 
@@ -12,30 +12,41 @@ module Octobat
12
12
 
13
13
  instance = self.new(nil, opts)
14
14
 
15
- response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params)
15
+ response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params, headers)
16
16
  return true
17
17
  end
18
18
 
19
19
 
20
- def send_by_email(email_data = {})
21
- response, api_key = Octobat.request(:post, send_url, @api_key, email_data)
20
+ def send_by_email(params = {}, opts = {})
21
+ response, api_key = Octobat.request(:post, send_url, @api_key, params, opts)
22
22
  refresh_from(response, api_key)
23
23
  end
24
24
 
25
- def confirm(confirmation_data = {})
26
- response, api_key = Octobat.request(:patch, confirm_url, @api_key, confirmation_data)
25
+ def confirm(params = {}, opts = {})
26
+ response, api_key = Octobat.request(:patch, confirm_url, @api_key, params, opts)
27
27
  refresh_from(response, api_key)
28
28
  end
29
+
30
+
31
+ def cancel(params = {}, opts = {})
32
+ response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
33
+ refresh_from(response, api_key)
34
+ end
35
+
36
+
29
37
 
30
- def items(params = {})
31
- Item.list(params.merge({credit_note: id }), @api_key)
38
+ def items(params = {}, opts = {})
39
+ Item.list(params.merge({ credit_note: id }), {api_key: @api_key}.merge(opts))
32
40
  end
33
41
 
34
- def transactions(params = {})
35
- Transaction.list(params.merge(credit_note: id), @api_key)
42
+ def transactions(params = {}, opts = {})
43
+ Transaction.list(params.merge(credit_note: id), {api_key: @api_key}.merge(opts))
36
44
  end
37
45
 
38
46
  private
47
+ def cancel_url
48
+ url + '/cancel'
49
+ end
39
50
 
40
51
  def send_url
41
52
  url + '/send'
@@ -4,8 +4,8 @@ module Octobat
4
4
  include Octobat::APIOperations::Create
5
5
  include Octobat::APIOperations::Update
6
6
 
7
- def set_to_default
8
- response, api_key = Octobat.request(:patch, set_to_default_url, @api_key)
7
+ def set_to_default(params = {}, opts = {})
8
+ response, api_key = Octobat.request(:patch, set_to_default_url, @api_key, params, opts)
9
9
  refresh_from(response, api_key)
10
10
  end
11
11
 
@@ -5,16 +5,16 @@ module Octobat
5
5
  include Octobat::APIOperations::Update
6
6
  include Octobat::APIOperations::Delete
7
7
 
8
- def invoices(params = {})
9
- Invoice.all(params.merge({ :customer => id }), @api_key)
8
+ def invoices(params = {}, opts = {})
9
+ Invoice.list(params.merge({ :customer => id }), {api_key: @api_key}.merge(opts))
10
10
  end
11
11
 
12
- def credit_notes(params = {})
13
- CreditNote.all(params.merge({ :customer => id }), @api_key)
12
+ def credit_notes(params = {}, opts = {})
13
+ CreditNote.list(params.merge({ :customer => id }), {api_key: @api_key}.merge(opts))
14
14
  end
15
15
 
16
- def payment_sources(params = {})
17
- PaymentSource.all(params.merge({ :customer => id }), @api_key)
16
+ def payment_sources(params = {}, opts = {})
17
+ PaymentSource.list(params.merge({ :customer => id }), {api_key: @api_key}.merge(opts))
18
18
  end
19
19
  end
20
20
  end
@@ -1,7 +1,6 @@
1
1
  module Octobat
2
2
  class Document < APIResource
3
3
 
4
-
5
4
  def self.csv_export(params = {}, opts={})
6
5
  api_key, headers = Util.parse_opts(opts)
7
6
  api_key ||= @api_key
@@ -9,7 +8,7 @@ module Octobat
9
8
 
10
9
  instance = self.new(nil, opts)
11
10
 
12
- response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params)
11
+ response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params, opts)
13
12
  return true
14
13
  end
15
14
 
@@ -10,7 +10,7 @@ module Octobat
10
10
 
11
11
  instance = self.new(nil, opts)
12
12
 
13
- response, api_key = Octobat.request(:get, url + '/default', api_key, params)
13
+ response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
14
14
  instance.refresh_from(response, api_key)
15
15
  instance
16
16
  end
@@ -10,7 +10,7 @@ module Octobat
10
10
 
11
11
  instance = self.new(nil, opts)
12
12
 
13
- response, api_key = Octobat.request(:get, url + '/default', api_key, params)
13
+ response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
14
14
  instance.refresh_from(response, api_key)
15
15
  instance
16
16
  end
@@ -4,23 +4,23 @@ module Octobat
4
4
  include Octobat::APIOperations::Create
5
5
  include Octobat::APIOperations::Update
6
6
 
7
- def duplicate(params = {})
8
- response, api_key = Octobat.request(:post, duplicate_url, @api_key, params)
7
+ def duplicate(params = {}, opts = {})
8
+ response, api_key = Octobat.request(:post, duplicate_url, @api_key, params, opts)
9
9
  refresh_from(response, api_key)
10
10
  end
11
11
 
12
- def activate
13
- response, api_key = Octobat.request(:patch, activate_url, @api_key)
12
+ def activate(params = {}, opts = {})
13
+ response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
14
14
  refresh_from(response, api_key)
15
15
  end
16
16
 
17
- def delete
18
- response, api_key = Octobat.request(:delete, url, @api_key)
17
+ def delete(params = {}, opts = {})
18
+ response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
19
19
  refresh_from(response, api_key)
20
20
  end
21
21
 
22
- def preview(params = {})
23
- response, api_key = Octobat.request(:get, preview_url, @api_key, params)
22
+ def preview(params = {}, opts = {})
23
+ response, api_key = Octobat.request(:get, preview_url, @api_key, params, opts)
24
24
  refresh_from(response, api_key)
25
25
  end
26
26
 
@@ -10,7 +10,7 @@ module Octobat
10
10
 
11
11
  instance = self.new(nil, opts)
12
12
 
13
- response, api_key = Octobat.request(:get, url + '/default', api_key, params)
13
+ response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
14
14
  instance.refresh_from(response, api_key)
15
15
  instance
16
16
  end
@@ -10,7 +10,7 @@ module Octobat
10
10
 
11
11
  instance = self.new(nil, opts)
12
12
 
13
- response, api_key = Octobat.request(:get, url + '/default', api_key, params)
13
+ response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
14
14
  instance.refresh_from(response, api_key)
15
15
  instance
16
16
  end
@@ -12,7 +12,7 @@ module Octobat
12
12
 
13
13
  instance = self.new(nil, opts)
14
14
 
15
- response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params)
15
+ response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params, opts)
16
16
  return true
17
17
  end
18
18
 
@@ -23,42 +23,42 @@ module Octobat
23
23
 
24
24
  instance = self.new(nil, opts)
25
25
 
26
- response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params)
26
+ response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params, opts)
27
27
  return true
28
28
  end
29
29
 
30
30
 
31
- def send_by_email(email_data = {})
32
- response, api_key = Octobat.request(:post, send_url, @api_key, email_data)
31
+ def send_by_email(params = {}, opts = {})
32
+ response, api_key = Octobat.request(:post, send_url, @api_key, params, opts)
33
33
  refresh_from(response, api_key)
34
34
  end
35
35
 
36
- def confirm(confirmation_data = {})
37
- response, api_key = Octobat.request(:patch, confirm_url, @api_key, confirmation_data)
36
+ def confirm(params = {}, opts = {})
37
+ response, api_key = Octobat.request(:patch, confirm_url, @api_key, params, opts)
38
38
  refresh_from(response, api_key)
39
39
  end
40
40
 
41
- def cancel
42
- response, api_key = Octobat.request(:patch, cancel_url, @api_key)
41
+ def cancel(params = {}, opts = {})
42
+ response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
43
43
  refresh_from(response, api_key)
44
44
  end
45
45
 
46
- def cancel_and_replace
47
- response, api_key = Octobat.request(:patch, cancel_and_replace_url, @api_key)
46
+ def cancel_and_replace(params = {}, opts = {})
47
+ response, api_key = Octobat.request(:patch, cancel_and_replace_url, @api_key, params, opts)
48
48
  refresh_from(response, api_key)
49
49
  end
50
50
 
51
- def delete
52
- response, api_key = Octobat.request(:delete, url, @api_key)
51
+ def delete(params = {}, opts = {})
52
+ response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
53
53
  refresh_from(response, api_key)
54
54
  end
55
55
 
56
- def items(params = {})
57
- Item.list(params.merge({ :invoice => id }), @api_key)
56
+ def items(params = {}, opts = {})
57
+ Item.list(params.merge({ :invoice => id }), {api_key: @api_key}.merge(opts))
58
58
  end
59
59
 
60
- def transactions(params = {})
61
- Transaction.list(params.merge(invoice: id), @api_key)
60
+ def transactions(params = {}, opts = {})
61
+ Transaction.list(params.merge(invoice: id), {api_key: @api_key}.merge(opts))
62
62
  end
63
63
 
64
64
 
@@ -4,8 +4,8 @@ module Octobat
4
4
  include Octobat::APIOperations::Create
5
5
  include Octobat::APIOperations::Update
6
6
 
7
- def set_to_default
8
- response, api_key = Octobat.request(:patch, set_to_default_url, @api_key)
7
+ def set_to_default(params = {}, opts = {})
8
+ response, api_key = Octobat.request(:patch, set_to_default_url, @api_key, params, opts)
9
9
  refresh_from(response, api_key)
10
10
  end
11
11
 
@@ -3,8 +3,8 @@ module Octobat
3
3
  extend Octobat::APIOperations::List
4
4
  include Octobat::APIOperations::Update
5
5
 
6
- def expire
7
- response, api_key = Octobat.request(:patch, expire_url, @api_key)
6
+ def expire(params = {}, opts = {})
7
+ response, api_key = Octobat.request(:patch, expire_url, @api_key, params, opts)
8
8
  refresh_from(response, api_key)
9
9
  end
10
10
 
@@ -2,8 +2,8 @@ module Octobat
2
2
  class Payout < APIResource
3
3
  extend Octobat::APIOperations::List
4
4
 
5
- def balance_transactions(params = {})
6
- BalanceTransaction.list(params.merge({ payout: id }), @api_key)
5
+ def balance_transactions(params = {}, opts = {})
6
+ BalanceTransaction.list(params.merge({ payout: id }), {api_key: @api_key}.merge(opts))
7
7
  end
8
8
 
9
9
  def self.csv_export(params = {}, opts={})
@@ -9,7 +9,7 @@ module Octobat
9
9
 
10
10
  instance = self.new(nil, opts)
11
11
 
12
- response, api_key = Octobat.request(:post, url + '/for_supplier', api_key, params)
12
+ response, api_key = Octobat.request(:post, url + '/for_supplier', api_key, params, opts)
13
13
  instance.refresh_from(response, api_key)
14
14
  instance
15
15
  end
@@ -4,8 +4,8 @@ module Octobat
4
4
  include Octobat::APIOperations::Create
5
5
  include Octobat::APIOperations::Update
6
6
 
7
- def archive
8
- response, api_key = Octobat.request(:patch, archive_url, @api_key)
7
+ def archive(params = {}, opts = {})
8
+ response, api_key = Octobat.request(:patch, archive_url, @api_key, params, opts)
9
9
  refresh_from(response, api_key)
10
10
  end
11
11
 
@@ -4,13 +4,13 @@ module Octobat
4
4
  include Octobat::APIOperations::Update
5
5
  include Octobat::APIOperations::Create
6
6
 
7
- def activate
8
- response, api_key = Octobat.request(:patch, activate_url, @api_key)
7
+ def activate(params = {}, opts = {})
8
+ response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
9
9
  refresh_from(response, api_key)
10
10
  end
11
11
 
12
- def unactivate
13
- response, api_key = Octobat.request(:patch, unactivate_url, @api_key)
12
+ def unactivate(params = {}, opts = {})
13
+ response, api_key = Octobat.request(:patch, unactivate_url, @api_key, params, opts)
14
14
  refresh_from(response, api_key)
15
15
  end
16
16
 
@@ -4,8 +4,8 @@ module Octobat
4
4
  include Octobat::APIOperations::Create
5
5
  include Octobat::APIOperations::Update
6
6
 
7
- def items(params = {})
8
- Item.list(params.merge({ :transaction => id }), @api_key)
7
+ def items(params = {}, opts = {})
8
+ Item.list(params.merge({ :transaction => id }), {api_key: @api_key}.merge(opts))
9
9
  end
10
10
 
11
11
  def self.csv_export(params = {}, opts={})
@@ -1,3 +1,3 @@
1
1
  module Octobat
2
- VERSION = '2.0.18'
2
+ VERSION = '2.0.19'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octobat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.18
4
+ version: 2.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gaultier Laperche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-25 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client