Class: WordsApi::PronunciationDetails
- Defined in:
- lib/words_api/models/pronunciation_details.rb
Overview
This model contains pronunciation details of a specific word.
Instance Attribute Summary collapse
-
#all ⇒ String
The pronunciation of the word.
-
#noun ⇒ String
The noun pronunciation of the word.
-
#verb ⇒ String
The verb pronunciation of the word.
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(all = nil, noun = SKIP, verb = SKIP) ⇒ PronunciationDetails
constructor
A new instance of PronunciationDetails.
Methods inherited from BaseModel
Constructor Details
#initialize(all = nil, noun = SKIP, verb = SKIP) ⇒ PronunciationDetails
Returns a new instance of PronunciationDetails.
46 47 48 49 50 |
# File 'lib/words_api/models/pronunciation_details.rb', line 46 def initialize(all = nil, noun = SKIP, verb = SKIP) @all = all @noun = noun unless noun == SKIP @verb = verb unless verb == SKIP end |
Instance Attribute Details
#all ⇒ String
The pronunciation of the word.
14 15 16 |
# File 'lib/words_api/models/pronunciation_details.rb', line 14 def all @all end |
#noun ⇒ String
The noun pronunciation of the word.
18 19 20 |
# File 'lib/words_api/models/pronunciation_details.rb', line 18 def noun @noun end |
#verb ⇒ String
The verb pronunciation of the word.
22 23 24 |
# File 'lib/words_api/models/pronunciation_details.rb', line 22 def verb @verb end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/words_api/models/pronunciation_details.rb', line 53 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. all = hash.key?('all') ? hash['all'] : nil noun = hash.key?('noun') ? hash['noun'] : SKIP verb = hash.key?('verb') ? hash['verb'] : SKIP # Create object from extracted values. PronunciationDetails.new(all, noun, verb) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/words_api/models/pronunciation_details.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['all'] = 'all' @_hash['noun'] = 'noun' @_hash['verb'] = 'verb' @_hash end |
.nullables ⇒ Object
An array for nullable fields
42 43 44 |
# File 'lib/words_api/models/pronunciation_details.rb', line 42 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 |
# File 'lib/words_api/models/pronunciation_details.rb', line 34 def self.optionals %w[ noun verb ] end |