mekari_sso 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mekari_sso.rb +20 -0
- data/lib/params/company_update.rb +37 -0
- data/lib/params/current_company_of_user.rb +8 -0
- data/lib/requests/company_current_of_user.rb +28 -0
- data/lib/requests/update_company.rb +47 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15bc7137e896d78fdd494fa00833db3a714e3d825ec2d89fab5be5c378abb127
|
4
|
+
data.tar.gz: 3c189323a7b95174541bd909813ec9564f25ee18dc987c64eeb2c3d7c46fe1f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c844b95c6cd00e4ad093e6db1ed793049cdf8eaf651ae1615de1148cc8a012cab0d6bfce1ff0444ae9eb0dcfaab1e8a6cbcb38cc89aed3759a6b34af2b1046b1
|
7
|
+
data.tar.gz: 9238ac1d536cb10a29c7d39696929a70168e1b20835ffef3af6aa01b64fcdb0e56246fee63a7c6a65cc9964ae28df9d4542dbec372ff562b71c9534d796c4b91
|
data/lib/mekari_sso.rb
CHANGED
@@ -6,6 +6,7 @@ require 'requests/check_user_existence'
|
|
6
6
|
require 'requests/cities'
|
7
7
|
require 'requests/companies_of_user'
|
8
8
|
require 'requests/companies'
|
9
|
+
require 'requests/company_current_of_user'
|
9
10
|
require 'requests/company_member'
|
10
11
|
require 'requests/current_user'
|
11
12
|
require 'requests/current_company'
|
@@ -23,6 +24,7 @@ require 'requests/remove_company'
|
|
23
24
|
require 'requests/remove_user_from_company'
|
24
25
|
require 'requests/update_user'
|
25
26
|
require 'requests/update_avatar'
|
27
|
+
require 'requests/update_company'
|
26
28
|
require 'requests/verify_email_user'
|
27
29
|
require 'requests/validate_password'
|
28
30
|
|
@@ -32,7 +34,9 @@ require 'params/user_register'
|
|
32
34
|
require 'params/company_of_user'
|
33
35
|
require 'params/company_register'
|
34
36
|
require 'params/company_remove'
|
37
|
+
require 'params/company_update'
|
35
38
|
require 'params/company'
|
39
|
+
require 'params/current_company_of_user'
|
36
40
|
require 'params/industry'
|
37
41
|
require 'params/province'
|
38
42
|
require 'params/remove_user_company'
|
@@ -110,6 +114,14 @@ module MekariSso
|
|
110
114
|
sender >> MekariSso::RegisterCompany.new(@options, company)
|
111
115
|
end
|
112
116
|
|
117
|
+
def update_company(params = {})
|
118
|
+
company = MekariSso::CompanyUpdate.new(params)
|
119
|
+
company.validate_required!
|
120
|
+
|
121
|
+
sender = MekariSso::Sender.new
|
122
|
+
sender >> MekariSso::UpdateCompany.new(@options, company)
|
123
|
+
end
|
124
|
+
|
113
125
|
def remove_company(params)
|
114
126
|
company = MekariSso::CompanyRemove.new(params)
|
115
127
|
company.validate_required!
|
@@ -221,5 +233,13 @@ module MekariSso
|
|
221
233
|
sender = MekariSso::Sender.new
|
222
234
|
sender >> MekariSso::CompaniesOfUser.new(@options, company)
|
223
235
|
end
|
236
|
+
|
237
|
+
def current_company_of_user(params)
|
238
|
+
company = MekariSso::CurrentCompanyOfUser.new(params)
|
239
|
+
company.validate_required!
|
240
|
+
|
241
|
+
sender = MekariSso::Sender.new
|
242
|
+
sender >> MekariSso::CompanyCurrentOfUser.new(@options, company)
|
243
|
+
end
|
224
244
|
end
|
225
245
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'config'
|
4
|
+
|
5
|
+
module MekariSso
|
6
|
+
class CompanyUpdate < MekariSso::CompanyRegister
|
7
|
+
attr_accessor :name, :email, :industry_id, :industry_name, :user_id, :brand_name, :main_address, :access_token,
|
8
|
+
:secondary_address, :phone, :tax_name, :tax_number, :billing_name, :billing_email, :billing_phone,
|
9
|
+
:company_id
|
10
|
+
|
11
|
+
def initialize(options = nil)
|
12
|
+
apply(options) if options
|
13
|
+
end
|
14
|
+
|
15
|
+
def available_keys
|
16
|
+
super + %i[company_id]
|
17
|
+
end
|
18
|
+
|
19
|
+
def validate_required!
|
20
|
+
unless @name.present?
|
21
|
+
raise ArgumentError, "Params name is required options"
|
22
|
+
end
|
23
|
+
|
24
|
+
unless @email.present?
|
25
|
+
raise ArgumentError, "Params email is required options"
|
26
|
+
end
|
27
|
+
|
28
|
+
unless @user_id.present?
|
29
|
+
raise ArgumentError, "Params user_id is required options"
|
30
|
+
end
|
31
|
+
|
32
|
+
unless @company_id.present?
|
33
|
+
raise ArgumentError, "Params company_id is required options"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require_relative 'http_request'
|
5
|
+
|
6
|
+
module MekariSso
|
7
|
+
class CompanyCurrentOfUser < MekariSso::HttpRequest
|
8
|
+
|
9
|
+
attr_reader :config, :params
|
10
|
+
|
11
|
+
def initialize(config, params)
|
12
|
+
@config = config
|
13
|
+
@params = params
|
14
|
+
end
|
15
|
+
|
16
|
+
def headers_request
|
17
|
+
headers.merge({
|
18
|
+
authorization: "Bearer #{@params.access_token}",
|
19
|
+
accept_language: @config.accept_language
|
20
|
+
})
|
21
|
+
end
|
22
|
+
|
23
|
+
def send
|
24
|
+
RestClient.get "#{@config.base_url}/v1.1/users/#{@params.user_id}/current_company", headers_request
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require_relative 'http_request'
|
5
|
+
|
6
|
+
module MekariSso
|
7
|
+
class UpdateCompany < MekariSso::HttpRequest
|
8
|
+
|
9
|
+
attr_reader :config, :params
|
10
|
+
|
11
|
+
def initialize(config, params)
|
12
|
+
@config = config
|
13
|
+
@params = params
|
14
|
+
end
|
15
|
+
|
16
|
+
def params
|
17
|
+
{
|
18
|
+
name: @params.name,
|
19
|
+
email: @params.email,
|
20
|
+
industry_id: @params.industry_id,
|
21
|
+
industry_name: @params.industry_name,
|
22
|
+
user_id: @params.user_id,
|
23
|
+
brand_name: @params.brand_name,
|
24
|
+
main_address: @params.main_address,
|
25
|
+
secondary_address: @params.secondary_address,
|
26
|
+
phone: @params.phone,
|
27
|
+
tax_name: @params.tax_name,
|
28
|
+
tax_number: @params.tax_number,
|
29
|
+
billing_name: @params.billing_name,
|
30
|
+
billing_email: @params.billing_email,
|
31
|
+
billing_phone: @params.billing_phone
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def headers_request
|
36
|
+
headers.merge({
|
37
|
+
authorization: "Bearer #{@params.access_token}",
|
38
|
+
accept_language: @config.accept_language
|
39
|
+
})
|
40
|
+
end
|
41
|
+
|
42
|
+
def send
|
43
|
+
RestClient.put "#{@config.base_url}/v1/companies/#{@params.company_id}", params, headers_request
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mekari_sso
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WSPDV
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -86,6 +86,8 @@ files:
|
|
86
86
|
- lib/params/company_of_user.rb
|
87
87
|
- lib/params/company_register.rb
|
88
88
|
- lib/params/company_remove.rb
|
89
|
+
- lib/params/company_update.rb
|
90
|
+
- lib/params/current_company_of_user.rb
|
89
91
|
- lib/params/industry.rb
|
90
92
|
- lib/params/list.rb
|
91
93
|
- lib/params/province.rb
|
@@ -101,6 +103,7 @@ files:
|
|
101
103
|
- lib/requests/cities.rb
|
102
104
|
- lib/requests/companies.rb
|
103
105
|
- lib/requests/companies_of_user.rb
|
106
|
+
- lib/requests/company_current_of_user.rb
|
104
107
|
- lib/requests/company_member.rb
|
105
108
|
- lib/requests/current_company.rb
|
106
109
|
- lib/requests/current_user.rb
|
@@ -118,6 +121,7 @@ files:
|
|
118
121
|
- lib/requests/revoke.rb
|
119
122
|
- lib/requests/sender.rb
|
120
123
|
- lib/requests/update_avatar.rb
|
124
|
+
- lib/requests/update_company.rb
|
121
125
|
- lib/requests/update_user.rb
|
122
126
|
- lib/requests/validate_password.rb
|
123
127
|
- lib/requests/verify_email_user.rb
|
@@ -140,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
144
|
- !ruby/object:Gem::Version
|
141
145
|
version: '0'
|
142
146
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
147
|
+
rubygems_version: 3.4.14
|
144
148
|
signing_key:
|
145
149
|
specification_version: 4
|
146
150
|
summary: support mekari sso
|