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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63461b12ae57b46134cdc4ccccc5f75c09d784a548cbc1af3d2ead246f435180
4
- data.tar.gz: 072e87d56d6896a6833e7bcc0f70d6d2760633a73a4a5bb9278c1e12cd174739
3
+ metadata.gz: 37c92eb628b79e4032b9b3e60e73bb7013d09166c069fcdedc2a00afd8a89f0e
4
+ data.tar.gz: c698ba9b0b12932a7241ef7e232abbe2ba1b158384bbe6b697bc597c9b1eb53d
5
5
  SHA512:
6
- metadata.gz: 9d2ebc46296806ae30db4cf047882f0b0c6f61b544d8b9efc74b212e7f06774a08bf97c61e463c4cb3b5b50642275a354aae2485c0ecd5879177cd27cf1057b7
7
- data.tar.gz: a5de08cf74884672c7f23175fe0a43b428ec47939b008080f9337dd2f1636c3cace321b845fef5021d12e6671fd5fad9887c750193e1f4a80ded4b321d3932f7
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
 
@@ -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.57'
2
+ VERSION = '0.3.59'
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.57
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-03-23 00:00:00.000000000 Z
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails