Class: Seatsio::Zone

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) ⇒ Zone

Returns a new instance of Zone.



33
34
35
36
# File 'lib/seatsio/domain.rb', line 33

def initialize(key, label)
  @key = key
  @label = label
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



31
32
33
# File 'lib/seatsio/domain.rb', line 31

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



31
32
33
# File 'lib/seatsio/domain.rb', line 31

def label
  @label
end

Class Method Details

.create_list(list = []) ⇒ Object



49
50
51
52
53
54
55
56
57
# File 'lib/seatsio/domain.rb', line 49

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

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

  result
end

.from_json(data) ⇒ Object



38
39
40
41
42
# File 'lib/seatsio/domain.rb', line 38

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

Instance Method Details

#==(other) ⇒ Object



44
45
46
47
# File 'lib/seatsio/domain.rb', line 44

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