lago-ruby-client 0.20.0.pre.beta → 0.22.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: c0cf426548c5d0e497ead0620d30c4456919c9b57a5d9dbf55ebc17efcb98c96
4
- data.tar.gz: '0584c626189a813c260488e1f967f4028cd2c416968ad621dbe81f134a4c5049'
3
+ metadata.gz: 8eb23ebc5ddd504f45729b67b9eb4537a73c2e8189c2808dc99e3621307a3f6e
4
+ data.tar.gz: c34da07855871bf2fc302ec65313291784ad79433aed0ad1e28fe2ef8b738ea8
5
5
  SHA512:
6
- metadata.gz: b4581532927ded6bf68e17797a6b8645c6b0eaf5880d7d1390dc9e508cedc61d0f10c08703f551c960173a571dcd529d77a77482e2ea2ba372cfada516373d17
7
- data.tar.gz: 31f79a39df9b5a92d38a528b3ba018e8ab8623582769d9d87eba33d8464bc721d688bd8c1d78098055b860315765f6ccbd3d7d79aaac0dea8760270611a70311
6
+ metadata.gz: 18c7e45f3ea976906f7fa1449fe0f2b34fe0e921dbfa6d0efa7a558d379774e8580b3132abfd028233e50837d7c80d20f9e1be17532eea7ef663bbe0802e04ff
7
+ data.tar.gz: c3d3978b16007e479eaadfef399fefa60f50faed739e413eb27777b83566c1dc4336d3225c76223950f0b7785527857088fb1b2cba66918709f465e27b8dc529
@@ -12,6 +12,13 @@ module Lago
12
12
  'applied_coupon'
13
13
  end
14
14
 
15
+ def destroy(external_customer_id, coupon_code)
16
+ path = "/api/v1/customers/#{external_customer_id}/coupons"
17
+ response = connection.destroy(path, identifier: coupon_code)[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
@@ -12,6 +12,13 @@ module Lago
12
12
  'wallet_transactions'
13
13
  end
14
14
 
15
+ def get_all(wallet_id, options = {})
16
+ path = "/api/v1/wallets/#{wallet_id}/wallet_transactions"
17
+ response = connection.get_all(options, path)
18
+
19
+ JSON.parse(response.to_json, object_class: OpenStruct)
20
+ end
21
+
15
22
  def whitelist_params(params)
16
23
  {
17
24
  'wallet_transaction' => {
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.20.0-beta'
4
+ VERSION = '0.22.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.20.0.pre.beta
4
+ version: 0.22.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-17 00:00:00.000000000 Z
11
+ date: 2023-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt