Class: NewStoreApi::ImportTagResponse

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

Overview

ImportTagResponse 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, created_at = SKIP, customer_count = SKIP, display_name = SKIP, import_id = SKIP, store_ids = SKIP, updated_at = SKIP) ⇒ ImportTagResponse

Returns a new instance of ImportTagResponse.



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/new_store_api/models/import_tag_response.rb', line 74

def initialize(id = nil, created_at = SKIP, customer_count = SKIP,
               display_name = SKIP, import_id = SKIP, store_ids = SKIP,
               updated_at = SKIP)
  @created_at = created_at unless created_at == SKIP
  @customer_count = customer_count unless customer_count == 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
  @updated_at = updated_at unless updated_at == SKIP
end

Instance Attribute Details

#created_atDateTime

Timestamp of the tag creation.

Returns:

  • (DateTime)


15
16
17
# File 'lib/new_store_api/models/import_tag_response.rb', line 15

def created_at
  @created_at
end

#customer_countInteger

The number of customers assigned to this tag.

Returns:

  • (Integer)


19
20
21
# File 'lib/new_store_api/models/import_tag_response.rb', line 19

def customer_count
  @customer_count
end

#display_nameString

The human readable tag identifier.

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/import_tag_response.rb', line 23

def display_name
  @display_name
end

#idString

The tag identifier.

Returns:

  • (String)


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

def id
  @id
end

#import_idString

The import this tag is associated with, if any.

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/import_tag_response.rb', line 31

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])


36
37
38
# File 'lib/new_store_api/models/import_tag_response.rb', line 36

def store_ids
  @store_ids
end

#updated_atDateTime

Timestamp of the latest tag update.

Returns:

  • (DateTime)


40
41
42
# File 'lib/new_store_api/models/import_tag_response.rb', line 40

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/new_store_api/models/import_tag_response.rb', line 87

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end
  customer_count =
    hash.key?('customer_count') ? hash['customer_count'] : SKIP
  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
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               else
                 SKIP
               end

  # Create object from extracted values.
  ImportTagResponse.new(id,
                        created_at,
                        customer_count,
                        display_name,
                        import_id,
                        store_ids,
                        updated_at)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/new_store_api/models/import_tag_response.rb', line 43

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

.nullablesObject

An array for nullable fields



68
69
70
71
72
# File 'lib/new_store_api/models/import_tag_response.rb', line 68

def self.nullables
  %w[
    import_id
  ]
end

.optionalsObject

An array for optional fields



56
57
58
59
60
61
62
63
64
65
# File 'lib/new_store_api/models/import_tag_response.rb', line 56

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



135
136
137
138
139
140
141
# File 'lib/new_store_api/models/import_tag_response.rb', line 135

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

#to_custom_created_atObject



118
119
120
# File 'lib/new_store_api/models/import_tag_response.rb', line 118

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_updated_atObject



122
123
124
# File 'lib/new_store_api/models/import_tag_response.rb', line 122

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
132
# File 'lib/new_store_api/models/import_tag_response.rb', line 127

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