Sha256: 0f10e3fe9cba2ca89e03411aca05b9dc62faad08b3288cf6f4a75ca2c59c2629

Contents?: true

Size: 719 Bytes

Versions: 7

Compression:

Stored size: 719 Bytes

Contents

require 'httparty'

module PagSeguro
  class Request
    include HTTParty
    debug_output $stderr

    base_uri "https://ws.pagseguro.uol.com.br/v2/"

    def get(path)
      options = { query: {
          email: PagSeguro.email,
          token: PagSeguro.token
        }
      }
      self.class.get(path, options)
    end

    def post(path, params = {})
      options = add_credencials(params)

      response = self.class.post(path, options)
      response.parsed_response
    end

    private
    def add_credencials(params)
      options = { body:
        {
          email: PagSeguro.email,
          token: PagSeguro.token
        }
      }
      options[:body].merge!(params)
      options
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pagseguro-transparente-0.1.1 lib/pagseguro/request.rb
pagseguro-transparente-0.1.0 lib/pagseguro/request.rb
pagseguro-transparente-0.0.9 lib/pagseguro/request.rb
pagseguro-transparente-0.0.8 lib/pagseguro/request.rb
pagseguro-transparente-0.0.7 lib/pagseguro/request.rb
pagseguro-transparente-0.0.6 lib/pagseguro/request.rb
pagseguro-transparente-0.0.5 lib/pagseguro/request.rb