Class: Asdawqw::Notes
- Defined in:
- lib/asdawqw/models/notes.rb
Overview
Model where you can define different kinds of text values. If you need to delete some kind of texts, for example short description, you can do this on Update call (PUT), and you need to pass empty array for texts value, for example : “shortDescription”: { “texts”: [ ] }
Instance Attribute Summary collapse
-
#description ⇒ DescriptionTextModel
Main description per languages.
-
#fine_print ⇒ DescriptionTextModel
Fine print description per languages.
-
#house_rules ⇒ DescriptionTextModel
House rules description per languages.
-
#name ⇒ DescriptionTextModel
Property name per languages.
-
#short_description ⇒ DescriptionTextModel
Short description per languages.
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(description = nil, house_rules = nil, fine_print = nil, short_description = nil, name = nil) ⇒ Notes
constructor
A new instance of Notes.
Methods inherited from BaseModel
Constructor Details
#initialize(description = nil, house_rules = nil, fine_print = nil, short_description = nil, name = nil) ⇒ Notes
Returns a new instance of Notes.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/asdawqw/models/notes.rb', line 43 def initialize(description = nil, house_rules = nil, fine_print = nil, short_description = nil, name = nil) @description = description @house_rules = house_rules @fine_print = fine_print @short_description = short_description @name = name end |
Instance Attribute Details
#description ⇒ DescriptionTextModel
Main description per languages
14 15 16 |
# File 'lib/asdawqw/models/notes.rb', line 14 def description @description end |
#fine_print ⇒ DescriptionTextModel
Fine print description per languages
22 23 24 |
# File 'lib/asdawqw/models/notes.rb', line 22 def fine_print @fine_print end |
#house_rules ⇒ DescriptionTextModel
House rules description per languages
18 19 20 |
# File 'lib/asdawqw/models/notes.rb', line 18 def house_rules @house_rules end |
#name ⇒ DescriptionTextModel
Property name per languages
30 31 32 |
# File 'lib/asdawqw/models/notes.rb', line 30 def name @name end |
#short_description ⇒ DescriptionTextModel
Short description per languages
26 27 28 |
# File 'lib/asdawqw/models/notes.rb', line 26 def short_description @short_description end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/asdawqw/models/notes.rb', line 56 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. description = DescriptionTextModel.from_hash(hash['description']) if hash['description'] house_rules = DescriptionTextModel.from_hash(hash['houseRules']) if hash['houseRules'] fine_print = DescriptionTextModel.from_hash(hash['finePrint']) if hash['finePrint'] if hash['shortDescription'] short_description = DescriptionTextModel.from_hash(hash['shortDescription']) end name = DescriptionTextModel.from_hash(hash['name']) if hash['name'] # Create object from extracted values. Notes.new(description, house_rules, fine_print, short_description, name) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 41 |
# File 'lib/asdawqw/models/notes.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['description'] = 'description' @_hash['house_rules'] = 'houseRules' @_hash['fine_print'] = 'finePrint' @_hash['short_description'] = 'shortDescription' @_hash['name'] = 'name' @_hash end |