lago-ruby-client 1.50.0 → 1.52.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
  SHA256:
3
- metadata.gz: 0f8190f69942ee6d4db6ba8eee70cc30f288ef4722a2380bc4fbccdd6da8c0ab
4
- data.tar.gz: e1b21254b6af67400a312feedf60078cd03eeb1e623a860d767aaedaf3753980
3
+ metadata.gz: 35a54ade93d67abf2e5e752fd906385e8b184d8369f7936e1b24ce4a8cefa81b
4
+ data.tar.gz: 3a0aa3a64da8fbb96ea1391dc409b953c86bf9088b4f9655bede97c09280fb7a
5
5
  SHA512:
6
- metadata.gz: 94f3bf16b98f79a7ef7232c75e3449acf60ac3aff7a4775611ca3a20f2de86c9125b3e01cdd51e4c9cb506bcdf2a0e9991c6912065b3790f303fca0c0978a2bf
7
- data.tar.gz: 2c52879f4a93f841a68d3b6c038c671db69f642f7082bd72bc5d9b2e3b69883dc9d4478c85313bd0561ee8d69127f21ca8f265af1754fb4de585b4430dc49f4a
6
+ metadata.gz: e89eb0daf775f8ee800f5f1f858952b3f871c8988792d2a33e28a2bc7850fe5399e9cf5f55258b00115f294e7bb6df533c5698cd3ea0a4c1582535121cf364af
7
+ data.tar.gz: bf65e78de0646a69b4338c2e3659308e757a2380d546a1946b0bab7d67b873037562c6dcb9720b1a2d2a3c6a2c5ee872e5580f181a0ee970d2b307321cdf655a
@@ -32,12 +32,16 @@ require 'lago/api/resources/invoice'
32
32
  require 'lago/api/resources/invoice_collection'
33
33
  require 'lago/api/resources/invoiced_usage'
34
34
  require 'lago/api/resources/mrr'
35
+ require 'lago/api/resources/order_form'
36
+ require 'lago/api/resources/order'
35
37
  require 'lago/api/resources/organization'
36
38
  require 'lago/api/resources/overdue_balance'
37
39
  require 'lago/api/resources/payment'
38
40
  require 'lago/api/resources/payment_receipt'
39
41
  require 'lago/api/resources/payment_request'
40
42
  require 'lago/api/resources/plan'
43
+ require 'lago/api/resources/quote'
44
+ require 'lago/api/resources/quote_version'
41
45
  require 'lago/api/resources/subscription'
42
46
  require 'lago/api/resources/tax'
43
47
  require 'lago/api/resources/usage'
@@ -185,6 +189,14 @@ module Lago
185
189
  Resources::Mrr.new(self)
186
190
  end
187
191
 
192
+ def order_forms
193
+ Resources::OrderForm.new(self)
194
+ end
195
+
196
+ def orders
197
+ Resources::Order.new(self)
198
+ end
199
+
188
200
  def organizations
189
201
  Resources::Organization.new(self)
190
202
  end
@@ -209,6 +221,14 @@ module Lago
209
221
  Resources::Plan.new(self)
210
222
  end
211
223
 
224
+ def quotes
225
+ Resources::Quote.new(self)
226
+ end
227
+
228
+ def quote_versions
229
+ Resources::QuoteVersion.new(self)
230
+ end
231
+
212
232
  def subscriptions
213
233
  Resources::Subscription.new(self)
214
234
  end
@@ -24,6 +24,7 @@ module Lago
24
24
  :paid_top_up_min_amount_cents,
25
25
  :paid_top_up_max_amount_cents,
26
26
  :billing_entity_code,
27
+ :purchase_order_number,
27
28
  )
28
29
 
29
30
  recurring_rules = recurring_rules_params(params[:recurring_transaction_rules])
@@ -72,6 +73,7 @@ module Lago
72
73
  :transaction_name,
73
74
  :ignore_paid_top_up_limits,
