Class: ApiReference::CreateCustomerAlertRequestParams

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/create_customer_alert_request_params.rb

Overview

CreateCustomerAlertRequestParams Model.

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(type:, currency:, thresholds: SKIP) ⇒ CreateCustomerAlertRequestParams

Returns a new instance of CreateCustomerAlertRequestParams.



48
49
50
51
52
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 48

def initialize(type:, currency:, thresholds: SKIP)
  @thresholds = thresholds unless thresholds == SKIP
  @type = type
  @currency = currency
end

Instance Attribute Details

#currencyString

The case sensitive currency or custom pricing unit to use for this alert.

Returns:

  • (String)


23
24
25
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 23

def currency
  @currency
end

#thresholdsArray[Threshold]

The thresholds that define the values at which the alert will be triggered.

Returns:



15
16
17
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 15

def thresholds
  @thresholds
end

#typeType6

The type of alert to create. This must be a valid alert type.

Returns:



19
20
21
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 19

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  # Parameter is an array, so we need to iterate through it
  thresholds = nil
  unless hash['thresholds'].nil?
    thresholds = []
    hash['thresholds'].each do |structure|
      thresholds << (Threshold.from_hash(structure) if structure)
    end
  end

  thresholds = SKIP unless hash.key?('thresholds')

  # Create object from extracted values.
  CreateCustomerAlertRequestParams.new(type: type,
                                       currency: currency,
                                       thresholds: thresholds)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['thresholds'] = 'thresholds'
  @_hash['type'] = 'type'
  @_hash['currency'] = 'currency'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
45
46
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 42

def self.nullables
  %w[
    thresholds
  ]
end

.optionalsObject

An array for optional fields



35
36
37
38
39
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 35

def self.optionals
  %w[
    thresholds
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



85
86
87
88
89
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 85

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

#to_sObject

Provides a human-readable string representation of the object.



79
80
81
82
# File 'lib/api_reference/models/create_customer_alert_request_params.rb', line 79

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