billimatic-client 0.16.0 → 0.17.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa9cb834e47517283f93ba21dbc5afbb9dd51ff0
4
- data.tar.gz: 24a62050b9ac2a0074857cc26ce2d494ea005fe4
3
+ metadata.gz: 273c87649ed1394f123501e60a78a809ae701568
4
+ data.tar.gz: e2a2400590bf74074baaf6a0f1cce5aed6f791e9
5
5
  SHA512:
6
- metadata.gz: 1b479d2da1053da77477cea3950bb51f3ad272322b9a045626ff16bc4435baa174a816902904bc7a35e37f7300109ebfe246f4db6a404e9e4a5503eb470206ec
7
- data.tar.gz: 9bb6630829b150048a6166720732d57ecbb2c118a46fc77d8ace3fe09ed0b5f200a76392fad76722e96dd334a1a78e1900f8f24127219a2d78e5cbb0cc315568
6
+ metadata.gz: 120c58c071036a09fccaaf0b8c359e4b569b2025f4b0d363a9520299182b57b08d9ae1aedd6dd0b1e0566615c08afc9405125ae273f1ae33e97725d98d554690
7
+ data.tar.gz: 437eaeb96aeed33a026ea2d3119711291adf68684f85c0b18b63e40d1a365fe115081b599460b675de430a0012ae6d5607659c3e901cf821f8d1dd087476ded9
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## v0.17.0
6
+ - Adds InvoiceRule#list and InvoiceRule#destroy endpoints.
7
+ - Adds `contract_id` field on InvoiceRule entity.
8
+
5
9
  ## v0.16.0
6
10
  - Changes `scheduled_updates` field on InvoiceRule entity, to become a collection of scheduled_update hashes.
7
11
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- billimatic-client (0.16.0)
4
+ billimatic-client (0.17.0)
5
5
  multi_json (~> 1.11)
6
6
  typhoeus (~> 0.8)
7
7
  virtus (~> 1.0.5)
data/README.md CHANGED
@@ -429,10 +429,21 @@ client = Billimatic.client("YOUR_TOKEN_HERE")
429
429
  <th>Endpoint</th>
430
430
  <th>Client method</th>
431
431
  </tr>
432
+ <tr>
433
+ <td><code>GET</code></td>
434
+ <td>
435
+ <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_index_get_0" target="_blank">
436
+ /api/v1/contracts/:contract_id/invoice_rules
437
+ </a>
438
+ </td>
439
+ <td>
440
+ <code>client.invoice_rules.list(contract_id: id)</code>
441
+ </td>
442
+ </tr>
432
443
  <tr>
433
444
  <td><code>POST</code></td>
434
445
  <td>
435
- <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_create_post_0" target="_blank">
446
+ <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_create_post_1" target="_blank">
436
447
  /api/v1/contracts/:contract_id/invoice_rules
437
448
  </a>
438
449
  </td>
@@ -443,7 +454,7 @@ client = Billimatic.client("YOUR_TOKEN_HERE")
443
454
  <tr>
444
455
  <td><code>PUT</code></td>
445
456
  <td>
446
- <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_update_patch_1" target="_blank">
457
+ <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_update_patch_2" target="_blank">
447
458
  /api/v1/contracts/:contract_id/invoice_rules/:id
448
459
  </a>
449
460
  </td>
@@ -451,6 +462,17 @@ client = Billimatic.client("YOUR_TOKEN_HERE")
451
462
  <code>client.invoice_rules.update(id, attributes_hash, contract_id: id)</code>
452
463
  </td>
453
464
  </tr>
465
+ <tr>
466
+ <td><code>DELETE</code></td>
467
+ <td>
468
+ <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_destroy_delete_3" target="_blank">
469
+ /api/v1/contracts/:contract_id/invoice_rules/:id
470
+ </a>
471
+ </td>
472
+ <td>
473
+ <code>client.invoice_rules.destroy(id, contract_id: id)</code>
474
+ </td>
475
+ </tr>
454
476
  </table>
455
477
 
456
478
  #### [Companies](https://app.billimatic.com.br/docs/api#!/companies)
@@ -2,6 +2,7 @@ module Billimatic
2
2
  module Entities
3
3
  class InvoiceRule < Base
4
4
  attribute :id, Integer
5
+ attribute :contract_id, Integer
5
6
  attribute :gross_value, Decimal
6
7
  attribute :description, String
7
8
  attribute :nfe_body, String
@@ -1,22 +1,30 @@
1
1
  module Billimatic
2
2
  module Resources
3
3
  class InvoiceRule < Base
4
+ def list(contract_id:)
5
+ http.get(
6
+ "/contracts/#{contract_id}#{resource_base_path}"
7
+ ) { |response| respond_with_collection(response) }
8
+ end
9
+
4
10
  def create(params, contract_id:)
5
11
  http.post(
6
12
  "/contracts/#{contract_id}#{resource_base_path}",
7
13
  body: { underscored_klass_name.to_sym => params }
8
- ) do |response|
9
- respond_with_entity(response)
10
- end
14
+ ) { |response| respond_with_entity(response) }
11
15
  end
12
16
 
13
17
  def update(id, params, contract_id:)
14
18
  http.put(
15
19
  "/contracts/#{contract_id}#{resource_base_path}/#{id}",
16
20
  body: { underscored_klass_name.to_sym => params }
17
- ) do |response|
18
- respond_with_entity(response)
19
- end
21
+ ) { |response| respond_with_entity(response) }
22
+ end
23
+
24
+ def destroy(id, contract_id:)
25
+ http.delete(
26
+ "/contracts/#{contract_id}#{resource_base_path}/#{id}"
27
+ ) { |response| response.code == 204 }
20
28
  end
21
29
  end
22
30
  end
@@ -1,3 +1,3 @@
1
1
  module Billimatic
2
- VERSION = '0.16.0'
2
+ VERSION = '0.17.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billimatic-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Tassinari de Oliveira
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: exe
13
13
  cert_chain: []
14
- date: 2018-04-27 00:00:00.000000000 Z
14
+ date: 2018-06-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: typhoeus