74
75
  :grants_target_top_up,
76
+ :purchase_order_number,
75
77
  )
76
78
 
77
79
  payment_method = payment_method_params(r[:payment_method])
@@ -126,7 +126,8 @@ module Lago
126
126
  currency: params[:currency],
127
127
  net_payment_term: params[:net_payment_term],
128
128
  skip_psp: params[:skip_psp],
129
- billing_entity_code: params[:billing_entity_code]
129
+ billing_entity_code: params[:billing_entity_code],
130
+ purchase_order_number: params[:purchase_order_number]
130
131
  }.compact
131
132
 
132
133
  fees = whitelist_fees(params[:fees])
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lago/api/resources/base'
4
+
5
+ module Lago
6
+ module Api
7
+ module Resources
8
+ class Order < Base
9
+ undef_method :create, :update, :destroy
10
+
11
+ def api_resource
12
+ 'orders'
13
+ end
14
+
15
+ def root_name
16
+ 'order'
17
+ end
18
+
19
+ def execute(order_id, params = {})
20
+ path = "/api/v1/orders/#{order_id}/execute"
21
+ payload = whitelist_params(params)
22
+ response = connection.post(payload, path)[root_name]
23
+
24
+ JSON.parse(response.to_json, object_class: OpenStruct)
25
+ end
26
+
27
+ def whitelist_params(params)
28
+ result = {
29
+ execution_mode: params[:execution_mode],
30
+ }.compact
31
+
32
+ return {} if result.empty?
33
+
34
+ { root_name => result }
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lago/api/resources/base'
4
+
5
+ module Lago
6
+ module Api
7
+ module Resources
8
+ class OrderForm < Base
9
+ undef_method :create, :update, :destroy
10
+
11
+ def api_resource
12
+ 'order_forms'
13
+ end
14
+
15
+ def root_name
16
+ 'order_form'
17
+ end
18
+
19
+ def mark_as_signed(order_form_id, params = {})
20
+ path = "/api/v1/order_forms/#{order_form_id}/mark_as_signed"
21
+ payload = whitelist_params(params)
22
+ response = connection.post(payload, path)[root_name]
23
+
24
+ JSON.parse(response.to_json, object_class: OpenStruct)
25
+ end
26
+
27
+ def void(order_form_id)
28
+ path = "/api/v1/order_forms/#{order_form_id}/void"
29
+ response = connection.post({}, path)[root_name]
30
+
31
+ JSON.parse(response.to_json, object_class: OpenStruct)
32
+ end
33
+
34
+ def whitelist_params(params)
35
+ result = {
36
+ signed_document: params[:signed_document],
37
+ execution_mode: params[:execution_mode],
38
+ execute_at: params[:execute_at],
39
+ }.compact
40
+
41
+ return {} if result.empty?
42
+
43
+ { root_name => result }
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lago/api/resources/base'
4
+
5
+ module Lago
6
+ module Api
7
+ module Resources
8
+ class Quote < Base
9
+ undef_method :create, :update, :destroy
10
+
11
+ def api_resource
12
+ 'quotes'
13
+ end
14
+
15
+ def root_name
16
+ 'quote'
17
+ end
18
+
19
+ def versions(quote_id, options = {})
20
+ path = "/api/v1/quotes/#{quote_id}/versions"
21
+ response = connection.get_all(options, path)
22
+
23
+ JSON.parse(response.to_json, object_class: OpenStruct)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'lago/api/resources/base'
4
+
5
+ module Lago
6
+ module Api
7
+ module Resources
8
+ class QuoteVersion < Base
9
+ undef_method :create, :update, :destroy, :get_all
10
+
11
+ def api_resource
12
+ 'quote_versions'
13
+ end
14
+
15
+ def root_name
16
+ 'quote_version'
17
+ end
18
+
19
+ def approve(quote_version_id, params = {})
20
+ path = "/api/v1/quote_versions/#{quote_version_id}/approve"
21
+ payload = whitelist_approve_params(params)
22
+ response = connection.post(payload, path)[root_name]
23
+
24
+ JSON.parse(response.to_json, object_class: OpenStruct)
25
+ end
26
+
27
+ def void(quote_version_id)
28
+ path = "/api/v1/quote_versions/#{quote_version_id}/void"
29
+ response = connection.post({}, path)[root_name]
30
+
31
+ JSON.parse(response.to_json, object_class: OpenStruct)
32
+ end
33
+
34
+ def clone(quote_version_id)
35
+ path = "/api/v1/quote_versions/#{quote_version_id}/clone"
36
+ response = connection.post({}, path)[root_name]
37
+
38
+ JSON.parse(response.to_json, object_class: OpenStruct)
39
+ end
40
+
41
+ def whitelist_approve_params(params)
42
+ {
43
+ expires_at: params[:expires_at],
44
+ }.compact
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -214,6 +214,7 @@ module Lago
214
214
  plan_overrides: params[:plan_overrides],
