Class: Gonebusy::EntitiesBookingResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/entities_booking_response.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(id = nil, owner_id = nil, time_window = nil, user_message = nil, workflow_state = nil) ⇒ EntitiesBookingResponse

Returns a new instance of EntitiesBookingResponse.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/gonebusy/models/entities_booking_response.rb', line 38

def initialize(id = nil,
               owner_id = nil,
               time_window = nil,
               user_message = nil,
               workflow_state = nil)
  @id = id
  @owner_id = owner_id
  @time_window = time_window
  @user_message = user_message
  @workflow_state = workflow_state
end

Instance Attribute Details

#idInteger

id of Booking

Returns:

  • (Integer)


7
8
9
# File 'lib/gonebusy/models/entities_booking_response.rb', line 7

def id
  @id
end

#owner_idInteger

id of owner of Booking

Returns:

  • (Integer)


11
12
13
# File 'lib/gonebusy/models/entities_booking_response.rb', line 11

def owner_id
  @owner_id
end

#time_windowEntitiesTimeWindowResponse

TimeWindow corresponding to Booking



15
16
17
# File 'lib/gonebusy/models/entities_booking_response.rb', line 15

def time_window
  @time_window
end

#user_messageString

user requesting Booking may include a message

Returns:



19
20
21
# File 'lib/gonebusy/models/entities_booking_response.rb', line 19

def user_message
  @user_message
end

#workflow_stateString

status of Booking

Returns:



23
24
25
# File 'lib/gonebusy/models/entities_booking_response.rb', line 23

def workflow_state
  @workflow_state
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/gonebusy/models/entities_booking_response.rb', line 51

def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash

    id = hash["id"]
    owner_id = hash["owner_id"]
    time_window = EntitiesTimeWindowResponse.from_hash(hash["time_window"]) if hash["time_window"]
    user_message = hash["user_message"]
    workflow_state = hash["workflow_state"]

    # Create object from extracted values

    EntitiesBookingResponse.new(id,
                                owner_id,
                                time_window,
                                user_message,
                                workflow_state)
  end
end

.namesObject

A mapping from model property names to API property names



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gonebusy/models/entities_booking_response.rb', line 26

def self.names
  if @hash.nil?
    @hash = {}
    @hash["id"] = "id"
    @hash["owner_id"] = "owner_id"
    @hash["time_window"] = "time_window"
    @hash["user_message"] = "user_message"
    @hash["workflow_state"] = "workflow_state"
  end
  @hash
end