Sha256: 58085c2a15629acfa0c611af8ee2e5b1b39493206a02174e23f99e11be6d6c20
Contents?: true
Size: 784 Bytes
Versions: 3
Compression:
Stored size: 784 Bytes
Contents
# frozen_string_literal: true require 'net/http' module SevenBankFxRate SOURCE_URL = 'https://www.sevenbank.co.jp/t/html/file/CurrentFXList.xml' # Sends http request to fetch the latest exchange rate data class Agent # Fetches the latest data as Net::HTTPResponse object # @return the body of Net::HTTPResponse # # @raise errors if response code is not '200', or any network failure def self.response puts "Sending http request to: #{SOURCE_URL}" if $DEBUG response = Net::HTTP.get_response URI.parse(SOURCE_URL) unless response.code == '200' puts response.body if $DEBUG raise StandardError, "Unexpected response from fetching latest data: #{response.code}" end response.body end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
seven_bank_fx_rate-1.1.1 | lib/seven_bank_fx_rate/agent.rb |
seven_bank_fx_rate-1.1.0 | lib/seven_bank_fx_rate/agent.rb |
seven_bank_fx_rate-1.0.0 | lib/seven_bank_fx_rate/agent.rb |