215
215
  consolidate_invoice: params[:consolidate_invoice],
216
216
  billing_entity_code: params[:billing_entity_code],
217
+ purchase_order_number: params[:purchase_order_number],
217
218
  }.compact
218
219
 
219
220
  payment_method_params = whitelist_payment_method_params(params[:payment_method])
@@ -51,6 +51,7 @@ module Lago
51
51
  :voided_credits,
52
52
  :invoice_requires_successful_payment,
53
53
  :ignore_paid_top_up_limits,
54
+ :purchase_order_number,
54
55
  :metadata,
55
56
  )
56
57
 
@@ -15,12 +15,13 @@ module Lago
15
15
  end
16
16
 
17
17
  def whitelist_params(params)
18
- {
19
- root_name => {
20
- webhook_url: params[:webhook_url],
21
- signature_algo: params[:signature_algo],
22
- }.compact,
23
- }
18
+ result_hash = {}
19
+ result_hash[:webhook_url] = params[:webhook_url] if params.key?(:webhook_url)
20
+ result_hash[:signature_algo] = params[:signature_algo] if params.key?(:signature_algo)
21
+ result_hash[:event_types] = params[:event_types] if params.key?(:event_types)
22
+ result_hash[:name] = params[:name] if params.key?(:name)
23
+
24
+ { root_name => result_hash }
24
25
  end
25
26
  end
26
27
  end
data/lib/lago/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lago
4
- VERSION = '1.50.0'
4
+ VERSION = '1.52.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lago-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.50.0
4
+ version: 1.52.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovro Colic
@@ -349,12 +349,16 @@ files:
349
349
  - lib/lago/api/resources/invoiced_usage.rb
350
350
  - lib/lago/api/resources/mrr.rb
351
351
  - lib/lago/api/resources/nested.rb
352
+ - lib/lago/api/resources/order.rb
353
+ - lib/lago/api/resources/order_form.rb
352
354
  - lib/lago/api/resources/organization.rb
353
355
  - lib/lago/api/resources/overdue_balance.rb
354
356
  - lib/lago/api/resources/payment.rb
355
357
  - lib/lago/api/resources/payment_receipt.rb
356
358
  - lib/lago/api/resources/payment_request.rb
357
359
  - lib/lago/api/resources/plan.rb
360
+ - lib/lago/api/resources/quote.rb
361
+ - lib/lago/api/resources/quote_version.rb
358
362
  - lib/lago/api/resources/subscription.rb
359
363
  - lib/lago/api/resources/tax.rb
360
364
  - lib/lago/api/resources/usage.rb
@@ -384,7 +388,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
384
388
  - !ruby/object:Gem::Version
385
389
  version: '0'
386
390
  requirements: []
387
- rubygems_version: 4.0.10
391
+ rubygems_version: 4.0.16
388
392
  specification_version: 4
389
393
  summary: Lago Rest API client
390
394
  test_files: []