Class: Verizon::Item2
- Defined in:
- lib/verizon/models/item2.rb
Overview
Item2 Model.
Instance Attribute Summary collapse
-
#text ⇒ String
Text phrase provides very short sections of text interspersed between the ITIS codes to create phrases.
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(text:) ⇒ Item2
constructor
A new instance of Item2.
-
#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(text:) ⇒ Item2
Returns a new instance of Item2.
36 37 38 |
# File 'lib/verizon/models/item2.rb', line 36 def initialize(text:) @text = text end |
Instance Attribute Details
#text ⇒ String
Text phrase provides very short sections of text interspersed between the ITIS codes to create phrases. In general, this is used for expressing proper nouns, such as street names reflecting local expressions that do not appear in the ITIS tables.
17 18 19 |
# File 'lib/verizon/models/item2.rb', line 17 def text @text end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
41 42 43 44 45 46 47 48 49 |
# File 'lib/verizon/models/item2.rb', line 41 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. text = hash.key?('text') ? hash['text'] : nil # Create object from extracted values. Item2.new(text: text) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 |
# File 'lib/verizon/models/item2.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['text'] = 'text' @_hash end |
.nullables ⇒ Object
An array for nullable fields
32 33 34 |
# File 'lib/verizon/models/item2.rb', line 32 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
27 28 29 |
# File 'lib/verizon/models/item2.rb', line 27 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/verizon/models/item2.rb', line 53 def self.validate(value) if value.instance_of? self return APIHelper.valid_type?(value.text, ->(val) { val.instance_of? String }) end return false unless value.instance_of? Hash APIHelper.valid_type?(value['text'], ->(val) { val.instance_of? String }) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
72 73 74 75 |
# File 'lib/verizon/models/item2.rb', line 72 def inspect class_name = self.class.name.split('::').last "<#{class_name} text: #{@text.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
66 67 68 69 |
# File 'lib/verizon/models/item2.rb', line 66 def to_s class_name = self.class.name.split('::').last "<#{class_name} text: #{@text}>" end |