class Rocket::Payment::Transfer
Attributes
status[RW]
Public Class Methods
new(token, env = Rocket.environment, debug = false)
click to toggle source
Calls superclass method
Rocket::Core::Function::new
# File lib/rocket/payment/transfer.rb, line 4 def initialize(token, env = Rocket.environment, debug = false) super(debug) raise RocketException.new "Please Provide a Valid Token" if token.blank? self.token = token case env.to_sym when :production then self.prepare_sdk_checkout when :sandbox then self.prepare_sdk_sandbox_checkout else self.prepare_sdk_development_checkout end end
Public Instance Methods
check_balance(account = 'default')
click to toggle source
# File lib/rocket/payment/transfer.rb, line 32 def check_balance(account = 'default') self.method_send = "checkout/user/check-balance/token/#{self.token}" self.data_send = self.make_json(:account => account) self.curl_send retorno = self.json_array(self.return_data) raise RocketException.new retorno.message unless retorno.success self.status = retorno retorno end
check_user(email)
click to toggle source
# File lib/rocket/payment/transfer.rb, line 18 def check_user(email) self.method_send = "checkout/user/check/token/#{self.token}" self.data_send = self.make_json(:emailUser => email) self.curl_send retorno = self.json_array(self.return_data) raise RocketException.new retorno.message unless retorno.success self.status = retorno retorno end
send_transfer(user, value, currency = 'USD', description = '')
click to toggle source
# File lib/rocket/payment/transfer.rb, line 46 def send_transfer(user, value, currency = 'USD', description = '') self.send_method = "checkout/user/send-transfer/token/#{self.token}" self.data_send = self.make_json( :userTo => user, :value => value, :description => description, :currency => currency ) self.curl_send retorno = self.json_array(self.return_data) raise RocketException.new retorno.message unless retorno.success self.status = retorno retorno end