Class: StickyIoRestfulApiV2025731::DataCopyVolumeDiscount

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb

Overview

DataCopyVolumeDiscount 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(id:, name:, description:, is_active:, created_at:, updated_at:, created_by:, updated_by:, is_exclude_non_recurring:, apply_to_type_id:, quantities:, products:, campaigns:, additional_properties: nil) ⇒ DataCopyVolumeDiscount

Returns a new instance of DataCopyVolumeDiscount.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 95

def initialize(id:, name:, description:, is_active:, created_at:,
               updated_at:, created_by:, updated_by:,
               is_exclude_non_recurring:, apply_to_type_id:, quantities:,
               products:, campaigns:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @name = name
  @description = description
  @is_active = is_active
  @created_at = created_at
  @updated_at = updated_at
  @created_by = created_by
  @updated_by = updated_by
  @is_exclude_non_recurring = is_exclude_non_recurring
  @apply_to_type_id = apply_to_type_id
  @quantities = quantities
  @products = products
  @campaigns = campaigns
  @additional_properties = additional_properties
end

Instance Attribute Details

#apply_to_type_idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


50
51
52
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 50

def apply_to_type_id
  @apply_to_type_id
end

#campaignsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


62
63
64
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 62

def campaigns
  @campaigns
end

#created_atString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 30

def created_at
  @created_at
end

#created_byInteger

TODO: Write general description for this method

Returns:

  • (Integer)


38
39
40
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 38

def created_by
  @created_by
end

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 22

def description
  @description
end

#idInteger

TODO: Write general description for this method

Returns:

  • (Integer)


14
15
16
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 14

def id
  @id
end

#is_activeInteger

TODO: Write general description for this method

Returns:

  • (Integer)


26
27
28
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 26

def is_active
  @is_active
end

#is_exclude_non_recurringInteger

TODO: Write general description for this method

Returns:

  • (Integer)


46
47
48
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 46

def is_exclude_non_recurring
  @is_exclude_non_recurring
end

#nameString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 18

def name
  @name
end

#productsArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


58
59
60
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 58

def products
  @products
end

#quantitiesArray[QuantityData]

TODO: Write general description for this method

Returns:



54
55
56
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 54

def quantities
  @quantities
end

#updated_atString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 34

def updated_at
  @updated_at
end

#updated_byString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 42

def updated_by
  @updated_by
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 119

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  is_active = hash.key?('is_active') ? hash['is_active'] : nil
  created_at = hash.key?('created_at') ? hash['created_at'] : nil
  updated_at = hash.key?('updated_at') ? hash['updated_at'] : nil
  created_by = hash.key?('created_by') ? hash['created_by'] : nil
  updated_by = hash.key?('updated_by') ? hash['updated_by'] : nil
  is_exclude_non_recurring =
    hash.key?('is_exclude_non_recurring') ? hash['is_exclude_non_recurring'] : nil
  apply_to_type_id =
    hash.key?('apply_to_type_id') ? hash['apply_to_type_id'] : nil
  # Parameter is an array, so we need to iterate through it
  quantities = nil
  unless hash['quantities'].nil?
    quantities = []
    hash['quantities'].each do |structure|
      quantities << (QuantityData.from_hash(structure) if structure)
    end
  end

  quantities = nil unless hash.key?('quantities')
  products = hash.key?('products') ? hash['products'] : nil
  campaigns = hash.key?('campaigns') ? hash['campaigns'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DataCopyVolumeDiscount.new(id: id,
                             name: name,
                             description: description,
                             is_active: is_active,
                             created_at: created_at,
                             updated_at: updated_at,
                             created_by: created_by,
                             updated_by: updated_by,
                             is_exclude_non_recurring: is_exclude_non_recurring,
                             apply_to_type_id: apply_to_type_id,
                             quantities: quantities,
                             products: products,
                             campaigns: campaigns,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 65

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['name'] = 'name'
  @_hash['description'] = 'description'
  @_hash['is_active'] = 'is_active'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['created_by'] = 'created_by'
  @_hash['updated_by'] = 'updated_by'
  @_hash['is_exclude_non_recurring'] = 'is_exclude_non_recurring'
  @_hash['apply_to_type_id'] = 'apply_to_type_id'
  @_hash['quantities'] = 'quantities'
  @_hash['products'] = 'products'
  @_hash['campaigns'] = 'campaigns'
  @_hash
end

.nullablesObject

An array for nullable fields



89
90
91
92
93
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 89

def self.nullables
  %w[
    updated_by
  ]
end

.optionalsObject

An array for optional fields



84
85
86
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 84

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



184
185
186
187
188
189
190
191
192
193
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 184

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, name: #{@name.inspect}, description:"\
  " #{@description.inspect}, is_active: #{@is_active.inspect}, created_at:"\
  " #{@created_at.inspect}, updated_at: #{@updated_at.inspect}, created_by:"\
  " #{@created_by.inspect}, updated_by: #{@updated_by.inspect}, is_exclude_non_recurring:"\
  " #{@is_exclude_non_recurring.inspect}, apply_to_type_id: #{@apply_to_type_id.inspect},"\
  " quantities: #{@quantities.inspect}, products: #{@products.inspect}, campaigns:"\
  " #{@campaigns.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



173
174
175
176
177
178
179
180
181
# File 'lib/sticky_io_restful_api_v2025731/models/data_copy_volume_discount.rb', line 173

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, name: #{@name}, description: #{@description}, is_active:"\
  " #{@is_active}, created_at: #{@created_at}, updated_at: #{@updated_at}, created_by:"\
  " #{@created_by}, updated_by: #{@updated_by}, is_exclude_non_recurring:"\
  " #{@is_exclude_non_recurring}, apply_to_type_id: #{@apply_to_type_id}, quantities:"\
  " #{@quantities}, products: #{@products}, campaigns: #{@campaigns}, additional_properties:"\
  " #{@additional_properties}>"
end