lockstep_rails 0.3.58 → 0.3.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/app/models/lockstep/attachment.rb +5 -0
- data/app/models/lockstep/user.rb +28 -0
- data/lib/lockstep_rails/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0f662ac45f6fbe45ff4d42c2fdfe17acc56e55df60db588713bbaa60d69e81d
|
4
|
+
data.tar.gz: '08f4da53730f5a3087acb45cb5747dfc75d5250782ddec5bda53c17276a90b72'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab511f49dcaab9f8733ac1dd2418ffafc38cff8d037c2c173fcc0f4fc4fabc5224429111a556d935b6b688f5f6f761ae6153dd3d80ed4029853e18bcbde60730
|
7
|
+
data.tar.gz: 138e7c85d036b9ba337ce2e3c88075f9dd2d05477671ff26aabbaa119d67e3abef720e63416bd6f4278cf44d6ca7be643b379d77a6ce29cab0b7bdf7dfcff22f
|
data/README.md
CHANGED
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.60
|
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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- app/models/lockstep/accounting_profile.rb
|
50
50
|
- app/models/lockstep/api_key.rb
|
51
51
|
- app/models/lockstep/app_enrollment.rb
|
52
|
+
- app/models/lockstep/attachment.rb
|
52
53
|
- app/models/lockstep/connection.rb
|
53
54
|
- app/models/lockstep/contact.rb
|
54
55
|
- app/models/lockstep/customer_summary.rb
|