class Megam::Crm

Public Class Methods

create(o) click to toggle source
# File lib/megam/core/crm.rb, line 66
def self.create(o)
  puts "self.create entry"
  puts o
  acct = from_hash(o)
  acct.create
end
from_hash(o) click to toggle source
# File lib/megam/core/crm.rb, line 53
def self.from_hash(o)
  puts "self from_hash entry"
  acct = self.new()
  acct.from_hash(o)
  acct
end
new() click to toggle source
# File lib/megam/core/crm.rb, line 18
def initialize
  @json = nil      
end

Public Instance Methods

create() click to toggle source

Create the node via the REST API

# File lib/megam/core/crm.rb, line 74
def create
  puts "crm create entry"
  puts to_hash
  megam_rest.post_crm(to_hash)      
end
crm() click to toggle source

used by resque workers and any other background job

# File lib/megam/core/crm.rb, line 23
def crm
  self
end
error?() click to toggle source
# File lib/megam/core/crm.rb, line 40
def error?
  crocked  = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
end
from_hash(o) click to toggle source
# File lib/megam/core/crm.rb, line 60
def from_hash(o)
  puts "from_hash entry"
  @json = o[:json] if o.has_key?(:json)     
  self
end
json(arg=nil) click to toggle source
# File lib/megam/core/crm.rb, line 32
def json(arg=nil)
  if arg != nil
    @json = arg
  else
  @json
  end
end
megam_rest() click to toggle source
# File lib/megam/core/crm.rb, line 27
def megam_rest
  puts "megam_rest entry"     
  Megam::Deccanplato.new
end
to_hash() click to toggle source

Transform the ruby obj -> to a Hash

# File lib/megam/core/crm.rb, line 45
def to_hash
  puts "to_hash entry"
  puts json
  index_hash = Hash.new      
  index_hash[:json] = json      
  index_hash
end
to_s() click to toggle source
# File lib/megam/core/crm.rb, line 80
def to_s
  puts "to_s entry"
  Megam::Stuff.styled_hash(to_hash)
end