billimatic-client 0.4.0 → 0.5.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,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 255b2eb1e4ea6e2f62bb031fa9d1b9b7a9d85c1d
4
- data.tar.gz: c86d27945074cbdc62702d2231bf6054c7f0b83a
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTEzZTllNDg2MzU1N2UyZDJiMTEyNzU4MWZlOWZhNzAzZTlkYzI3MQ==
5
+ data.tar.gz: !binary |-
6
+ Mzk1ZjhjZTViZTRlMTMxMWFmZjdkZWUzNzA3ODk1ZGY4MjZjMWFkNg==
5
7
  SHA512:
6
- metadata.gz: 711663f6767076a50e98d4736ec1d9801021db43e1d78b501c566a8edc8a903a1a76716046bb0a620521fc4c39bc0665c18dd8ea56252640f4ccc46895227215
7
- data.tar.gz: 7038283e05cdb963ea517a6c48a76b743967f9b446b11b7ad09b13e611bd56529d8eaf240f7d4eef3b9b6001a0fbb995ade1256f9b0a72e4cdd9cef3317343f4
8
+ metadata.gz: !binary |-
9
+ YjZhZmZlMzBkMDg3YTVlMzU0Njc4MmI0ZDdlMTZjNzc4NGZlNDQ0ZGE5MDZj
10
+ MTZlZWY1OWE5NGIyNzJkZWFmYWMzN2I2MGVmMmQ2YTMwZWNjODU2M2Y1YTNh
11
+ NWZmNjM5ZTQ0NGVhYjQ0ZGVkZjhhMTc4NTQxODMzYzEzZGNiNDQ=
12
+ data.tar.gz: !binary |-
13
+ Y2FhMWVlYTBmZjk3YzBhMTdlZWRiM2MxZjdkZTI3YmViODBmOTE2ZmQ5Nzk1
14
+ ODViY2U1ZGY2NTQ0ZTc2NWYyMTFjZTIwNjZmNmE2NWQ0MTc5ZWQ0NDFjYTc4
15
+ NTM5MjdhNTBhNjk1NWRjNTkwYjVjM2U3MTIwYWUzMmNlN2ViNWI=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- billimatic-client (0.4.0)
4
+ billimatic-client (0.5.0)
5
5
  multi_json (~> 1.11)
6
6
  typhoeus (~> 0.8)
7
7
  virtus (~> 1.0.5)
