Class: AdvancedBilling::EventBasedBillingSegmentError

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/advanced_billing/models/event_based_billing_segment_error.rb

Overview

EventBasedBillingSegmentError Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(segments:, additional_properties: {}) ⇒ EventBasedBillingSegmentError

Returns a new instance of EventBasedBillingSegmentError.



36
37
38
39
40
41
42
43
# File 'lib/advanced_billing/models/event_based_billing_segment_error.rb', line 36

def initialize(segments:, additional_properties: {})
  @segments = segments

  # Add additional model properties to the instance.
  additional_properties.each do |_name, _value|
    instance_variable_set("@#{_name}", _value)
  end
end

Instance Attribute Details

#segmentsHash[String, Object]

The key of the object would be a number (an index in the request array) where the error occurred. In the value object, the key represents the field and the value is an array with error messages. In most cases, this object would contain just one key.

Returns:

  • (Hash[String, Object])


17
18
19
# File 'lib/advanced_billing/models/event_based_billing_segment_error.rb', line 17

def segments
  @segments
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/advanced_billing/models/event_based_billing_segment_error.rb', line 46

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  segments = hash.key?('segments') ? hash['segments'] : nil

  # Clean out expected properties from Hash.
  names.each_value { |k| hash.delete(k) }

  # Create object from extracted values.
  EventBasedBillingSegmentError.new(segments: segments,
                                    additional_properties: hash)
end

.namesObject

A mapping from model property names to API property names.



20
21
22
23
24
# File 'lib/advanced_billing/models/event_based_billing_segment_error.rb', line 20

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

.nullablesObject

An array for nullable fields



32
33
34
# File 'lib/advanced_billing/models/event_based_billing_segment_error.rb', line 32

def self.nullables
  []
end

.optionalsObject

An array for optional fields



27
28
29
# File 'lib/advanced_billing/models/event_based_billing_segment_error.rb', line 27

def self.optionals
  []
end