Sha256: d2f5703cb2dd6e161da0b04ceae3e63a11ae58dc2a8b9b5154a90602c5837ca8

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

module FinTS
  class HTTPSConnection
    def initialize(url)
      @url = url
    end

    def send_msg(msg)
      message_string = msg.to_s.encode('iso-8859-1')
      FinTS::Client.logger.debug("<< #{message_string}")
      data = Base64.encode64(message_string)
      response = HTTParty.post(@url, body: data, headers: {'Content-Type' => 'text/plain', })
      if response.code < 200 || response.code > 299
        raise ConnectionError, "Bad status code #{response.code}"
      end
      res = Base64.decode64(response.body).force_encoding('iso-8859-1').encode('utf-8')
      FinTS::Client.logger.debug(">> #{res}")
      res
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_fints-0.0.3 lib/fints/https_connection.rb
ruby_fints-0.0.2 lib/fints/https_connection.rb