Class: TokyoApi::Identity

Inherits:
Base
  • Object
show all
Defined in:
lib/tokyo_api/identity.rb

Instance Method Summary collapse

Methods inherited from Base

#normalized_base_path, #required_fields_param, #url_escape

Instance Method Details

#base_pathObject



5
6
7
# File 'lib/tokyo_api/identity.rb', line 5

def base_path
  'identity'
end

#full_user(id) ⇒ Object



9
10
11
# File 'lib/tokyo_api/identity.rb', line 9

def full_user(id)
  client.get_request("#{normalized_base_path}full_user/#{url_escape(id)}").body
end

#subscription_status_path(id, opt_in_public_ids: nil, minimum_consent_level: nil, encrypted: nil) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/tokyo_api/identity.rb', line 28

def subscription_status_path(id, opt_in_public_ids: nil, minimum_consent_level: nil, encrypted: nil)
  raise 'must provide opt_in_public_ids' if opt_in_public_ids.nil?

  "/#{normalized_base_path}subscription_status/#{url_escape(id)}?#{path_for_subscription_status_params(
    opt_in_public_ids, minimum_consent_level, encrypted
  )}"
end

#tokyo_identity_user_path(id, required_fields: nil, opt_in_public_ids: nil, minimum_consent_level: nil, encrypted: nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tokyo_api/identity.rb', line 13

def tokyo_identity_user_path(id, required_fields: nil, opt_in_public_ids: nil, minimum_consent_level: nil, encrypted: nil)
  path = String.new("/#{normalized_base_path}user/#{url_escape(id)}")

  params = []
  params << required_fields_param(required_fields) unless required_fields.nil?

  additional_subscription_parameters = path_for_subscription_status_params(opt_in_public_ids,
                                                                           minimum_consent_level, encrypted)
  params << additional_subscription_parameters if additional_subscription_parameters.present?

  path << "?#{params.join('&')}" if params.any?

  path
end