Class: Asdawqw::CheckOut

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

Overview

CheckOut Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(monday = nil, tuesday = nil, wednesday = nil, thursday = nil, friday = nil, saturday = nil, sunday = nil) ⇒ CheckOut

Returns a new instance of CheckOut.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/asdawqw/models/check_out.rb', line 50

def initialize(monday = nil,
               tuesday = nil,
               wednesday = nil,
               thursday = nil,
               friday = nil,
               saturday = nil,
               sunday = nil)
  @monday = monday
  @tuesday = tuesday
  @wednesday = wednesday
  @thursday = thursday
  @friday = friday
  @saturday = saturday
  @sunday = sunday
end

Instance Attribute Details

#fridayBoolean

Determines if check out could be made on friday

Returns:

  • (Boolean)


27
28
29
# File 'lib/asdawqw/models/check_out.rb', line 27

def friday
  @friday
end

#mondayBoolean

Determines if check out could be made on monday

Returns:

  • (Boolean)


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

def monday
  @monday
end

#saturdayBoolean

Determines if check out could be made on saturday

Returns:

  • (Boolean)


31
32
33
# File 'lib/asdawqw/models/check_out.rb', line 31

def saturday
  @saturday
end

#sundayBoolean

Determines if check out could be made on sunday

Returns:

  • (Boolean)


35
36
37
# File 'lib/asdawqw/models/check_out.rb', line 35

def sunday
  @sunday
end

#thursdayBoolean

Determines if check out could be made on thursday

Returns:

  • (Boolean)


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

def thursday
  @thursday
end

#tuesdayBoolean

Determines if check out could be made on tuesday

Returns:

  • (Boolean)


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

def tuesday
  @tuesday
end

#wednesdayBoolean

Determines if check out could be made on wednesday

Returns:

  • (Boolean)


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

def wednesday
  @wednesday
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/asdawqw/models/check_out.rb', line 67

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  monday = hash['monday']
  tuesday = hash['tuesday']
  wednesday = hash['wednesday']
  thursday = hash['thursday']
  friday = hash['friday']
  saturday = hash['saturday']
  sunday = hash['sunday']

  # Create object from extracted values.
  CheckOut.new(monday,
               tuesday,
               wednesday,
               thursday,
               friday,
               saturday,
               sunday)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['monday'] = 'monday'
  @_hash['tuesday'] = 'tuesday'
  @_hash['wednesday'] = 'wednesday'
  @_hash['thursday'] = 'thursday'
  @_hash['friday'] = 'friday'
  @_hash['saturday'] = 'saturday'
  @_hash['sunday'] = 'sunday'
  @_hash
end