class PagseguroCatcher::Checker

Attributes

code[RW]
response[RW]
type[RW]

Public Class Methods

new(code, type) click to toggle source
# File lib/pagseguro_catcher/checker.rb, line 9
def initialize(code, type)
  self.code = code
  self.type = type
end

Public Instance Methods

check(force=false) click to toggle source
# File lib/pagseguro_catcher/checker.rb, line 14
def check(force=false)
  self.response = HTTParty.get(url).body if force
  self.response ||= HTTParty.get(url).body
  
  if self.response
    PagseguroCatcher::Transaction::Base.new(self.response)
  end
end

Private Instance Methods

url() click to toggle source
# File lib/pagseguro_catcher/checker.rb, line 24
def url
  "#{PagseguroCatcher.url}/#{self.code}?email=#{PagseguroCatcher.email}&token=#{PagseguroCatcher.token}"
end