Class: Pepipost::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/pepipost/models/attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object



11
12
13
# File 'lib/pepipost/models/attributes.rb', line 11

def method_missing(method_name)
  puts "there's no method called '#{method_name}'"
end

Instance Attribute Details

#nameArray<String>

TODO: Write general description for this method

Returns:

  • (Array<String>)


5
6
7
# File 'lib/pepipost/models/attributes.rb', line 5

def name
  @name
end

#regidArray<String>

TODO: Write general description for this method

Returns:

  • (Array<String>)


9
10
11
# File 'lib/pepipost/models/attributes.rb', line 9

def regid
  @regid
end

Instance Method Details

#key_mapObject

Defines the key map for json serialization



22
23
24
25
26
27
# File 'lib/pepipost/models/attributes.rb', line 22

def key_map
  hash = {}
  hash['NAME'] = name
  hash['REGID'] = regid
  hash
end

#to_jsonObject

Creates JSON of the curent object



16
17
18
19
# File 'lib/pepipost/models/attributes.rb', line 16

def to_json
  hash = key_map
  hash.to_json
end