Class: Barong::ManagementAPIV2::Client

Inherits:
ManagementAPIV2::Client show all
Defined in:
app/services/barong/management_api_v2/client.rb

Instance Attribute Summary

Attributes inherited from ManagementAPIV2::Client

#action

Instance Method Summary collapse

Methods inherited from ManagementAPIV2::Client

#build_path, #generate_jwt, #http_client, #keychain, #payload, #request

Constructor Details

#initializeClient

Returns a new instance of Client.



4
5
6
# File 'app/services/barong/management_api_v2/client.rb', line 4

def initialize(*)
  super ENV.fetch('BARONG_URL'), Rails.configuration.x.barong_management_api_v2_configuration
end

Instance Method Details

#create_label(request_params = {}) ⇒ Object



26
27
28
29
30
# File 'app/services/barong/management_api_v2/client.rb', line 26

def create_label(request_params = {})
  self.action = :write_labels
  params = request_params.slice(:user_uid, :key, :value, :jwt)
  request(:post, 'labels', params)
end

#get_user_info(request_params = {}) ⇒ Object



14
15
16
17
18
# File 'app/services/barong/management_api_v2/client.rb', line 14

def (request_params={})
  self.action = :read_users
  params = request_params.slice(:uid, :extended, :jwt)
  request(:post, "users/get", params)
end

#otp_sign(request_params = {}) ⇒ Object



8
9
10
11
12
# File 'app/services/barong/management_api_v2/client.rb', line 8

def otp_sign(request_params = {})
  self.action = :otp_sign
  params = request_params.slice(:user_uid, :otp_code, :jwt)
  request(:post, 'otp/sign', params)
end

#update_label(request_params = {}) ⇒ Object



20
21
22
23
24
# File 'app/services/barong/management_api_v2/client.rb', line 20

def update_label(request_params = {})
  self.action = :write_labels
  params = request_params.slice(:user_uid, :key, :value, :jwt, :replace)
  request(:put, 'labels', params)
end