lockstep_rails 0.3.36 → 0.3.37
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 +4 -4
- data/README.md +1 -0
- data/app/concepts/lockstep/api_record.rb +4 -0
- data/app/concepts/lockstep/client.rb +16 -0
- data/app/concepts/lockstep/query.rb +7 -0
- data/app/models/lockstep/customer_summary.rb +5 -0
- data/app/models/lockstep/magic_link.rb +10 -0
- data/app/models/lockstep/vendor_summary.rb +5 -0
- data/app/platform_api/schema/ar_header_info.rb +4 -9
- data/lib/lockstep_rails/version.rb +1 -1
- metadata +3 -5
- data/app/models/lockstep/ap_header.rb +0 -32
- data/app/models/lockstep/ar_header.rb +0 -32
- data/app/platform_api/schema/ap_header_info.rb +0 -148
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5879e82b6ba39f2a29081df8b406a7941498eb55880a3e29266d27c29e2a915
|
4
|
+
data.tar.gz: 388b574fb28fbe6d43e2f6afca0b725cbcc87043893c6f9e36e70331411be6f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a195119cac110be1ebe2cb059eefb2601a70c83ca1ca28aa6671a32ba5fffa7aea25926a4fb88c44c579d2fa6d7d34d788d8401b2f1410080e83053dcd38ee6
|
7
|
+
data.tar.gz: 1672ecd3aa13b7d8b16aba27267fc0f210508740d3f57a06a1e3e3753cec1a8a38bdb2fba51a8ead77b4e084d4a1581f6d3f66dc3cb21d6ff186d5b1d00eeea3
|
data/README.md
CHANGED
@@ -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
|
@@ -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
|
@@ -5,9 +5,9 @@ def self.id_ref
|
|
5
5
|
nil
|
6
6
|
end
|
7
7
|
|
8
|
-
# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
|
9
|
-
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
|
10
|
-
#
|
8
|
+
# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
|
9
|
+
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
|
10
|
+
#
|
11
11
|
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
|
12
12
|
# @type: string
|
13
13
|
# @format: uuid
|
@@ -16,12 +16,7 @@ end
|
|
16
16
|
# The date of the report
|
17
17
|
# @type: string
|
18
18
|
# @format: date
|
19
|
-
field :
|
20
|
-
|
21
|
-
# The date of the report
|
22
|
-
# @type: string
|
23
|
-
# @format: uuid
|
24
|
-
field :company_id
|
19
|
+
field :report_period
|
25
20
|
|
26
21
|
# The total number of customers.
|
27
22
|
# @type: integer
|
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.
|
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-
|
11
|
+
date: 2022-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -46,10 +46,8 @@ files:
|
|
46
46
|
- app/concepts/lockstep/relation_array.rb
|
47
47
|
- app/helpers/types.rb
|
48
48
|
- app/models/lockstep/account.rb
|
49
|
-
- app/models/lockstep/ap_header.rb
|
50
49
|
- app/models/lockstep/api_key.rb
|
51
50
|
- app/models/lockstep/app_enrollment.rb
|
52
|
-
- app/models/lockstep/ar_header.rb
|
53
51
|
- app/models/lockstep/connection.rb
|
54
52
|
- app/models/lockstep/contact.rb
|
55
53
|
- app/models/lockstep/customer_summary.rb
|
@@ -57,6 +55,7 @@ files:
|
|
57
55
|
- app/models/lockstep/invoice_at_risk_summary.rb
|
58
56
|
- app/models/lockstep/invoice_summary.rb
|
59
57
|
- app/models/lockstep/invoices/address.rb
|
58
|
+
- app/models/lockstep/magic_link.rb
|
60
59
|
- app/models/lockstep/note.rb
|
61
60
|
- app/models/lockstep/payment.rb
|
62
61
|
- app/models/lockstep/payment_summary.rb
|
@@ -80,7 +79,6 @@ files:
|
|
80
79
|
- app/platform_api/schema/activity_x_ref.rb
|
81
80
|
- app/platform_api/schema/aging.rb
|
82
81
|
- app/platform_api/schema/ap_aging_header_info.rb
|
83
|
-
- app/platform_api/schema/ap_header_info.rb
|
84
82
|
- app/platform_api/schema/api_key.rb
|
85
83
|
- app/platform_api/schema/api_key_fetch_result.rb
|
86
84
|
- app/platform_api/schema/app_enrollment.rb
|
@@ -1,32 +0,0 @@
|
|
1
|
-
class Lockstep::ApHeader < Lockstep::ApiRecord
|
2
|
-
self.model_name_uri = "v1/Reports/ap-header"
|
3
|
-
self.id_ref = "group_key"
|
4
|
-
self.query_path= ""
|
5
|
-
load_schema(Schema::ApHeaderInfo)
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
class Lockstep::Query
|
10
|
-
# Overriding the build_params method to just add attributes in params without filter option
|
11
|
-
def build_params
|
12
|
-
params = {}
|
13
|
-
criteria[:conditions].first.each do |key|
|
14
|
-
params.merge!({ :"#{key[0].to_s.camelize(:lower)}" => key[1] })
|
15
|
-
end
|
16
|
-
return params
|
17
|
-
end
|
18
|
-
|
19
|
-
# Overrinding the get_results method to parse the single object coming from v1.
|
20
|
-
def get_results(params = {})
|
21
|
-
resp = @klass.resource.get(@klass.query_path, :params => params)
|
22
|
-
|
23
|
-
return [] if %w(404).include?(resp.code.to_s)
|
24
|
-
# TODO handle non 200 response code. Throwing an exception for now
|
25
|
-
raise StandardError.new("#{resp.code} error while fetching: #{resp.body}") unless %w(201 200).include?(resp.code.to_s)
|
26
|
-
|
27
|
-
parsed_response = JSON.parse(resp.body)
|
28
|
-
|
29
|
-
r = parsed_response.transform_keys { |key| key.underscore }
|
30
|
-
@klass.model_name.to_s.constantize.new(r, false)
|
31
|
-
end
|
32
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
class Lockstep::ArHeader < Lockstep::ApiRecord
|
2
|
-
self.model_name_uri = "v1/Reports/ar-header"
|
3
|
-
self.id_ref = "group_key"
|
4
|
-
self.query_path= ""
|
5
|
-
load_schema(Schema::ArHeaderInfo)
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
class Lockstep::Query
|
10
|
-
# Overriding the build_params method to just add attributes in params without filter option
|
11
|
-
def build_params
|
12
|
-
params = {}
|
13
|
-
criteria[:conditions].first.each do |key|
|
14
|
-
params.merge!({ :"#{key[0].to_s.camelize(:lower)}" => key[1] })
|
15
|
-
end
|
16
|
-
return params
|
17
|
-
end
|
18
|
-
|
19
|
-
# Overrinding the get_results method to parse the single object coming from v1.
|
20
|
-
def get_results(params = {})
|
21
|
-
resp = @klass.resource.get(@klass.query_path, :params => params)
|
22
|
-
|
23
|
-
return [] if %w(404).include?(resp.code.to_s)
|
24
|
-
# TODO handle non 200 response code. Throwing an exception for now
|
25
|
-
raise StandardError.new("#{resp.code} error while fetching: #{resp.body}") unless %w(201 200).include?(resp.code.to_s)
|
26
|
-
|
27
|
-
parsed_response = JSON.parse(resp.body)
|
28
|
-
|
29
|
-
r = parsed_response.transform_keys { |key| key.underscore }
|
30
|
-
@klass.model_name.to_s.constantize.new(r, false)
|
31
|
-
end
|
32
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
class Schema::ApHeaderInfo < Lockstep::ApiRecord
|
2
|
-
|
3
|
-
# ApiRecord will crash unless `id_ref` is defined
|
4
|
-
def self.id_ref
|
5
|
-
nil
|
6
|
-
end
|
7
|
-
|
8
|
-
# The GroupKey uniquely identifies a single Lockstep Platform account. All records for this
|
9
|
-
# account will share the same GroupKey value. GroupKey values cannot be changed once created.
|
10
|
-
#
|
11
|
-
# For more information, see [Accounts and GroupKeys](https://developer.lockstep.io/docs/accounts-and-groupkeys).
|
12
|
-
# @type: string
|
13
|
-
# @format: uuid
|
14
|
-
field :group_key
|
15
|
-
|
16
|
-
# The date of the report
|
17
|
-
# @type: string
|
18
|
-
# @format: date
|
19
|
-
field :report_date
|
20
|
-
|
21
|
-
# The date of the report
|
22
|
-
# @type: string
|
23
|
-
# @format: uuid
|
24
|
-
field :company_id
|
25
|
-
|
26
|
-
# The total number of vendors..
|
27
|
-
# @type: integer
|
28
|
-
# @format: int32
|
29
|
-
field :total_vendors
|
30
|
-
|
31
|
-
# The total number of bills.
|
32
|
-
# @type: integer
|
33
|
-
# @format: int32
|
34
|
-
field :total_bills
|
35
|
-
|
36
|
-
# The total amount billed.
|
37
|
-
# @type: number
|
38
|
-
# @format: double
|
39
|
-
field :total_billed_amount
|
40
|
-
|
41
|
-
# The total number of advance payments.
|
42
|
-
# @type: number
|
43
|
-
# @format: double
|
44
|
-
field :total_advance_payments
|
45
|
-
|
46
|
-
# The total amount paid.
|
47
|
-
# @type: number
|
48
|
-
# @format: double
|
49
|
-
field :total_paid
|
50
|
-
|
51
|
-
# The total accounts payable amount.
|
52
|
-
# @type: number
|
53
|
-
# @format: double
|
54
|
-
field :total_ap_amount
|
55
|
-
|
56
|
-
# The number of paid bills.
|
57
|
-
# @type: integer
|
58
|
-
# @format: int32
|
59
|
-
field :total_bills_paid
|
60
|
-
|
61
|
-
# The number of past due bills.
|
62
|
-
# @type: integer
|
63
|
-
# @format: int32
|
64
|
-
field :total_bills_past_due
|
65
|
-
|
66
|
-
# The number of bills 90+ days past due.
|
67
|
-
# @type: integer
|
68
|
-
# @format: int32
|
69
|
-
field :total_bills90_days_past_due
|
70
|
-
|
71
|
-
# The total amount past due.
|
72
|
-
# @type: number
|
73
|
-
# @format: double
|
74
|
-
field :total_past_due_amount
|
75
|
-
|
76
|
-
# The total amount for bills 90+ days past due.
|
77
|
-
# @type: number
|
78
|
-
# @format: double
|
79
|
-
field :total_past_due_amount90_days
|
80
|
-
|
81
|
-
# Portion of Total AP that is Past due.
|
82
|
-
# @type: number
|
83
|
-
# @format: double
|
84
|
-
field :percentage_of_total_ap
|
85
|
-
|
86
|
-
# The total amount billed, due this year.
|
87
|
-
# @type: number
|
88
|
-
# @format: double
|
89
|
-
field :total_billed_amount_current_year
|
90
|
-
|
91
|
-
# The total amount billed, due last year.
|
92
|
-
# @type: number
|
93
|
-
# @format: double
|
94
|
-
field :total_billed_amount_previous_year
|
95
|
-
|
96
|
-
# The total of all payments made this year.
|
97
|
-
# @type: number
|
98
|
-
# @format: double
|
99
|
-
field :total_paid_amount_current_year
|
100
|
-
|
101
|
-
# Portion of Total AP that is 90+ days Past due.
|
102
|
-
# @type: number
|
103
|
-
# @format: double
|
104
|
-
field :percentage_of_total_ap90_days_past_due
|
105
|
-
|
106
|
-
# The number of vendors who were paid within the past thirty days.
|
107
|
-
# @type: integer
|
108
|
-
# @format: int32
|
109
|
-
field :vendors_paid_past_thirty_days
|
110
|
-
|
111
|
-
# The total amount paid over the past thirty days.
|
112
|
-
# @type: number
|
113
|
-
# @format: double
|
114
|
-
field :amount_paid_past_thirty_days
|
115
|
-
|
116
|
-
# The amount in advance from the payments made over the past thirty days.
|
117
|
-
# @type: number
|
118
|
-
# @format: double
|
119
|
-
field :advance_payment_amount_past_thirty_days
|
120
|
-
|
121
|
-
# The number of bills paid over the past thirty days.
|
122
|
-
# @type: integer
|
123
|
-
# @format: int32
|
124
|
-
field :bills_paid_past_thirty_days
|
125
|
-
|
126
|
-
# The number of vendors that sent bills over the the past thirty days.
|
127
|
-
# @type: integer
|
128
|
-
# @format: int32
|
129
|
-
field :billing_vendors_past_thirty_days
|
130
|
-
|
131
|
-
# The total amount billed over the past thirty days.
|
132
|
-
# @type: number
|
133
|
-
# @format: double
|
134
|
-
field :amount_billed_past_thirty_days
|
135
|
-
|
136
|
-
# The amount outstanding on the bills received over the past thirty days.
|
137
|
-
# @type: number
|
138
|
-
# @format: double
|
139
|
-
field :amount_due_past_thirty_days
|
140
|
-
|
141
|
-
# The number of bills received over the past thirty days.
|
142
|
-
# @type: integer
|
143
|
-
# @format: int32
|
144
|
-
field :bills_past_thirty_days
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
end
|