Class: Conversant::V3::Base

Inherits:
Object
  • Object
show all
Includes:
HttpClient
Defined in:
sig/conversant/v3.rbs,
lib/conversant/v3/base.rb

Overview

Base class for all V3 services

Constant Summary

Constants included from HttpClient

HttpClient::PORTAL_SESSION_REDIS_KEY, HttpClient::SSO_GW_SESSION2_REDIS_KEY

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HttpClient

#add_cookies_to_headers, #authenticate, #cookie_jar, #cookie_jar=, #debug_log, #extract_form_action, #http_get, #http_post, #login_url, #parse_cookie_to_jar, #request, #sso_login, #update_cookie_jar

Constructor Details

#initialize(customer_id, type = 2) ⇒ Base

Returns a new instance of Base.

Parameters:

  • customer_id (Integer)
  • type (Integer) (defaults to: 2)


10
11
12
13
14
# File 'lib/conversant/v3/base.rb', line 10

def initialize(customer_id, type = 2)
  @customer_id = customer_id
  @type = type
  validate_configuration!
end

Instance Attribute Details

#customer_idInteger (readonly)

Returns the value of attribute customer_id.

Returns:

  • (Integer)


8
9
10
# File 'lib/conversant/v3/base.rb', line 8

def customer_id
  @customer_id
end

#typeInteger (readonly)

Returns the value of attribute type.

Returns:

  • (Integer)


8
9
10
# File 'lib/conversant/v3/base.rb', line 8

def type
  @type
end

Instance Method Details

#configurationConversant::Configuration



22
23
24
# File 'lib/conversant/v3/base.rb', line 22

def configuration
  Conversant.configuration
end

#identifierString

Returns:

  • (String)


38
39
40
# File 'lib/conversant/v3/base.rb', line 38

def identifier
  @identifier ||= self.class.name.split('::').map(&:upcase).join('-')
end

#loggerObject

Returns:

  • (Object)


42
43
44
# File 'lib/conversant/v3/base.rb', line 42

def logger
  configuration.logger
end

#portal_endpointString

Returns:

  • (String)


30
31
32
# File 'lib/conversant/v3/base.rb', line 30

def portal_endpoint
  configuration.portal_endpoint
end

#redisObject

Returns:

  • (Object)


26
27
28
# File 'lib/conversant/v3/base.rb', line 26

def redis
  configuration.redis
end

#sso_endpointString

Returns:

  • (String)


34
35
36
# File 'lib/conversant/v3/base.rb', line 34

def sso_endpoint
  configuration.sso_endpoint
end

#validate_configuration!void

This method returns an undefined value.



18
19
20
# File 'lib/conversant/v3/base.rb', line 18

def validate_configuration!
  Conversant.configuration.validate!
end