Class: PagseguroCatcher::Checker

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/pagseguro_catcher/checker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, type) ⇒ Checker

Returns a new instance of Checker.



9
10
11
12
# File 'lib/pagseguro_catcher/checker.rb', line 9

def initialize(code, type)
  self.code = code
  self.type = type
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



7
8
9
# File 'lib/pagseguro_catcher/checker.rb', line 7

def code
  @code
end

#responseObject

Returns the value of attribute response.



7
8
9
# File 'lib/pagseguro_catcher/checker.rb', line 7

def response
  @response
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/pagseguro_catcher/checker.rb', line 7

def type
  @type
end

Instance Method Details

#check(force = false) ⇒ Object



14
15
16
17
18
19
20
21
# 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