Class: NewStoreApi::CreateTagRequest

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

Overview

CreateTagRequest 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 = nil, display_name = SKIP, import_id = SKIP, store_ids = SKIP) ⇒ CreateTagRequest

Returns a new instance of CreateTagRequest.



55
56
57
58
59
60
61
# File 'lib/new_store_api/models/create_tag_request.rb', line 55

def initialize(id = nil, display_name = SKIP, import_id = SKIP,
               store_ids = SKIP)
  @display_name = display_name unless display_name == SKIP
  @id = id
  @import_id = import_id unless import_id == SKIP
  @store_ids = store_ids unless store_ids == SKIP
end

Instance Attribute Details

#display_nameString

The human readable tag identifier.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/create_tag_request.rb', line 14

def display_name
  @display_name
end

#idString

The tag identifier.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/create_tag_request.rb', line 18

def id
  @id
end

#import_idString

The import this tag is associated with, if any.

Returns:

  • (String)


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

def import_id
  @import_id
end

#store_idsArray[String]

A list of store IDs the tag belongs to. If no store ID is provided, then the tag is global and will be visible for all the stores.

Returns:

  • (Array[String])


27
28
29
# File 'lib/new_store_api/models/create_tag_request.rb', line 27

def store_ids
  @store_ids
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/new_store_api/models/create_tag_request.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
  import_id = hash.key?('import_id') ? hash['import_id'] : SKIP
  store_ids = hash.key?('store_ids') ? hash['store_ids'] : SKIP

  # Create object from extracted values.
  CreateTagRequest.new(id,
                       display_name,
                       import_id,
                       store_ids)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/new_store_api/models/create_tag_request.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['display_name'] = 'display_name'
  @_hash['id'] = 'id'
  @_hash['import_id'] = 'import_id'
  @_hash['store_ids'] = 'store_ids'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
52
53
# File 'lib/new_store_api/models/create_tag_request.rb', line 49

def self.nullables
  %w[
    import_id
  ]
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
# File 'lib/new_store_api/models/create_tag_request.rb', line 40

def self.optionals
  %w[
    display_name
    import_id
    store_ids
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



88
89
90
91
92
# File 'lib/new_store_api/models/create_tag_request.rb', line 88

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

#to_sObject

Provides a human-readable string representation of the object.



81
82
83
84
85
# File 'lib/new_store_api/models/create_tag_request.rb', line 81

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} display_name: #{@display_name}, id: #{@id}, import_id: #{@import_id},"\
  " store_ids: #{@store_ids}>"
end