Class: Easy311::Service

Inherits:
Object
  • Object
show all
Includes:
ActiveAttr::Model
Defined in:
lib/easy311/service.rb

Instance Method Summary collapse

Instance Method Details

#attrs=(values) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/easy311/service.rb', line 22

def attrs=(values)
  if values.is_a?(Array)
    super Hash[values.map { |value| [value.code, value] }]
  elsif values.is_a?(Hash)
    super values
  else
    raise TypeError
  end
end

#ordered_attrsObject



32
33
34
# File 'lib/easy311/service.rb', line 32

def ordered_attrs
  Hash[attrs.sort_by { |k, v| v.code }]
end

#service_code=(value) ⇒ Object



18
19
20
# File 'lib/easy311/service.rb', line 18

def service_code=(value)
  self.code = value
end

#service_name=(value) ⇒ Object



14
15
16
# File 'lib/easy311/service.rb', line 14

def service_name=(value)
  self.name = value
end

#to_paramObject



36
37
38
# File 'lib/easy311/service.rb', line 36

def to_param
  code
end