lockstep_rails 0.3.57 → 0.3.59
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/lockstep/service_fabric_payment.rb +1 -1
- data/app/models/lockstep/user.rb +28 -0
- data/lib/lockstep_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37c92eb628b79e4032b9b3e60e73bb7013d09166c069fcdedc2a00afd8a89f0e
|
4
|
+
data.tar.gz: c698ba9b0b12932a7241ef7e232abbe2ba1b158384bbe6b697bc597c9b1eb53d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef3dbdfdfc56c7afff66a008c2d3f7b6e915b1654cab5732b1efab68b3a3772efde67ae6520d81f3279507e4a098baeae173ea515e3f001f560a5f99d9a608a8
|
7
|
+
data.tar.gz: 7384e6ce1a3a99bf36f25bdf9e90f5d751747847dce356c1ec82df2837a45fbe38d6ba18b1bad2752e02eac37b878c5bd33ad5951bb5c53ccd13c4385cb92381
|
@@ -21,7 +21,7 @@ class Lockstep::ServiceFabricPayment < Lockstep::ApiRecord
|
|
21
21
|
# Overriding This method to not send body inside an Array
|
22
22
|
def create
|
23
23
|
attrs = attributes_for_saving.transform_keys { |key| key.camelize(:lower) }
|
24
|
-
resp = resource.post('', body: attrs)
|
24
|
+
resp = resource.post(attrs['creditorAccount']['companyId'], body: attrs)
|
25
25
|
result = post_result(resp)
|
26
26
|
end
|
27
27
|
|
data/app/models/lockstep/user.rb
CHANGED
@@ -7,4 +7,32 @@ class Lockstep::User < Lockstep::ApiRecord
|
|
7
7
|
belongs_to :account, class_name: "Lockstep::Account", loader: ->(user) { Lockstep::Account.first }
|
8
8
|
|
9
9
|
alias_attribute :last_logged_in, :b2_c_last_logged_in
|
10
|
+
|
11
|
+
def self.invite(email_addresses)
|
12
|
+
emails = email_addresses.map { |email| { email: email } }
|
13
|
+
resp = resource.post('/invite', body: emails, params: {})
|
14
|
+
parsed_response = JSON.parse(resp.body)
|
15
|
+
case resp.code.to_s
|
16
|
+
when '401'
|
17
|
+
raise Lockstep::Exceptions::UnauthorizedError, parsed_response['title']
|
18
|
+
when '400'
|
19
|
+
raise Lockstep::Exceptions::BadRequestError, parsed_response['title']
|
20
|
+
when '404'
|
21
|
+
raise Lockstep::Exceptions::RecordNotFound, parsed_response['title']
|
22
|
+
when '200'
|
23
|
+
snake_case_parsed_response = parsed_response.map { |response| response.transform_keys { |key| key.underscore } }
|
24
|
+
result = snake_case_parsed_response&.map do |user|
|
25
|
+
if user['success']
|
26
|
+
invited_user_in_snake_case = user['invited_user'].transform_keys { |key| key.underscore }
|
27
|
+
Lockstep::User.new(invited_user_in_snake_case)
|
28
|
+
else
|
29
|
+
invited_user = Lockstep::User.new(email: user['email'])
|
30
|
+
invited_user.errors.add "email", "#{user['error_message']}"
|
31
|
+
invited_user
|
32
|
+
end
|
33
|
+
end
|
34
|
+
else
|
35
|
+
raise Lockstep::Exceptions::BadRequestError, parsed_response
|
36
|
+
end
|
37
|
+
end
|
10
38
|
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.
|
4
|
+
version: 0.3.59
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vivek AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|