Class: Metromobilite::Model::Pattern

Inherits:
Object
  • Object
show all
Defined in:
lib/metromobilite/model/pattern.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jsonData) ⇒ Pattern

Initializes a new Metromobilite::Pattern object

jsonData_Hash

The JSON data received and parsed as a Hash



11
12
13
14
15
16
17
# File 'lib/metromobilite/model/pattern.rb', line 11

def initialize(jsonData)

@id = jsonData['id']
@desc = jsonData['desc']
@dir = jsonData['dir']
@shortDesc = jsonData['shortDesc']
end

Instance Attribute Details

#descObject (readonly)

Returns the value of attribute desc.



20
21
22
# File 'lib/metromobilite/model/pattern.rb', line 20

def desc
  @desc
end

#dirObject (readonly)

Returns the value of attribute dir.



21
22
23
# File 'lib/metromobilite/model/pattern.rb', line 21

def dir
  @dir
end

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/metromobilite/model/pattern.rb', line 19

def id
  @id
end

#shortDescObject (readonly)

Returns the value of attribute shortDesc.



22
23
24
# File 'lib/metromobilite/model/pattern.rb', line 22

def shortDesc
  @shortDesc
end

Instance Method Details

#to_json(opts = nil) ⇒ Object



24
25
26
27
28
# File 'lib/metromobilite/model/pattern.rb', line 24

def to_json(opts = nil)
    hash = {}
    instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
    hash.to_json
end