data/README.md CHANGED
@@ -50,6 +50,7 @@ client = Billimatic.client("YOUR_TOKEN_HERE")
50
50
  * [Companies API](https://app.billimatic.com.br/docs/api#!/companies) as `client.companies`
51
51
  * [Plans API](https://app.billimatic.com.br/docs/api#!/plans) as `client.plans`
52
52
  * [Subscriptions API](https://app.billimatic.com.br/docs/api#!/subscriptions) as `client.subscriptions`
53
+ * [Invoice Rules API](https://app.billimatic.com.br/docs/api#!/invoice_rules) as `client.invoice_rules`
53
54
 
54
55
  ## Endpoints
55
56
 
@@ -126,6 +127,39 @@ client = Billimatic.client("YOUR_TOKEN_HERE")
126
127
  <code>client.plans.list(organization_id: id)</code>
127
128
  </td>
128
129
  </tr>
130
+ <tr>
131
+ <td><code>POST</code></td>
132
+ <td>
133
+ <a href="https://app.billimatic.com.br/docs/api#!/plans/API_V1_Plans_create_post_1" target="_blank">
134
+ /api/v1/organizations/:organization_id/plans
135
+ </a>
136
+ </td>
137
+ <td>
138
+ <code>client.plans.create(attributes_hash, organization_id: id)</code>
139
+ </td>
140
+ </tr>
141
+ <tr>
142
+ <td><code>PATCH</code></td>
143
+ <td>
144
+ <a href="https://app.billimatic.com.br/docs/api#!/plans/API_V1_Plans_update_patch_2" target="_blank">
145
+ /api/v1/organizations/:organization_id/plans/:id
146
+ </a>
147
+ </td>
148
+ <td>
149
+ <code>client.plans.update(id, attributes_hash, organization_id: id)</code>
150
+ </td>
151
+ </tr>
152
+ <tr>
153
+ <td><code>DELETE</code></td>
154
+ <td>
155
+ <a href="https://app.billimatic.com.br/docs/api#!/plans/API_V1_Plans_destroy_delete_3" target="_blank">
156
+ /api/v1/organizations/:organization_id/plans/:id
157
+ </a>
158
+ </td>
159
+ <td>
160
+ <code>client.plans.destroy(id, organization_id: id)</code>
161
+ </td>
162
+ </tr>
129
163
  </table>
130
164
 
131
165
  #### [Subscriptions](https://app.billimatic.com.br/docs/api#!/subscriptions)
@@ -171,6 +205,38 @@ client = Billimatic.client("YOUR_TOKEN_HERE")
171
205
  </tr>
172
206
  </table>
173
207
 
208
+ #### [Invoice Rules](https://app.billimatic.com.br/docs/api#!/invoice_rules)
209
+
210
+ <table>
211
+ <tr>
212
+ <th>HTTP method</th>
213
+ <th>Endpoint</th>
214
+ <th>Client method</th>
215
+ </tr>
216
+ <tr>
217
+ <td><code>POST</code></td>
218
+ <td>
219
+ <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_create_post_0" target="_blank">
220
+ /api/v1/contracts/:contract_id/invoice_rules
221
+ </a>
222
+ </td>
223
+ <td>
224
+ <code>client.invoice_rules.create(attributes_hash, contract_id: id)</code>
225
+ </td>
226
+ </tr>
227
+ <tr>
228
+ <td><code>PATCH</code></td>
229
+ <td>
230
+ <a href="https://app.billimatic.com.br/docs/api#!/invoice_rules/API_V1_InvoiceRules_update_patch_1" target="_blank">
231
+ /api/v1/contracts/:contract_id/invoice_rules/:id
232
+ </a>
233
+ </td>
234
+ <td>
235
+ <code>client.invoice_rules.update(id, attributes_hash, contract_id: id)</code>
236
+ </td>
237
+ </tr>
238
+ </table>
239
+
174
240
  ## Url helpers
175
241
 
176
242
  Some url helpers are available:
data/lib/billimatic.rb CHANGED
@@ -12,6 +12,7 @@ require 'billimatic/url_helpers'
12
12
  require 'billimatic/entities/base'
13
13
  require 'billimatic/entities/entity_service_item'
14
14
  require 'billimatic/entities/product'
15
+ require 'billimatic/entities/service'
15
16
  require 'billimatic/entities/plan_feature'
16
17
  require 'billimatic/entities/plan'
17
18
  require 'billimatic/entities/address_information'
@@ -6,6 +6,7 @@ module Billimatic
6
6
  attribute :unit_value, Decimal
7
7
  attribute :units, Decimal
8
8
  attribute :value, Decimal
9
+ attribute :_destroy, Boolean
9
10
  end
10
11
  end
11
12
  end
@@ -2,7 +2,23 @@ module Billimatic
2
2
  module Entities
3
3
  class InvoiceRule < Base
4
4
  attribute :id, Integer
5
- # TODO attributes
5
+ attribute :gross_value, Decimal
6
+ attribute :description, String
7
+ attribute :nfe_body, String
8
+ attribute :charge_type, String
9
+ attribute :customer_id, Integer
10
+ attribute :customer_type, String
11
+ attribute :emites_service_values_id, Integer
12
+ attribute :emites_service_value_name, String
13
+ attribute :finance_category, String
14
+ attribute :finance_revenue_center, String
15
+ attribute :finance_receive_via, String
16
+ attribute :cobrato_charge_config_id, Integer
17
+ attribute :cobrato_charge_config_name, String
18
+ attribute :services, Array[Service]
19
+ attribute :additional_information, Hash
20
+ attribute :scheduled_update, Hash
21
+ attribute :receivables_additional_information, Hash
6
22
  end
7
23
  end
8
24
  end
@@ -5,6 +5,7 @@ module Billimatic
5
5
  attribute :description, String
6
6
  attribute :value, String
7
7
  attribute :tag, String
8
+ attribute :_destroy, Boolean
8
9
  end
9
10
  end
10
11
  end
@@ -0,0 +1,6 @@
1
+ module Billimatic
2
+ module Entities
3
+ class Service < EntityServiceItem
4
+ end
5
+ end
6
+ end
@@ -1,10 +1,23 @@
1
1
  module Billimatic
2
2
  module Resources
3
3
  class InvoiceRule < Base
4
- crud :all # TODO só POST createa
5
-
6
- # TODO...
4
+ def create(params, contract_id:)
5
+ http.post(
6
+ "/contracts/#{contract_id}#{resource_base_path}",
7
+ body: { invoice_rule: params }
8
+ ) do |response|
9
+ respond_with_entity(response)
10
+ end
11
+ end
7
12
 
13
+ def update(id, params, contract_id:)
14
+ http.put(
15
+ "/contracts/#{contract_id}#{resource_base_path}/#{id}",
16
+ body: { invoice_rule: params }
17
+ ) do |response|
18
+ respond_with_entity(response)
19
+ end
20
+ end
8
21
  end
9
22
  end
10
23
  end
@@ -6,6 +6,32 @@ module Billimatic
6
6
  respond_with_collection response
7
7
  end
8
8
  end
9
+
10
+ def create(params, organization_id:)
11
+ http.post(
12
+ "/organizations/#{organization_id}#{resource_base_path}",
13
+ body: { plan: params }
14
+ ) do |response|
15
+ respond_with_entity(response)
16
+ end
17
+ end
18
+
19
+ def update(id, params, organization_id:)
20
+ http.put(
21
+ "/organizations/#{organization_id}#{resource_base_path}/#{id}",
22
+ body: { plan: params }
23
+ ) do |response|
24
+ respond_with_entity(response)
25
+ end
26
+ end
27
+
28
+ def destroy(id, organization_id:)
29
+ http.delete(
30
+ "/organizations/#{organization_id}#{resource_base_path}/#{id}"
31
+ ) do |response|
32
+ response.code == 204
33
+ end
34
+ end
9
35
  end
10
36
  end
11
37
  end
@@ -1,3 +1,3 @@
1
1
  module Billimatic
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Tassinari de Oliveira
@@ -10,188 +10,188 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-07-15 00:00:00.000000000 Z
13
+ date: 2016-09-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: typhoeus
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - "~>"
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: '0.8'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - "~>"
26
+ - - ~>
27
27
  - !ruby/object:Gem::Version
28
28
  version: '0.8'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: multi_json
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - "~>"
33
+ - - ~>
34
34
  - !ruby/object:Gem::Version
35
35
  version: '1.11'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - "~>"
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
42
  version: '1.11'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: virtus
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ~>
48
48
  - !ruby/object:Gem::Version
49
49
  version: 1.0.5
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - "~>"
54
+ - - ~>
55
55
  - !ruby/object:Gem::Version
56
56
  version: 1.0.5
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: wisper
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - "~>"
61
+ - - ~>
62
62
  - !ruby/object:Gem::Version
63
63
  version: 1.6.1
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - "~>"
68
+ - - ~>
69
69
  - !ruby/object:Gem::Version
70
70
  version: 1.6.1
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: bundler
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - "~>"
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
77
  version: '1.11'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - "~>"
82
+ - - ~>
83
83
  - !ruby/object:Gem::Version
84
84
  version: '1.11'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: rake
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - "~>"
89
+ - - ~>
90
90
  - !ruby/object:Gem::Version
91
91
  version: '11.1'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - "~>"
96
+ - - ~>
97
97
  - !ruby/object:Gem::Version
98
98
  version: '11.1'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: vcr
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - "~>"
103
+ - - ~>
104
104
  - !ruby/object:Gem::Version
105
105
  version: '3.0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - "~>"
110
+ - - ~>
111
111
  - !ruby/object:Gem::Version
112
112
  version: '3.0'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: pry-byebug
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - "~>"
117
+ - - ~>
118
118
  - !ruby/object:Gem::Version
119
119
  version: '3.3'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - "~>"
124
+ - - ~>
125
125
  - !ruby/object:Gem::Version
126
126
  version: '3.3'
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: rspec
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - "~>"
131
+ - - ~>
132
132
  - !ruby/object:Gem::Version
133
133
  version: '3.4'
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - "~>"
138
+ - - ~>
139
139
  - !ruby/object:Gem::Version
140
140
  version: '3.4'
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: codeclimate-test-reporter
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - "~>"
145
+ - - ~>
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0.5'
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - "~>"
152
+ - - ~>
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0.5'
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: simplecov
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
- - - "~>"
159
+ - - ~>
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0.11'
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
- - - "~>"
166
+ - - ~>
167
167
  - !ruby/object:Gem::Version
168
168
  version: '0.11'
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: guard-rspec
171
171
  requirement: !ruby/object:Gem::Requirement
172
172
  requirements:
173
- - - "~>"
173
+ - - ~>
174
174
  - !ruby/object:Gem::Version
175
175
  version: '4.6'
176
176
  type: :development
177
177
  prerelease: false
178
178
  version_requirements: !ruby/object:Gem::Requirement
179
179
  requirements:
180
- - - "~>"
180
+ - - ~>
181
181
  - !ruby/object:Gem::Version
182
182
  version: '4.6'
183
183
  - !ruby/object:Gem::Dependency
184
184
  name: test_notifier
185
185
  requirement: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - "~>"
187
+ - - ~>
188
188
  - !ruby/object:Gem::Version
189
189
  version: '2.0'
190
190
  type: :development
191
191
  prerelease: false
192
192
  version_requirements: !ruby/object:Gem::Requirement
193
193
  requirements:
194
- - - "~>"
194
+ - - ~>
195
195
  - !ruby/object:Gem::Version
196
196
  version: '2.0'
197
197
  description: This is the official Ruby client for the Billimatic API. See http://www.billimatic.com.br
@@ -204,11 +204,11 @@ executables: []
204
204
  extensions: []
205
205
  extra_rdoc_files: []
206
206
  files:
207
- - ".codeclimate.yml"
208
- - ".gitignore"
209
- - ".rspec"
210
- - ".rubocop.yml"
211
- - ".travis.yml"
207
+ - .codeclimate.yml
208
+ - .gitignore
209
+ - .rspec
210
+ - .rubocop.yml
211
+ - .travis.yml
212
212
  - Gemfile
213
213
  - Gemfile.lock
214
214
  - Guardfile
@@ -232,6 +232,7 @@ files:
232
232
  - lib/billimatic/entities/plan.rb
233
233
  - lib/billimatic/entities/plan_feature.rb
234
234
  - lib/billimatic/entities/product.rb
235
+ - lib/billimatic/entities/service.rb
235
236
  - lib/billimatic/entities/subscription.rb
236
237
  - lib/billimatic/entities/webhook.rb
237
238
  - lib/billimatic/exception.rb
@@ -260,18 +261,19 @@ require_paths:
260
261
  - lib
261
262
  required_ruby_version: !ruby/object:Gem::Requirement
262
263
  requirements:
263
- - - ">="
264
+ - - ! '>='
264
265
  - !ruby/object:Gem::Version
265
266
  version: '0'
266
267
  required_rubygems_version: !ruby/object:Gem::Requirement
267
268
  requirements:
268
- - - ">="
269
+ - - ! '>='
269
270
  - !ruby/object:Gem::Version
270
271
  version: '0'
271
272
  requirements: []
272
273
  rubyforge_project:
273
- rubygems_version: 2.5.1
274
+ rubygems_version: 2.6.4
274
275
  signing_key:
275
276
  specification_version: 4
276
277
  summary: This is the official Ruby client for the Billimatic API.
277
278
  test_files: []
279
+ has_rdoc: