Class: Asdawqw::Image

Inherits:
BaseModel show all
Defined in:
lib/asdawqw/models/image.rb

Overview

Image Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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,
               tags = nil,
               url_mbp = nil,
               sort = nil)
  @url = url
  @tags = tags
  @url_mbp = url_mbp
  @sort = sort
end

Instance Attribute Details

#sortInteger (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.

Returns:

  • (Integer)


25
26
27
# File 'lib/asdawqw/models/image.rb', line 25

def sort
  @sort
end

#tagsList of ImageTagsEnum

imagesText of main description. Tags codes are given in Appendix.

Returns:



15
16
17
# File 'lib/asdawqw/models/image.rb', line 15

def tags
  @tags
end

#urlString

URL of the image

Returns:



11
12
13
# File 'lib/asdawqw/models/image.rb', line 11

def url
  @url
end

#url_mbpString

URL of the image on MyBookingPal. This field will be only in response. You can not send this in request.

Returns:



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']
  tags = hash['tags']
  url_mbp = hash['urlMbp']
  sort = hash['sort']

  # Create object from extracted values.
  Image.new(url,
            tags,
            url_mbp,
            sort)
end

.namesObject

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