class Megam::Error
Public Class Methods
from_hash(o)
click to toggle source
# File lib/megam/core/error.rb, line 50 def self.from_hash(o) acct = self.new() acct.from_hash(o) acct end
json_create(o)
click to toggle source
Create a Megam::Account
from JSON (used by the backgroud job workers)
# File lib/megam/core/error.rb, line 41 def self.json_create(o) acct = new acct.some_msg[:code] = o["code"] if o.has_key?("code") acct.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type") acct.some_msg[:msg]= o["msg"] if o.has_key?("msg") acct.some_msg[:links] = o["links"] if o.has_key?("links") acct end
new()
click to toggle source
# File lib/megam/core/error.rb, line 4 def initialize @some_msg = {} end
Public Instance Methods
error?()
click to toggle source
# File lib/megam/core/error.rb, line 17 def error? crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error") end
for_json()
click to toggle source
# File lib/megam/core/error.rb, line 35 def for_json result = { } result end
from_hash(o)
click to toggle source
# File lib/megam/core/error.rb, line 56 def from_hash(o) @some_msg[:code] = o["code"] if o.has_key?("code") @some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type") @some_msg[:msg]= o["msg"] if o.has_key?("msg") @some_msg[:links] = o["links"] if o.has_key?("links") self end
some_msg(arg=nil)
click to toggle source
# File lib/megam/core/error.rb, line 9 def some_msg(arg=nil) if arg != nil @some_msg = arg else @some_msg end end
to_hash()
click to toggle source
Transform the ruby obj -> to a Hash
# File lib/megam/core/error.rb, line 22 def to_hash index_hash = Hash.new index_hash["json_claz"] = self.class.name index_hash["some_msg"] = some_msg index_hash end
to_json(*a)
click to toggle source
Serialize this object as a hash: called from JsonCompat. Verify if this called from JsonCompat during testing.
# File lib/megam/core/error.rb, line 31 def to_json(*a) for_json.to_json(*a) end
to_s()
click to toggle source
# File lib/megam/core/error.rb, line 65 def to_s Megam::Stuff.styled_hash(to_hash) #"---> Megam::Account:[error=#{error?}]\n"+ end