lockstep_rails 0.3.35 → 0.3.37

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: 29be94efeb8fb9109a0f5931f8af9b8447e9c792ab85d40b5a11b9123690b9d0
4
- data.tar.gz: 5f3057f779ab7f7b5f22a60463dd80b40e6339775facb441a62f8b069b534acc
3
+ metadata.gz: d5879e82b6ba39f2a29081df8b406a7941498eb55880a3e29266d27c29e2a915
4
+ data.tar.gz: 388b574fb28fbe6d43e2f6afca0b725cbcc87043893c6f9e36e70331411be6f7
5
5
  SHA512:
6
- metadata.gz: bb89a758335e2614471e73749a13992f5e7e91f75729519398a29a16ebca377eb3e9819d1946610f647bd6e75963e47fe7bd821f16eeb7f60861dc320f442e1a
7
- data.tar.gz: df506a80d05be2153e291526a9f501cc02b5daf0451d153ab239613b570275c5f10e5de412ef7e2680f55ab4f0bc96f1eb662313577fe43be80bc76620b50b3a
6
+ metadata.gz: 1a195119cac110be1ebe2cb059eefb2601a70c83ca1ca28aa6671a32ba5fffa7aea25926a4fb88c44c579d2fa6d7d34d788d8401b2f1410080e83053dcd38ee6
7
+ data.tar.gz: 1672ecd3aa13b7d8b16aba27267fc0f210508740d3f57a06a1e3e3753cec1a8a38bdb2fba51a8ead77b4e084d4a1581f6d3f66dc3cb21d6ff186d5b1d00eeea3
data/README.md CHANGED
@@ -61,6 +61,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
61
61
  * Lockstep::ReportPayablesComingDueSummary
62
62
  * Lockstep::ApiKey
63
63
  * Lockstep::InvoiceAtRiskSummary
64
+ * Lockstep::MagicLink
64
65
 
65
66
  ## ActiveModel Interfaces
66
67
 
@@ -544,6 +544,10 @@ module Lockstep
544
544
  query_builder.where(*args)
545
545
  end
546
546
 
547
+ def self.additional_query_params(args)
548
+ query_builder.additional_query_params(args)
549
+ end
550
+
547
551
  def self.execute
548
552
  query_builder.execute
549
553
  end
@@ -29,6 +29,13 @@ module Lockstep
29
29
  RequestStore.store[:lockstep_api_key]
30
30
  end
31
31
 
32
+ def self.set_internal_service_key(key)
33
+ RequestStore.store[:internal_service_key] = key
34
+ end
35
+
36
+ def internal_service_key
37
+ RequestStore.store[:internal_service_key]
38
+ end
32
39
 
33
40
  ##
34
41
  # Construct a new Lockstep API client targeting the specified server.
@@ -115,6 +122,7 @@ module Lockstep
115
122
  request["SdkType"] = 'Ruby'
116
123
  request["SdkVersion"] = '2022.4.32.0'
117
124
  request["MachineName"] = Socket.gethostname
125
+ request["LS-InternalService"] = internal_service_key if internal_service_key_set?
118
126
  body = body.to_json unless body.is_a?(String)
119
127
  request.body = body
120
128
 
@@ -155,6 +163,14 @@ module Lockstep
155
163
  request(:delete, path, {}, {})
156
164
  end
157
165
 
166
+ def post_magic_link(path, body: {}, params: {})
167
+ request(:post, path, body, params)
168
+ end
169
+
170
+ def internal_service_key_set?
171
+ !!internal_service_key
172
+ end
173
+
158
174
  def with_logger(&block)
159
175
  block.call
160
176
  end
@@ -51,6 +51,12 @@ class Lockstep::Query
51
51
  end
52
52
  end
53
53
 
54
+ def additional_query_params(args)
55
+ with_clone do
56
+ criteria[:additional_query_params] ||= args
57
+ end
58
+ end
59
+
54
60
  def convert_arg(arg)
55
61
  return arg.to_pointer if arg.is_a?(Lockstep::ApiRecord)
56
62
  return Lockstep::ApiRecord.to_date_object(arg) if arg.is_a?(Time) || arg.is_a?(Date)
@@ -198,6 +204,7 @@ class Lockstep::Query
198
204
  params.merge!({ :include => criteria[:include].join(",") }) if criteria[:include]
199
205
  params.merge!({ :order => criteria[:order].join(",") }) if criteria[:order]
200
206
  params.merge!({ :pageSize => 2 }) if criteria[:count]
207
+ params.merge!(criteria[:additional_query_params]) if criteria[:additional_query_params]
201
208
  params.reject! { |k, v| v.blank? }
202
209
  params
203
210
  end
@@ -3,4 +3,9 @@ class Lockstep::CustomerSummary < Lockstep::ApiRecord
3
3
  self.id_ref = "company_id"
4
4
  self.query_path = ""
5
5
  load_schema(Schema::CustomerSummary)
6
+
7
+ def self.with_report_date(report_date)
8
+ additional_query_params({"reportDate": report_date})
9
+ end
10
+
6
11
  end
@@ -0,0 +1,10 @@
1
+ class Lockstep::MagicLink < Lockstep::ApiRecord
2
+ self.model_name_uri = "v1/useraccounts/magic-links"
3
+ self.id_ref = "magicLinkId"
4
+ self.query_path = ""
5
+
6
+ def self.generate(email_id, expiry, app_id, user_role)
7
+ body = {email: email_id, expiresInMinutes: expiry, applicationId: app_id, userRole: user_role}
8
+ resource.post_magic_link('', body: body, params: {})
9
+ end
10
+ end
@@ -3,4 +3,9 @@ class Lockstep::VendorSummary < Lockstep::ApiRecord
3
3
  self.id_ref = "vendor_id"
4
4
  self.query_path = ""
5
5
  load_schema(Schema::VendorSummary)
6
+
7
+ def self.with_report_date(report_date)
8
+ additional_query_params({"reportDate": report_date})
9
+ end
10
+
6
11
  end
@@ -1,3 +1,3 @@
1
1
  module LockstepRails
2
- VERSION = "0.3.35"
2
+ VERSION = "0.3.37"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockstep_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.35
4
+ version: 0.3.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vivek AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-30 00:00:00.000000000 Z
11
+ date: 2022-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -55,6 +55,7 @@ files:
55
55
  - app/models/lockstep/invoice_at_risk_summary.rb
56
56
  - app/models/lockstep/invoice_summary.rb
57
57
  - app/models/lockstep/invoices/address.rb
58
+ - app/models/lockstep/magic_link.rb
58
59
  - app/models/lockstep/note.rb
59
60
  - app/models/lockstep/payment.rb
60
61
  - app/models/lockstep/payment_summary.rb