class Megam::Billingtransactions

Public Class Methods

create(params) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 194
def self.create(params)
    acct = from_hash(params)
    acct.create
end
from_hash(o) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 174
def self.from_hash(o)
    bal = self.new(o)
    bal.from_hash(o)
    bal
end
json_create(o) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 154
def self.json_create(o)
    bal = new({})
    bal.id(o["id"]) if o.has_key?("id")
    bal.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
    bal.gateway(o["gateway"]) if o.has_key?("gateway")
    bal.amountin(o["amountin"]) if o.has_key?("amountin")
    bal.amountout(o["amountout"]) if o.has_key?("amountout")
    bal.fees(o["fees"]) if o.has_key?("fees")
    bal.tranid(o["tranid"]) if o.has_key?("tranid")
    bal.trandate(o["trandate"]) if o.has_key?("trandate")
    bal.currency_type(o["currency_type"]) if o.has_key?("currency_type")
    bal.created_at(o["created_at"]) if o.has_key?("created_at")
    #success or error
    bal.some_msg[:code] = o["code"] if o.has_key?("code")
    bal.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
    bal.some_msg[:msg]= o["msg"] if o.has_key?("msg")
    bal.some_msg[:links] = o["links"] if o.has_key?("links")
    bal
end
list(params) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 203
def self.list(params)
    bill = self.new(params)
    bill.megam_rest.get_billingtransactions
end
new(o) click to toggle source
Calls superclass method Megam::RestAdapter::new
# File lib/megam/core/billingtransactions.rb, line 3
def initialize(o)
    @id = nil
    @accounts_id = nil
    @gateway = nil
    @amountin = nil
    @amountout = nil
    @fees = nil
    @tranid = nil
    @trandate = nil
    @currency_type = nil
    @created_at = nil
    @some_msg = {}
    super(o)
end

Public Instance Methods

accounts_id(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 30
def accounts_id(arg=nil)
    if arg != nil
        @accounts_id= arg
    else
        @accounts_id
    end
end
amountin(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 46
def amountin(arg=nil)
    if arg != nil
        @amountin= arg
    else
        @amountin
    end
end
amountout(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 54
def amountout(arg=nil)
    if arg != nil
        @amountout= arg
    else
        @amountout
    end
end
create() click to toggle source
# File lib/megam/core/billingtransactions.rb, line 199
def create
    megam_rest.post_billedhistories(to_hash)
end
created_at(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 94
def created_at(arg=nil)
    if arg != nil
        @created_at = arg
    else
        @created_at
    end
end
currency_type(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 86
def currency_type(arg=nil)
    if arg != nil
        @currency_type = arg
    else
        @currency_type
    end
end
error?() click to toggle source
# File lib/megam/core/billingtransactions.rb, line 110
def error?
    crocked  = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
end
fees(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 62
def fees(arg=nil)
    if arg != nil
        @fees = arg
    else
        @fees
    end
end
for_json() click to toggle source
# File lib/megam/core/billingtransactions.rb, line 137
def for_json
    result = {
        "id" => id,
        "accounts_id" => accounts_id,
        "gateway" => gateway,
        "amountin" => amountin,
        "amountout" => amountout,
        "fees" => fees,
        "tranid" => tranid,
        "trandate" => trandate,
        "currency_type" => currency_type,
        "created_at" => created_at
    }
    result
end
from_hash(o) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 180
def from_hash(o)
    @id            = o[:id] if o.has_key?(:id)
    @accounts_id   = o[:accounts_id] if o.has_key?(:accounts_id)
    @gateway       = o[:gateway] if o.has_key?(:gateway)
    @amountin      = o[:amountin] if o.has_key?(:amountin)
    @amountout     = o[:amountout] if o.has_key?(:amountout)
    @fees          = o[:fees] if o.has_key?(:fees)
    @tranid        = o[:tranid] if o.has_key?(:tranid)
    @trandate      = o[:trandate] if o.has_key?(:trandate)
    @currency_type = o[:currency_type] if o.has_key?(:currency_type)
    @created_at    = o[:created_at] if o.has_key?(:created_at)
    self
end
gateway(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 38
def gateway(arg=nil)
    if arg != nil
        @gateway= arg
    else
        @gateway
    end
end
id(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 22
def id(arg=nil)
    if arg != nil
        @id = arg
    else
        @id
    end
end
self() click to toggle source
# File lib/megam/core/billingtransactions.rb, line 18
def
    self
end
some_msg(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 102
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/billingtransactions.rb, line 115
def to_hash
    index_hash = Hash.new
    index_hash["json_claz"] = self.class.name
    index_hash["id"] = id
    index_hash["accounts_id"] = accounts_id
    index_hash["gateway"] = gateway
    index_hash["amountin"] = amountin
    index_hash["amountout"] = amountout
    index_hash["fees"] = fees
    index_hash["tranid"] = tranid
    index_hash["trandate"] = trandate
    index_hash["currency_type"] = currency_type
    index_hash["created_at"] = created_at
    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/billingtransactions.rb, line 133
def to_json(*a)
    for_json.to_json(*a)
end
to_s() click to toggle source
# File lib/megam/core/billingtransactions.rb, line 209
def to_s
    Megam::Stuff.styled_hash(to_hash)
end
trandate(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 78
def trandate(arg=nil)
    if arg != nil
        @trandate = arg
    else
        @trandate
    end
end
tranid(arg=nil) click to toggle source
# File lib/megam/core/billingtransactions.rb, line 70
def tranid(arg=nil)
    if arg != nil
        @tranid = arg
    else
        @tranid
    end
end