Class: UltracartClient::SfvbVersionResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/sfvb_version_response.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SfvbVersionResponse

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {}) —

    Model attributes in the form of hash



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 155

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbVersionResponse` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbVersionResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'container_manager_version')
    self.container_manager_version = attributes[:'container_manager_version']
  end

  if attributes.key?(:'container_versions_retained')
    self.container_versions_retained = attributes[:'container_versions_retained']
  end

  if attributes.key?(:'element_count')
    self.element_count = attributes[:'element_count']
  end

  if attributes.key?(:'max_asset_bytes')
    self.max_asset_bytes = attributes[:'max_asset_bytes']
  end

  if attributes.key?(:'max_cjson_bytes')
    self.max_cjson_bytes = attributes[:'max_cjson_bytes']
  end

  if attributes.key?(:'max_directory_entries')
    self.max_directory_entries = attributes[:'max_directory_entries']
  end

  if attributes.key?(:'max_library_results_per_page')
    self.max_library_results_per_page = attributes[:'max_library_results_per_page']
  end

  if attributes.key?(:'max_menu_depth')
    self.max_menu_depth = attributes[:'max_menu_depth']
  end

  if attributes.key?(:'max_menu_items')
    self.max_menu_items = attributes[:'max_menu_items']
  end

  if attributes.key?(:'max_preview_session_bytes')
    self.max_preview_session_bytes = attributes[:'max_preview_session_bytes']
  end

  if attributes.key?(:'max_revertable_bytes')
    self.max_revertable_bytes = attributes[:'max_revertable_bytes']
  end

  if attributes.key?(:'max_search_results')
    self.max_search_results = attributes[:'max_search_results']
  end

  if attributes.key?(:'max_template_bytes')
    self.max_template_bytes = attributes[:'max_template_bytes']
  end

  if attributes.key?(:'max_text_read_bytes')
    self.max_text_read_bytes = attributes[:'max_text_read_bytes']
  end

  if attributes.key?(:'max_video_bytes')
    self.max_video_bytes = attributes[:'max_video_bytes']
  end

  if attributes.key?(:'max_widget_ids_per_request')
    self.max_widget_ids_per_request = attributes[:'max_widget_ids_per_request']
  end

  if attributes.key?(:'preview_session_ttl_seconds')
    self.preview_session_ttl_seconds = attributes[:'preview_session_ttl_seconds']
  end

  if attributes.key?(:'release')
    self.release = attributes[:'release']
  end
end

Instance Attribute Details

#container_manager_version ⇒ Object

Container manager version used to compile for this merchant.



19
20
21
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 19

def container_manager_version
  @container_manager_version
end

#container_versions_retained ⇒ Object

Versions kept per non-file container before the oldest are pruned. Beyond this, history is gone - not merely paginated.



22
23
24
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 22

def container_versions_retained
  @container_versions_retained
end

#element_count ⇒ Object

Number of element types this version recognizes.



25
26
27
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 25

def element_count
  @element_count
end

#max_asset_bytes ⇒ Object

Largest binary asset that can be uploaded, in bytes, for every accepted type except video.



28
29
30
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 28

def max_asset_bytes
  @max_asset_bytes
end

#max_cjson_bytes ⇒ Object

Largest CJSON document that will be parsed, in bytes.



31
32
33
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 31

def max_cjson_bytes
  @max_cjson_bytes
end

#max_directory_entries ⇒ Object

Most entries one directory listing returns. Asking for more is silently reduced to this rather than refused, so compare against it instead of trusting that you got what you asked for. The listing does set a truncated flag when it drops entries.



34
35
36
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 34

def max_directory_entries
  @max_directory_entries
end

#max_library_results_per_page ⇒ Object

Most element library results one page returns. Asking for more is silently reduced to this, and unlike the directory listing there is no truncation flag on the response, so this number is the only way to know a larger request was cut.



37
38
39
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 37

def max_library_results_per_page
  @max_library_results_per_page
end

#max_menu_depth ⇒ Object

How deeply store menu entries can nest.



40
41
42
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 40

def max_menu_depth
  @max_menu_depth
end

#max_menu_items ⇒ Object

Most entries one store menu can hold, counting every level of the tree. A menu is navigation that renders on every page, so this is deliberately far below what the storage would physically accept.



43
44
45
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 43

def max_menu_items
  @max_menu_items
end

#max_preview_session_bytes ⇒ Object

Largest payload one preview session may hold, in bytes.



46
47
48
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 46

def max_preview_session_bytes
  @max_preview_session_bytes
end

#max_revertable_bytes ⇒ Object

Largest historical version files/revert will restore, in bytes. Higher than max_text_read_bytes deliberately - putting back a version that is already stored is cheaper than serving it as JSON, so a version too large to read can still be reverted to.



49
50
51
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 49

def max_revertable_bytes
  @max_revertable_bytes
end

#max_search_results ⇒ Object

Hard ceiling on file search results per page.



52
53
54
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 52

def max_search_results
  @max_search_results
end

#max_template_bytes ⇒ Object

Largest .vm template that can be written, in bytes. Narrow on purpose - it gates writes, only for files ending in .vm, and it is not the ceiling on reading a file back. Use max_text_read_bytes for that.



55
56
57
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 55

def max_template_bytes
  @max_template_bytes
end

#max_text_read_bytes ⇒ Object

Largest file files/content will return as text, in bytes. A file above this is refused with sfvb.too_large however small its history versions are. Bigger than max_template_bytes, so a file can be readable here and still be too large to write back as a template. Anything above this is still readable in full through files/download, which returns raw bytes and applies no ceiling.



58
59
60
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 58

def max_text_read_bytes
  @max_text_read_bytes
end

#max_video_bytes ⇒ Object

Largest video that can be uploaded, in bytes. Video is the one type allowed past max_asset_bytes.



61
62
63
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 61

def max_video_bytes
  @max_video_bytes
end

#max_widget_ids_per_request ⇒ Object

Most widget ids that can be reserved in one call.



64
65
66
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 64

def max_widget_ids_per_request
  @max_widget_ids_per_request
end

#preview_session_ttl_seconds ⇒ Object

Seconds a preview session survives before expiring.



67
68
69
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 67

def preview_session_ttl_seconds
  @preview_session_ttl_seconds
end

#release ⇒ Object

Release channel selected for this merchant.



70
71
72
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 70

def release
  @release
end

Class Method Details

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



119
120
121
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 119

def self.acceptable_attributes
  attribute_map.values
end

.attribute_map ⇒ Object

Attribute mapping from ruby-style variable name to JSON key.



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

def self.attribute_map
  {
    :'container_manager_version' => :'container_manager_version',
    :'container_versions_retained' => :'container_versions_retained',
    :'element_count' => :'element_count',
    :'max_asset_bytes' => :'max_asset_bytes',
    :'max_cjson_bytes' => :'max_cjson_bytes',
    :'max_directory_entries' => :'max_directory_entries',
    :'max_library_results_per_page' => :'max_library_results_per_page',
    :'max_menu_depth' => :'max_menu_depth',
    :'max_menu_items' => :'max_menu_items',
    :'max_preview_session_bytes' => :'max_preview_session_bytes',
    :'max_revertable_bytes' => :'max_revertable_bytes',
    :'max_search_results' => :'max_search_results',
    :'max_template_bytes' => :'max_template_bytes',
    :'max_text_read_bytes' => :'max_text_read_bytes',
    :'max_video_bytes' => :'max_video_bytes',
    :'max_widget_ids_per_request' => :'max_widget_ids_per_request',
    :'preview_session_ttl_seconds' => :'preview_session_ttl_seconds',
    :'release' => :'release'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



306
307
308
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 306

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullable ⇒ Object

List of attributes with nullable: true



148
149
150
151
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 148

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 124

def self.openapi_types
  {
    :'container_manager_version' => :'String',
    :'container_versions_retained' => :'Integer',
    :'element_count' => :'Integer',
    :'max_asset_bytes' => :'Integer',
    :'max_cjson_bytes' => :'Integer',
    :'max_directory_entries' => :'Integer',
    :'max_library_results_per_page' => :'Integer',
    :'max_menu_depth' => :'Integer',
    :'max_menu_items' => :'Integer',
    :'max_preview_session_bytes' => :'Integer',
    :'max_revertable_bytes' => :'Integer',
    :'max_search_results' => :'Integer',
    :'max_template_bytes' => :'Integer',
    :'max_text_read_bytes' => :'Integer',
    :'max_video_bytes' => :'Integer',
    :'max_widget_ids_per_request' => :'Integer',
    :'preview_session_ttl_seconds' => :'Integer',
    :'release' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 268

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      container_manager_version == o.container_manager_version &&
      container_versions_retained == o.container_versions_retained &&
      element_count == o.element_count &&
      max_asset_bytes == o.max_asset_bytes &&
      max_cjson_bytes == o.max_cjson_bytes &&
      max_directory_entries == o.max_directory_entries &&
      max_library_results_per_page == o.max_library_results_per_page &&
      max_menu_depth == o.max_menu_depth &&
      max_menu_items == o.max_menu_items &&
      max_preview_session_bytes == o.max_preview_session_bytes &&
      max_revertable_bytes == o.max_revertable_bytes &&
      max_search_results == o.max_search_results &&
      max_template_bytes == o.max_template_bytes &&
      max_text_read_bytes == o.max_text_read_bytes &&
      max_video_bytes == o.max_video_bytes &&
      max_widget_ids_per_request == o.max_widget_ids_per_request &&
      preview_session_ttl_seconds == o.preview_session_ttl_seconds &&
      release == o.release
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string —

    type Data type

  • string —

    value Value to be deserialized

Returns:

  • (Object) —

    Deserialized data



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 337

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = UltracartClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object) —

    Any valid value

Returns:

  • (Hash) —

    Returns the value in the form of hash



408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 408

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 313

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


293
294
295
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 293

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



299
300
301
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 299

def hash
  [container_manager_version, container_versions_retained, element_count, max_asset_bytes, max_cjson_bytes, max_directory_entries, max_library_results_per_page, max_menu_depth, max_menu_items, max_preview_session_bytes, max_revertable_bytes, max_search_results, max_template_bytes, max_text_read_bytes, max_video_bytes, max_widget_ids_per_request, preview_session_ttl_seconds, release].hash
end

#list_invalid_properties ⇒ Object

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



243
244
245
246
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 243

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_body ⇒ Hash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash) —

    Returns the object in the form of hash



384
385
386
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 384

def to_body
  to_hash
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 390

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_s ⇒ String

Returns the string representation of the object

Returns:

  • (String) —

    String presentation of the object



378
379
380
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 378

def to_s
  to_hash.to_s
end

#valid? ⇒ Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean) —

    true if the model is valid



250
251
252
253
254
# File 'lib/ultracart_api/models/sfvb_version_response.rb', line 250

def valid?
  release_validator = EnumAttributeValidator.new('String', ["ga", "beta", "alpha"])
  return false unless release_validator.valid?(@release)
  true
end