Class: NewStoreApi::ImportResponse

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

Overview

ImportResponse 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, display_name = SKIP, s3_uri = SKIP, status = SKIP, status_notes = SKIP, type = SKIP) ⇒ ImportResponse

Returns a new instance of ImportResponse.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/new_store_api/models/import_response.rb', line 72

def initialize(id = nil, created_at = SKIP, display_name = SKIP,
               s3_uri = SKIP, status = SKIP, status_notes = SKIP,
               type = SKIP)
  @created_at = created_at unless created_at == SKIP
  @display_name = display_name unless display_name == SKIP
  @id = id
  @s3_uri = s3_uri unless s3_uri == SKIP
  @status = status unless status == SKIP
  @status_notes = status_notes unless status_notes == SKIP
  @type = type unless type == SKIP
end

Instance Attribute Details

#created_atDateTime

Timestamp of the import creation.

Returns:

  • (DateTime)


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

def created_at
  @created_at
end

#display_nameString

The human readable import identifier.

Returns:

  • (String)


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

def display_name
  @display_name
end

#idString

The import identifier.

Returns:

  • (String)


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

def id
  @id
end

#s3_uriString

The s3 URI of the CSV used in the import.

Returns:

  • (String)


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

def s3_uri
  @s3_uri
end

#statusStatusEnum

The current status of the import.

Returns:



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

def status
  @status
end

#status_notesArray[String]

The notes relating to the status of the import, if it is FAILED or PARTIALLY_COMPLETED

Returns:

  • (Array[String])


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

def status_notes
  @status_notes
end

#typeString

The type of the import.

Returns:

  • (String)


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

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/new_store_api/models/import_response.rb', line 85

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
  display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
  s3_uri = hash.key?('s3_uri') ? hash['s3_uri'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  status_notes = hash.key?('status_notes') ? hash['status_notes'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP

  # Create object from extracted values.
  ImportResponse.new(id,
                     created_at,
                     display_name,
                     s3_uri,
                     status,
                     status_notes,
                     type)
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_response.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_at'] = 'created_at'
  @_hash['display_name'] = 'display_name'
  @_hash['id'] = 'id'
  @_hash['s3_uri'] = 's3_uri'
  @_hash['status'] = 'status'
  @_hash['status_notes'] = 'status_notes'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
# File 'lib/new_store_api/models/import_response.rb', line 68

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    created_at
    display_name
    s3_uri
    status
    status_notes
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/new_store_api/models/import_response.rb', line 123

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at.inspect}, display_name: #{@display_name.inspect},"\
  " id: #{@id.inspect}, s3_uri: #{@s3_uri.inspect}, status: #{@status.inspect}, status_notes:"\
  " #{@status_notes.inspect}, type: #{@type.inspect}>"
end

#to_custom_created_atObject



111
112
113
# File 'lib/new_store_api/models/import_response.rb', line 111

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
# File 'lib/new_store_api/models/import_response.rb', line 116

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at}, display_name: #{@display_name}, id: #{@id},"\
  " s3_uri: #{@s3_uri}, status: #{@status}, status_notes: #{@status_notes}, type: #{@type}>"
end