Class: NewStoreApi::OperationResponse
- Defined in:
- lib/new_store_api/models/operation_response.rb
Overview
Status and details of an asynchronous write operation.
Instance Attribute Summary collapse
-
#created_at ⇒ DateTime
Timestamp when the operation was created.
-
#error ⇒ OperationError
Details of a backend service failure during operation execution.
-
#id ⇒ String
Unique operation identifier.
-
#result_version ⇒ String
The new settings version after successful completion (e.g. "v43").
-
#status ⇒ OperationStatusEnum
Lifecycle stage of an async write operation.
-
#store_id ⇒ String
Store targeted by this operation.
-
#tenant_id ⇒ String
Tenant that owns this operation.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(created_at = nil, id = nil, status = nil, tenant_id = nil, error = SKIP, result_version = SKIP, store_id = SKIP) ⇒ OperationResponse
constructor
A new instance of OperationResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(created_at = nil, id = nil, status = nil, tenant_id = nil, error = SKIP, result_version = SKIP, store_id = SKIP) ⇒ OperationResponse
Returns a new instance of OperationResponse.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/new_store_api/models/operation_response.rb', line 69 def initialize(created_at = nil, id = nil, status = nil, tenant_id = nil, error = SKIP, result_version = SKIP, store_id = SKIP) @created_at = created_at @error = error unless error == SKIP @id = id @result_version = result_version unless result_version == SKIP @status = status @store_id = store_id unless store_id == SKIP @tenant_id = tenant_id end |
Instance Attribute Details
#created_at ⇒ DateTime
Timestamp when the operation was created.
15 16 17 |
# File 'lib/new_store_api/models/operation_response.rb', line 15 def created_at @created_at end |
#error ⇒ OperationError
Details of a backend service failure during operation execution.
19 20 21 |
# File 'lib/new_store_api/models/operation_response.rb', line 19 def error @error end |
#id ⇒ String
Unique operation identifier.
23 24 25 |
# File 'lib/new_store_api/models/operation_response.rb', line 23 def id @id end |
#result_version ⇒ String
The new settings version after successful completion (e.g. "v43"). Only present when status is "completed".
28 29 30 |
# File 'lib/new_store_api/models/operation_response.rb', line 28 def result_version @result_version end |
#status ⇒ OperationStatusEnum
Lifecycle stage of an async write operation.
32 33 34 |
# File 'lib/new_store_api/models/operation_response.rb', line 32 def status @status end |
#store_id ⇒ String
Store targeted by this operation. Absent for global writes.
36 37 38 |
# File 'lib/new_store_api/models/operation_response.rb', line 36 def store_id @store_id end |
#tenant_id ⇒ String
Tenant that owns this operation.
40 41 42 |
# File 'lib/new_store_api/models/operation_response.rb', line 40 def tenant_id @tenant_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/new_store_api/models/operation_response.rb', line 81 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end id = hash.key?('id') ? hash['id'] : nil status = hash.key?('status') ? hash['status'] : nil tenant_id = hash.key?('tenant_id') ? hash['tenant_id'] : nil error = OperationError.from_hash(hash['error']) if hash['error'] result_version = hash.key?('result_version') ? hash['result_version'] : SKIP store_id = hash.key?('store_id') ? hash['store_id'] : SKIP # Create object from extracted values. OperationResponse.new(created_at, id, status, tenant_id, error, result_version, store_id) end |
.names ⇒ Object
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/operation_response.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['created_at'] = 'created_at' @_hash['error'] = 'error' @_hash['id'] = 'id' @_hash['result_version'] = 'result_version' @_hash['status'] = 'status' @_hash['store_id'] = 'store_id' @_hash['tenant_id'] = 'tenant_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
65 66 67 |
# File 'lib/new_store_api/models/operation_response.rb', line 65 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 |
# File 'lib/new_store_api/models/operation_response.rb', line 56 def self.optionals %w[ error result_version store_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
118 119 120 121 122 123 |
# File 'lib/new_store_api/models/operation_response.rb', line 118 def inspect class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at.inspect}, error: #{@error.inspect}, id:"\ " #{@id.inspect}, result_version: #{@result_version.inspect}, status: #{@status.inspect},"\ " store_id: #{@store_id.inspect}, tenant_id: #{@tenant_id.inspect}>" end |
#to_custom_created_at ⇒ Object
106 107 108 |
# File 'lib/new_store_api/models/operation_response.rb', line 106 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 |
# File 'lib/new_store_api/models/operation_response.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} created_at: #{@created_at}, error: #{@error}, id: #{@id}, result_version:"\ " #{@result_version}, status: #{@status}, store_id: #{@store_id}, tenant_id: #{@tenant_id}>" end |