Class: NewStoreApi::IntegrationConfig

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/integration_config.rb

Overview

Third party promotions engine integration config.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(auth_token = SKIP, session_update_url = SKIP) ⇒ IntegrationConfig

Returns a new instance of IntegrationConfig.



45
46
47
48
# File 'lib/new_store_api/models/integration_config.rb', line 45

def initialize(auth_token = SKIP, session_update_url = SKIP)
  @auth_token = auth_token unless auth_token == SKIP
  @session_update_url = session_update_url unless session_update_url == SKIP
end

Instance Attribute Details

#auth_tokenString

The auth token that will be used as Bearer token for the authentication with the third party integration APIs. It can be empty.

Returns:

  • (String)


15
16
17
# File 'lib/new_store_api/models/integration_config.rb', line 15

def auth_token
  @auth_token
end

#session_update_urlString

Session Update URL. The URL that will be called each time the order gets updated in NewStore's Associate App. The URL has to end with the placeholder customerSessionId that will be replaced with the cart ID/order ID.

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/integration_config.rb', line 22

def session_update_url
  @session_update_url
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/new_store_api/models/integration_config.rb', line 51

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  auth_token = hash.key?('auth_token') ? hash['auth_token'] : SKIP
  session_update_url =
    hash.key?('session_update_url') ? hash['session_update_url'] : SKIP

  # Create object from extracted values.
  IntegrationConfig.new(auth_token,
                        session_update_url)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/new_store_api/models/integration_config.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['auth_token'] = 'auth_token'
  @_hash['session_update_url'] = 'session_update_url'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/new_store_api/models/integration_config.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



33
34
35
36
37
38
# File 'lib/new_store_api/models/integration_config.rb', line 33

def self.optionals
  %w[
    auth_token
    session_update_url
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



71
72
73
74
75
# File 'lib/new_store_api/models/integration_config.rb', line 71

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_token: #{@auth_token.inspect}, session_update_url:"\
  " #{@session_update_url.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



65
66
67
68
# File 'lib/new_store_api/models/integration_config.rb', line 65

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} auth_token: #{@auth_token}, session_update_url: #{@session_update_url}>"
end