Class: WalmartApIs::Label
- Defined in:
- lib/walmart_ap_is/models/label.rb
Overview
Label Model.
Instance Attribute Summary collapse
-
#custom_text_for_label ⇒ String
TODO: Write general description for this method.
-
#dimensions ⇒ LabelDimensions
TODO: Write general description for this method.
-
#file_contents ⇒ FileContents
TODO: Write general description for this method.
-
#label_format ⇒ LabelFormat
TODO: Write general description for this method.
-
#standard_id_for_label ⇒ StandardIdForLabel
TODO: Write general description for this method.
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(custom_text_for_label: SKIP, dimensions: SKIP, file_contents: SKIP, label_format: SKIP, standard_id_for_label: SKIP, additional_properties: nil) ⇒ Label
constructor
A new instance of Label.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(custom_text_for_label: SKIP, dimensions: SKIP, file_contents: SKIP, label_format: SKIP, standard_id_for_label: SKIP, additional_properties: nil) ⇒ Label
Returns a new instance of Label.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/walmart_ap_is/models/label.rb', line 59 def initialize(custom_text_for_label: SKIP, dimensions: SKIP, file_contents: SKIP, label_format: SKIP, standard_id_for_label: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @custom_text_for_label = custom_text_for_label unless custom_text_for_label == SKIP @dimensions = dimensions unless dimensions == SKIP @file_contents = file_contents unless file_contents == SKIP @label_format = label_format unless label_format == SKIP @standard_id_for_label = standard_id_for_label unless standard_id_for_label == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#custom_text_for_label ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/walmart_ap_is/models/label.rb', line 14 def custom_text_for_label @custom_text_for_label end |
#dimensions ⇒ LabelDimensions
TODO: Write general description for this method
18 19 20 |
# File 'lib/walmart_ap_is/models/label.rb', line 18 def dimensions @dimensions end |
#file_contents ⇒ FileContents
TODO: Write general description for this method
22 23 24 |
# File 'lib/walmart_ap_is/models/label.rb', line 22 def file_contents @file_contents end |
#label_format ⇒ LabelFormat
TODO: Write general description for this method
26 27 28 |
# File 'lib/walmart_ap_is/models/label.rb', line 26 def label_format @label_format end |
#standard_id_for_label ⇒ StandardIdForLabel
TODO: Write general description for this method
30 31 32 |
# File 'lib/walmart_ap_is/models/label.rb', line 30 def standard_id_for_label @standard_id_for_label end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/walmart_ap_is/models/label.rb', line 74 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. custom_text_for_label = hash.key?('customTextForLabel') ? hash['customTextForLabel'] : SKIP dimensions = LabelDimensions.from_hash(hash['dimensions']) if hash['dimensions'] file_contents = FileContents.from_hash(hash['fileContents']) if hash['fileContents'] label_format = hash.key?('labelFormat') ? hash['labelFormat'] : SKIP standard_id_for_label = hash.key?('standardIdForLabel') ? hash['standardIdForLabel'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Label.new(custom_text_for_label: custom_text_for_label, dimensions: dimensions, file_contents: file_contents, label_format: label_format, standard_id_for_label: standard_id_for_label, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/walmart_ap_is/models/label.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['custom_text_for_label'] = 'customTextForLabel' @_hash['dimensions'] = 'dimensions' @_hash['file_contents'] = 'fileContents' @_hash['label_format'] = 'labelFormat' @_hash['standard_id_for_label'] = 'standardIdForLabel' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/walmart_ap_is/models/label.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
44 45 46 47 48 49 50 51 52 |
# File 'lib/walmart_ap_is/models/label.rb', line 44 def self.optionals %w[ custom_text_for_label dimensions file_contents label_format standard_id_for_label ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
112 113 114 115 116 117 118 |
# File 'lib/walmart_ap_is/models/label.rb', line 112 def inspect class_name = self.class.name.split('::').last "<#{class_name} custom_text_for_label: #{@custom_text_for_label.inspect}, dimensions:"\ " #{@dimensions.inspect}, file_contents: #{@file_contents.inspect}, label_format:"\ " #{@label_format.inspect}, standard_id_for_label: #{@standard_id_for_label.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 108 109 |
# File 'lib/walmart_ap_is/models/label.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} custom_text_for_label: #{@custom_text_for_label}, dimensions:"\ " #{@dimensions}, file_contents: #{@file_contents}, label_format: #{@label_format},"\ " standard_id_for_label: #{@standard_id_for_label}, additional_properties:"\ " #{@additional_properties}>" end |