Class: Rocket::Payment::Transfer
- Inherits:
-
Core::Function
- Object
- Core::Function
- Rocket::Payment::Transfer
- Defined in:
- lib/rocket/payment/transfer.rb
Instance Attribute Summary
Attributes inherited from Core::Function
Instance Method Summary collapse
- #check_balance(account = 'default') ⇒ Object
- #check_user(email) ⇒ Object
-
#initialize(token, env = Rocket.environment, debug = false) ⇒ Transfer
constructor
A new instance of Transfer.
- #send_transfer(user, value, currency = 'USD', description = '') ⇒ Object
Methods inherited from Core::Function
Constructor Details
#initialize(token, env = Rocket.environment, debug = false) ⇒ Transfer
Returns a new instance of Transfer.
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# 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 |
Instance Method Details
#check_balance(account = 'default') ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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. unless retorno.success self.status = retorno retorno end |
#check_user(email) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# 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. unless retorno.success self.status = retorno retorno end |
#send_transfer(user, value, currency = 'USD', description = '') ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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. unless retorno.success self.status = retorno retorno end |