Class: Asdawqw::Text
Overview
Text Model.
Instance Attribute Summary collapse
-
#language ⇒ String
Language 2 letter value as ISO 639-1 code (en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
-
#value ⇒ String
Text value.
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.
Instance Method Summary collapse
-
#initialize(language = nil, value = nil) ⇒ Text
constructor
A new instance of Text.
Methods inherited from BaseModel
Constructor Details
#initialize(language = nil, value = nil) ⇒ Text
Returns a new instance of Text.
27 28 29 30 31 |
# File 'lib/asdawqw/models/text.rb', line 27 def initialize(language = nil, value = nil) @language = language @value = value end |
Instance Attribute Details
#language ⇒ String
Language 2 letter value as ISO 639-1 code (en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
12 13 14 |
# File 'lib/asdawqw/models/text.rb', line 12 def language @language end |
#value ⇒ String
Text value. Send here only plain text. Do not use HTML or any other characters.
17 18 19 |
# File 'lib/asdawqw/models/text.rb', line 17 def value @value end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/asdawqw/models/text.rb', line 34 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. language = hash['language'] value = hash['value'] # Create object from extracted values. Text.new(language, value) end |
.names ⇒ Object
A mapping from model property names to API property names.
20 21 22 23 24 25 |
# File 'lib/asdawqw/models/text.rb', line 20 def self.names @_hash = {} if @_hash.nil? @_hash['language'] = 'language' @_hash['value'] = 'value' @_hash end |