Sha256: fa8a64be824d64de8fcea043c00c80f36a27865211c814c16922dd9b13722f47
Contents?: true
Size: 1.87 KB
Versions: 9
Compression:
Stored size: 1.87 KB
Contents
module Rents # Transaction Obj, but can Abstract nested objs like Costumer class Transaction < Rents::Connection attr_accessor :resp attr_accessor :status # can be API Status: self.status = Rents::Status.new OR/AND Transaction Status attr_accessor :sold_items # Constructor def initialize(params = {}) super # super init call # Base redirect_link if test_env is set (so the redirect is just appended) self.redirect_link = "#{self.end_point_versioned}/transactions" if params[:test_env] end # Return it RID easily def rid self.resp[:rid] end # GET /api/transactions/:rid by it attr def verify auth_hash = {} auth_hash[:auth] = self.request_params[:auth] if self.rid.nil? then return {error:'RID not received'} else self.path = "transactions/#{self.rid}/#{auth_hash.it_keys_to_get_param}" end return self.get_json_request end # POST /api/transactions/page return operator page URL, like the Cielo Page def charge_page full_resp=false custom_http_params # SetUp redirect dynamic if is test self.request_params[:transaction][:redirect_link] = "#{self.redirect_link}/test" if self.request_params[:transaction][:test_env] # dynamic path (it is written when a specific method use it) self.path = "transactions/page" # using json_request because need only the answer (do not use something like it HTTP Code) self.resp = self.post_json_request unless full_resp self.resp = self.post_request if full_resp return self.resp end # TODO create charge works like a buy_store =begin # POST /api/transactions def charge_store self.path = "transactions" self.status = self.post_request end =end # ================ STATICs ================ # GET /api/transactions/:rid by the rid passed def self.find rid end end end
Version data entries
9 entries across 9 versions & 1 rubygems