class ManyWho::MyStruct

Initialized with a JSON hash, each value of the hash is converted into an instance variable. Can also be easily converted into a JSON string

Public Class Methods

new(jsonValue) click to toggle source

Set instance values from the hash

# File lib/manywho-sdk.rb, line 328
def initialize(jsonValue)
    if (jsonValue != nil)
        jsonValue.each do
            |k,v| self.instance_variable_set("@#{k}", v)
        end
    end
end

Public Instance Methods

to_json(options= {}) click to toggle source
# File lib/manywho-sdk.rb, line 319
def to_json(options= {})
    hash = {}
    self.instance_variables.each do |var|
        hash[var[1...var.length]] = self.instance_variable_get var
    end
    return hash.to_json
end