Class: Asdawqw::Image
- Defined in:
- lib/asdawqw/models/image.rb
Overview
Image Model.
Instance Attribute Summary collapse
-
#sort ⇒ Integer
readonly
Sort of the image.
-
#tags ⇒ List of ImageTagsEnum
imagesText of main description.
-
#url ⇒ String
URL of the image.
-
#url_mbp ⇒ String
URL of the image on MyBookingPal.
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(url = nil, tags = nil, url_mbp = nil, sort = nil) ⇒ Image
constructor
A new instance of Image.
Methods inherited from BaseModel
Constructor Details
#initialize(url = nil, tags = nil, url_mbp = nil, sort = nil) ⇒ Image
Returns a new instance of Image.
37 38 39 40 41 42 43 44 45 |
# File 'lib/asdawqw/models/image.rb', line 37 def initialize(url = nil, = nil, url_mbp = nil, sort = nil) @url = url @tags = @url_mbp = url_mbp @sort = sort end |
Instance Attribute Details
#sort ⇒ Integer (readonly)
Sort of the image. Image with the lowest sort number will be set as main. This field will be only in response. You can not send this in request.
25 26 27 |
# File 'lib/asdawqw/models/image.rb', line 25 def sort @sort end |
#tags ⇒ List of ImageTagsEnum
imagesText of main description. Tags codes are given in Appendix.
15 16 17 |
# File 'lib/asdawqw/models/image.rb', line 15 def @tags end |
#url ⇒ String
URL of the image
11 12 13 |
# File 'lib/asdawqw/models/image.rb', line 11 def url @url end |
#url_mbp ⇒ String
URL of the image on MyBookingPal. This field will be only in response. You can not send this in request.
20 21 22 |
# File 'lib/asdawqw/models/image.rb', line 20 def url_mbp @url_mbp end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/asdawqw/models/image.rb', line 48 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. url = hash['url'] = hash['tags'] url_mbp = hash['urlMbp'] sort = hash['sort'] # Create object from extracted values. Image.new(url, , url_mbp, sort) end |
.names ⇒ Object
A mapping from model property names to API property names.
28 29 30 31 32 33 34 35 |
# File 'lib/asdawqw/models/image.rb', line 28 def self.names @_hash = {} if @_hash.nil? @_hash['url'] = 'url' @_hash['tags'] = 'tags' @_hash['url_mbp'] = 'urlMbp' @_hash['sort'] = 'sort' @_hash end |