Class: Seatsio::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/seatsio/domain.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, label, color, accessible = false) ⇒ Category

Returns a new instance of Category.



108
109
110
111
112
113
# File 'lib/seatsio/domain.rb', line 108

def initialize(key, label, color, accessible = false)
  @key = key
  @label = label
  @color = color
  @accessible = accessible
end

Instance Attribute Details

#accessibleObject (readonly)

Returns the value of attribute accessible.



106
107
108
# File 'lib/seatsio/domain.rb', line 106

def accessible
  @accessible
end

#colorObject (readonly)

Returns the value of attribute color.



106
107
108
# File 'lib/seatsio/domain.rb', line 106

def color
  @color
end

#keyObject (readonly)

Returns the value of attribute key.



106
107
108
# File 'lib/seatsio/domain.rb', line 106

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



106
107
108
# File 'lib/seatsio/domain.rb', line 106

def label
  @label
end

Class Method Details

.create_list(list = []) ⇒ Object



121
122
123
124
125
126
127
128
129
# File 'lib/seatsio/domain.rb', line 121

def self.create_list(list = [])
  result = []

  list.each do |item|
    result << Category.from_json(item)
  end

  result
end

.from_json(data) ⇒ Object



115
116
117
118
119
# File 'lib/seatsio/domain.rb', line 115

def self.from_json(data)
  if data
    Category.new(data['key'], data['label'], data['color'], data['accessible'])
  end
end

Instance Method Details

#==(other) ⇒ Object



131
132
133
134
135
136
# File 'lib/seatsio/domain.rb', line 131

def == (other)
  key == other.key &&
    label == other.label &&
    color == other.color &&
    accessible == other.accessible
end