Class: Gonebusy::EntitiesTimeWindowResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gonebusy/models/entities_time_window_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(date_recurs_by = nil, days = nil, end_date = nil, end_time = nil, frequency = nil, id = nil, negation = nil, occurrence = nil, recurs_by = nil, start_date = nil, start_time = nil, total_minutes = nil) ⇒ EntitiesTimeWindowResponse

Returns a new instance of EntitiesTimeWindowResponse.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 74

def initialize(date_recurs_by = nil,
               days = nil,
               end_date = nil,
               end_time = nil,
               frequency = nil,
               id = nil,
               negation = nil,
               occurrence = nil,
               recurs_by = nil,
               start_date = nil,
               start_time = nil,
               total_minutes = nil)
  @date_recurs_by = date_recurs_by
  @days = days
  @end_date = end_date
  @end_time = end_time
  @frequency = frequency
  @id = id
  @negation = negation
  @occurrence = occurrence
  @recurs_by = recurs_by
  @start_date = start_date
  @start_time = start_time
  @total_minutes = total_minutes
end

Instance Attribute Details

#date_recurs_byString

date_recurs_by

Returns:



8
9
10
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 8

def date_recurs_by
  @date_recurs_by
end

#daysList of String

array of days of week TimeWindow falls on

Returns:



12
13
14
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 12

def days
  @days
end

#end_dateDateTime

end date

Returns:

  • (DateTime)


16
17
18
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 16

def end_date
  @end_date
end

#end_timeString

end time

Returns:



20
21
22
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 20

def end_time
  @end_time
end

#frequencyString

frequency

Returns:



24
25
26
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 24

def frequency
  @frequency
end

#idInteger

id of TimeWindow

Returns:

  • (Integer)


28
29
30
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 28

def id
  @id
end

#negationBoolean

true is available, false is unavailable

Returns:

  • (Boolean)


32
33
34
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 32

def negation
  @negation
end

#occurrenceString

occurrence

Returns:



36
37
38
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 36

def occurrence
  @occurrence
end

#recurs_byString

recurs by

Returns:



40
41
42
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 40

def recurs_by
  @recurs_by
end

#start_dateDateTime

start date

Returns:

  • (DateTime)


44
45
46
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 44

def start_date
  @start_date
end

#start_timeString

start time

Returns:



48
49
50
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 48

def start_time
  @start_time
end

#total_minutesInteger

total minutes spanned

Returns:

  • (Integer)


52
53
54
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 52

def total_minutes
  @total_minutes
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 101

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

    date_recurs_by = hash["date_recurs_by"]
    days = hash["days"]
    end_date = DateTime.iso8601(hash["end_date"]) if hash["end_date"]
    end_time = hash["end_time"]
    frequency = hash["frequency"]
    id = hash["id"]
    negation = hash["negation"]
    occurrence = hash["occurrence"]
    recurs_by = hash["recurs_by"]
    start_date = DateTime.iso8601(hash["start_date"]) if hash["start_date"]
    start_time = hash["start_time"]
    total_minutes = hash["total_minutes"]

    # Create object from extracted values

    EntitiesTimeWindowResponse.new(date_recurs_by,
                                   days,
                                   end_date,
                                   end_time,
                                   frequency,
                                   id,
                                   negation,
                                   occurrence,
                                   recurs_by,
                                   start_date,
                                   start_time,
                                   total_minutes)
  end
end

.namesObject

A mapping from model property names to API property names



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/gonebusy/models/entities_time_window_response.rb', line 55

def self.names
  if @hash.nil?
    @hash = {}
    @hash["date_recurs_by"] = "date_recurs_by"
    @hash["days"] = "days"
    @hash["end_date"] = "end_date"
    @hash["end_time"] = "end_time"
    @hash["frequency"] = "frequency"
    @hash["id"] = "id"
    @hash["negation"] = "negation"
    @hash["occurrence"] = "occurrence"
    @hash["recurs_by"] = "recurs_by"
    @hash["start_date"] = "start_date"
    @hash["start_time"] = "start_time"
    @hash["total_minutes"] = "total_minutes"
  end
  @hash
end