Class: PagSeguro::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pagseguro/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/pagseguro/base.rb', line 7

def initialize(api)
  @api = api
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



5
6
7
# File 'lib/pagseguro/base.rb', line 5

def api
  @api
end

Instance Method Details

#builder(&block) ⇒ Object



25
26
27
28
29
# File 'lib/pagseguro/base.rb', line 25

def builder(&block)
  Nokogiri::XML::Builder.new do |xml|
    xml.instance_eval(&block)
  end
end

#parameterize(hash) ⇒ Object



19
20
21
22
23
# File 'lib/pagseguro/base.rb', line 19

def parameterize(hash)
  hash.as_json.deep_transform_keys! do |key|
    key.to_s.camelize(:lower)
  end
end

#parse(hash) ⇒ Object



11
12
13
# File 'lib/pagseguro/base.rb', line 11

def parse(hash)
  Response.new(hash)
end

#parse_body(response) ⇒ Object



15
16
17
# File 'lib/pagseguro/base.rb', line 15

def parse_body(response)
  parse response.body
end