lago-ruby-client 0.21.0.pre.beta → 0.23.0.pre.beta

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: 50da6daf8291cbd8dea4c486649226024d34f60bdbb9a6dfbb82813e78377a26
4
- data.tar.gz: 67f45771c036caeb601d9ff8acf2403bf8311a66a447f0e888e3d818163086eb
3
+ metadata.gz: dd132752862adc36956bf02495d20bcf41792419e181d747a39ecc061a06239b
4
+ data.tar.gz: 5912a8f2932f5e551d045bc4408add87d7d22c6eade02b1d50fd42ce80b87223
5
5
  SHA512:
6
- metadata.gz: cce95dada793b774a27a3c53662d0ebc7ee5ea5eb1d118bc8cea64dfe08a8de63285099afe091d113196e22a11d8a260c180f55314b3dfef3212bbc2906b9a80
7
- data.tar.gz: 1b6793bfae4e8b9a7bc46fa69056fc4b41470edbc08033e083369f1446450a070c6100b05055f02c6ba8485dc67f1e446fbfc1d8b9c2ba58f2dd1cb27ce4a736
6
+ metadata.gz: a3ea8757a95674741092ab95c3925012745f87258a9d3a5392ac21dc0f202b6e556aefdc770c550606980a53bf87d0ffe6d207d9d00df68e1272bd9edac6fb35
7
+ data.tar.gz: 8d6a45f173887447cc24a1938d2bc1476bec952c56c433dfd8083734a3a1f78f4f985555bc1151038bdc3be39325892918e0028953141963269acf2531739547
@@ -12,6 +12,13 @@ module Lago
12
12
  'applied_coupon'
13
13
  end
14
14
 
15
+ def destroy(external_customer_id, applied_coupon_id)
16
+ path = "/api/v1/customers/#{external_customer_id}/applied_coupons"
17
+ response = connection.destroy(path, identifier: applied_coupon_id)[root_name]
18
+
19
+ JSON.parse(response.to_json, object_class: OpenStruct)
20
+ end
21
+
15
22
  def whitelist_params(params)
16
23
  {
17
24
  root_name => {
@@ -21,8 +28,8 @@ module Lago
21
28
  percentage_rate: params[:percentage_rate],
22
29
  frequency: params[:frequency],
23
30
  frequency_duration: params[:frequency_duration],
24
- amount_currency: params[:amount_currency]
25
- }.compact
31
+ amount_currency: params[:amount_currency],
32
+ }.compact,
26
33
  }
27
34
  end
28
35
  end
@@ -13,21 +13,29 @@ module Lago
13
13
  end
14
14
 
15
15
  def whitelist_params(params)
16
- {
17
- root_name => {
18
- name: params[:name],
19
- code: params[:code],
20
- amount_cents: params[:amount_cents],
21
- amount_currency: params[:amount_currency],
22
- percentage_rate: params[:percentage_rate],
23
- coupon_type: params[:coupon_type],
24
- reusable: params[:reusable],
25
- frequency: params[:frequency],
26
- frequency_duration: params[:frequency_duration],
27
- expiration: params[:expiration],
28
- expiration_at: params[:expiration_at],
29
- }.compact,
30
- }
16
+ result_hash = {
17
+ name: params[:name],
18
+ code: params[:code],
19
+ amount_cents: params[:amount_cents],
20
+ amount_currency: params[:amount_currency],
21
+ percentage_rate: params[:percentage_rate],
22
+ coupon_type: params[:coupon_type],
23
+ reusable: params[:reusable],
24
+ frequency: params[:frequency],
25
+ frequency_duration: params[:frequency_duration],
26
+ expiration: params[:expiration],
27
+ expiration_at: params[:expiration_at],
28
+ }.compact
29
+
30
+ whitelist_limitations(params[:applies_to]).tap do |limitations|
31
+ result_hash[:applies_to] = limitations unless limitations.empty?
32
+ end
33
+
34
+ { root_name => result_hash }
35
+ end
36
+
37
+ def whitelist_limitations(limitation_params)
38
+ (limitation_params || {}).slice(:plan_codes)
31
39
  end
32
40
  end
33
41
  end
@@ -54,6 +54,7 @@ module Lago
54
54
  :sync,
55
55
  :sync_with_provider,
56
56
  :vat_rate,
57
+ :document_locale,
57
58
  )
58
59
  end
59
60
  end
@@ -39,6 +39,7 @@ module Lago
39
39
  :invoice_footer,
40
40
  :invoice_grace_period,
41
41
  :vat_rate,
42
+ :document_locale,
42
43
  )
43
44
  end
44
45
  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 = '0.21.0-beta'
4
+ VERSION = '0.23.0-beta'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lago-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0.pre.beta
4
+ version: 0.23.0.pre.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovro Colic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-27 00:00:00.000000000 Z
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt