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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10e5396a66ad03f74ab26110a5e28735de9ded83067164fde5c51dd5eedeac7a
4
- data.tar.gz: 2c6c8f5d092e8496185b6ac7f8f06574eb345a4f39818732009089f19c884995
3
+ metadata.gz: f0f662ac45f6fbe45ff4d42c2fdfe17acc56e55df60db588713bbaa60d69e81d
4
+ data.tar.gz: '08f4da53730f5a3087acb45cb5747dfc75d5250782ddec5bda53c17276a90b72'
5
5
  SHA512:
6
- metadata.gz: 336c65121dccd797672347a3334e72198f36bc1b042b17fae4c52d8f4764270ae0e5d66d6f4a8004753721bd3728e939d6d1ddf07a6b65121f5489562bcb74fc
7
- data.tar.gz: 72669f5a0dbaeba077cdea70084c284e5f852fd22e1e31e48c12bf691a7fb180916f28cf9f15a1410f419bfa6bee33ae13af8a7930029923544e7a46e163fcff
6
+ metadata.gz: ab511f49dcaab9f8733ac1dd2418ffafc38cff8d037c2c173fcc0f4fc4fabc5224429111a556d935b6b688f5f6f761ae6153dd3d80ed4029853e18bcbde60730
7
+ data.tar.gz: 138e7c85d036b9ba337ce2e3c88075f9dd2d05477671ff26aabbaa119d67e3abef720e63416bd6f4278cf44d6ca7be643b379d77a6ce29cab0b7bdf7dfcff22f
data/README.md CHANGED
@@ -42,6 +42,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
42
42
  * Lockstep::Account
43
43
  * Lockstep::ApiKey
44
44
  * Lockstep::AppEnrollment
45
+ * Lockstep::Attachment
45
46
  * Lockstep::Connection
46
47
  * Lockstep::Contact
47
48
  * Lockstep::CustomerSummary
@@ -0,0 +1,5 @@
1
+ class Lockstep::Attachment < Lockstep::ApiRecord
2
+ self.model_name_uri = "v1/Attachments"
3
+ self.id_ref = "attachment_id"
4
+ load_schema(Schema::Attachment)
5
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module LockstepRails
2
- VERSION = '0.3.58'
2
+ VERSION = '0.3.60'
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.58
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-03-30 00:00:00.000000000 Z
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