Class: MekariSso::CheckUserExistence
- Inherits:
-
HttpRequest
- Object
- HttpRequest
- MekariSso::CheckUserExistence
- Defined in:
- lib/requests/check_user_existence.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #headers_request ⇒ Object
-
#initialize(config, params) ⇒ CheckUserExistence
constructor
A new instance of CheckUserExistence.
- #send ⇒ Object
Methods inherited from HttpRequest
#after_error, #after_success, #handle_error, #handle_response, #headers, #original_response
Constructor Details
#initialize(config, params) ⇒ CheckUserExistence
Returns a new instance of CheckUserExistence.
13 14 15 16 |
# File 'lib/requests/check_user_existence.rb', line 13 def initialize(config, params) @config = config @params = params end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/requests/check_user_existence.rb', line 11 def config @config end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
11 12 13 |
# File 'lib/requests/check_user_existence.rb', line 11 def params @params end |
Instance Method Details
#headers_request ⇒ Object
25 26 27 28 29 30 |
# File 'lib/requests/check_user_existence.rb', line 25 def headers_request headers.merge({ authorization: "Bearer #{@params.access_token}", accept_language: @config.accept_language }) end |
#send ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/requests/check_user_existence.rb', line 32 def send # url = URI("#{@config.base_url}/v1/users/check?attr_key=#{@params.key}&attr_value=#{CGI.escape(@params.value)}") url = URI("#{@config.base_url}/v1/users/check") url.query = URI.encode_www_form(params) RestClient.get url.to_s, headers_request end |