Class: Asdawqw::PushNotificationLinksModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/asdawqw/models/push_notification_links_model.rb

Overview

Model for push notification links

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(book_link = nil, cancel_link = nil, async_push = nil, request_to_book = nil) ⇒ PushNotificationLinksModel

Returns a new instance of PushNotificationLinksModel.



35
36
37
38
39
40
41
42
43
# File 'lib/asdawqw/models/push_notification_links_model.rb', line 35

def initialize(book_link = nil,
               cancel_link = nil,
               async_push = nil,
               request_to_book = nil)
  @book_link = book_link
  @cancel_link = cancel_link
  @async_push = async_push
  @request_to_book = request_to_book
end

Instance Attribute Details

#async_pushString

Link for push data for async messages

Returns:



19
20
21
# File 'lib/asdawqw/models/push_notification_links_model.rb', line 19

def async_push
  @async_push
end

Link for getting notifications about new reservations

Returns:



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

def book_link
  @book_link
end

Link for getting notification about cancel reservation

Returns:



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

def cancel_link
  @cancel_link
end

#request_to_bookString

Link for request to book for AirBnb

Returns:



23
24
25
# File 'lib/asdawqw/models/push_notification_links_model.rb', line 23

def request_to_book
  @request_to_book
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/asdawqw/models/push_notification_links_model.rb', line 46

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  book_link = hash['bookLink']
  cancel_link = hash['cancelLink']
  async_push = hash['asyncPush']
  request_to_book = hash['requestToBook']

  # Create object from extracted values.
  PushNotificationLinksModel.new(book_link,
                                 cancel_link,
                                 async_push,
                                 request_to_book)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
33
# File 'lib/asdawqw/models/push_notification_links_model.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['book_link'] = 'bookLink'
  @_hash['cancel_link'] = 'cancelLink'
  @_hash['async_push'] = 'asyncPush'
  @_hash['request_to_book'] = 'requestToBook'
  @_hash
end