Class: NewStoreApi::CreateJobRequest
- Defined in:
- lib/new_store_api/models/create_job_request.rb
Overview
Request model for creating a new export job.
Instance Attribute Summary collapse
-
#compressed ⇒ TrueClass | FalseClass
Whether to compress the export files (GZIP compression).
-
#conditions ⇒ Conditions
A collection of conditions, implicitly joined by AND.
-
#dataset ⇒ String
Dataset identifier to export.
-
#fields ⇒ Object
Optional list of fields to export.
-
#mode ⇒ String
Execution mode: 'sync' for immediate results, 'async' for background processing.
-
#period_end ⇒ DateTime
End of the export period (ISO 8601 format).
-
#period_start ⇒ DateTime
Start of the export period (ISO 8601 format).
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(conditions = nil, dataset = nil, period_end = nil, period_start = nil, compressed = false, fields = SKIP, mode = 'async') ⇒ CreateJobRequest
constructor
A new instance of CreateJobRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_period_end ⇒ Object
- #to_custom_period_start ⇒ 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(conditions = nil, dataset = nil, period_end = nil, period_start = nil, compressed = false, fields = SKIP, mode = 'async') ⇒ CreateJobRequest
Returns a new instance of CreateJobRequest.
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/new_store_api/models/create_job_request.rb', line 70 def initialize(conditions = nil, dataset = nil, period_end = nil, period_start = nil, compressed = false, fields = SKIP, mode = 'async') @compressed = compressed unless compressed == SKIP @conditions = conditions @dataset = dataset @fields = fields unless fields == SKIP @mode = mode unless mode == SKIP @period_end = period_end @period_start = period_start end |
Instance Attribute Details
#compressed ⇒ TrueClass | FalseClass
Whether to compress the export files (GZIP compression)
15 16 17 |
# File 'lib/new_store_api/models/create_job_request.rb', line 15 def compressed @compressed end |
#conditions ⇒ Conditions
A collection of conditions, implicitly joined by AND.
19 20 21 |
# File 'lib/new_store_api/models/create_job_request.rb', line 19 def conditions @conditions end |
#dataset ⇒ String
Dataset identifier to export
23 24 25 |
# File 'lib/new_store_api/models/create_job_request.rb', line 23 def dataset @dataset end |
#fields ⇒ Object
Optional list of fields to export. If not provided, all fields will be exported.
28 29 30 |
# File 'lib/new_store_api/models/create_job_request.rb', line 28 def fields @fields end |
#mode ⇒ String
Execution mode: 'sync' for immediate results, 'async' for background processing
33 34 35 |
# File 'lib/new_store_api/models/create_job_request.rb', line 33 def mode @mode end |
#period_end ⇒ DateTime
End of the export period (ISO 8601 format)
37 38 39 |
# File 'lib/new_store_api/models/create_job_request.rb', line 37 def period_end @period_end end |
#period_start ⇒ DateTime
Start of the export period (ISO 8601 format)
41 42 43 |
# File 'lib/new_store_api/models/create_job_request.rb', line 41 def period_start @period_start end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
83 84 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/create_job_request.rb', line 83 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. conditions = Conditions.from_hash(hash['conditions']) if hash['conditions'] dataset = hash.key?('dataset') ? hash['dataset'] : nil period_end = if hash.key?('period_end') (DateTimeHelper.from_rfc3339(hash['period_end']) if hash['period_end']) end period_start = if hash.key?('period_start') (DateTimeHelper.from_rfc3339(hash['period_start']) if hash['period_start']) end compressed = hash['compressed'] ||= false fields = hash.key?('fields') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:CreateJobRequestFields), hash['fields'] ) : SKIP mode = hash['mode'] ||= 'async' # Create object from extracted values. CreateJobRequest.new(conditions, dataset, period_end, period_start, compressed, fields, mode) end |
.names ⇒ Object
A mapping from model property names to API property names.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/new_store_api/models/create_job_request.rb', line 44 def self.names @_hash = {} if @_hash.nil? @_hash['compressed'] = 'compressed' @_hash['conditions'] = 'conditions' @_hash['dataset'] = 'dataset' @_hash['fields'] = 'fields' @_hash['mode'] = 'mode' @_hash['period_end'] = 'period_end' @_hash['period_start'] = 'period_start' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/new_store_api/models/create_job_request.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
57 58 59 60 61 62 63 |
# File 'lib/new_store_api/models/create_job_request.rb', line 57 def self.optionals %w[ compressed fields mode ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/new_store_api/models/create_job_request.rb', line 121 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.conditions, ->(val) { Conditions.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.dataset, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.period_end, ->(val) { val.instance_of? DateTime }) and APIHelper.valid_type?(value.period_start, ->(val) { val.instance_of? DateTime }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['conditions'], ->(val) { Conditions.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['dataset'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['period_end'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['period_start'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
160 161 162 163 164 165 |
# File 'lib/new_store_api/models/create_job_request.rb', line 160 def inspect class_name = self.class.name.split('::').last "<#{class_name} compressed: #{@compressed.inspect}, conditions: #{@conditions.inspect},"\ " dataset: #{@dataset.inspect}, fields: #{@fields.inspect}, mode: #{@mode.inspect},"\ " period_end: #{@period_end.inspect}, period_start: #{@period_start.inspect}>" end |
#to_custom_period_end ⇒ Object
111 112 113 |
# File 'lib/new_store_api/models/create_job_request.rb', line 111 def to_custom_period_end DateTimeHelper.to_rfc3339(period_end) end |
#to_custom_period_start ⇒ Object
115 116 117 |
# File 'lib/new_store_api/models/create_job_request.rb', line 115 def to_custom_period_start DateTimeHelper.to_rfc3339(period_start) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
152 153 154 155 156 157 |
# File 'lib/new_store_api/models/create_job_request.rb', line 152 def to_s class_name = self.class.name.split('::').last "<#{class_name} compressed: #{@compressed}, conditions: #{@conditions}, dataset:"\ " #{@dataset}, fields: #{@fields}, mode: #{@mode}, period_end: #{@period_end}, period_start:"\ " #{@period_start}>" end |