Sha256: d5ec897561c4abdc2fbb128c2b184c95e30cfba4f0ebe72d731a04654186a8d3

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 Bytes

Contents

module MyMoip
  class TransparentRequest < Request

    HTTP_METHOD   = :post
    PATH          = "/ws/alpha/EnviarInstrucao/Unica"
    REQUIRES_AUTH = true

    def api_call(data, opts = {})
      params = {
        body:          data.to_xml,
        http_method:   HTTP_METHOD,
        requires_auth: REQUIRES_AUTH,
        path:          PATH
      }

      super(params, opts)
    end

    def success?
      @response["EnviarInstrucaoUnicaResponse"]["Resposta"]["Status"] == "Sucesso"
    rescue NoMethodError
      false
    end

    def token
      @response["EnviarInstrucaoUnicaResponse"]["Resposta"]["Token"]
    rescue NoMethodError
    end

    def id
      @response["EnviarInstrucaoUnicaResponse"]["Resposta"]["ID"]
    rescue NoMethodError
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
edools_mymoip-0.8.1 lib/mymoip/requests/transparent_request.rb
mymoip-0.10.0 lib/mymoip/requests/transparent_request.rb
mymoip-0.9.0 lib/mymoip/requests/transparent_request.rb
mymoip-0.8.0 lib/mymoip/requests/transparent_request.rb
mymoip-0.7.0 lib/mymoip/requests/transparent_request.rb