Skip to content
This repository was archived by the owner on Aug 3, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/zaif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@

module Zaif
class API
DEFAULT_OPEN_TIMEOUT = 5
DEFAULT_READ_TIMEOUT = 15

def initialize(opt = {})
@cool_down = opt[:cool_down] || true
@cool_down_time = opt[:cool_down_time] || 2
@cert_path = opt[:cert_path] || nil
@api_key = opt[:api_key] || nil
@api_secret = opt[:api_secret] || nil
@open_timeout = opt[:open_timeout] || DEFAULT_OPEN_TIMEOUT
@read_timeout = opt[:read_timeout] || DEFAULT_READ_TIMEOUT
@zaif_public_url = "https://api.zaif.jp/api/1/"
@zaif_trade_url = "https://api.zaif.jp/tapi"
end
Expand Down Expand Up @@ -157,8 +162,8 @@ def get_ssl(address)
begin
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
https.open_timeout = 5
https.read_timeout = 15
https.open_timeout = @open_timeout
https.read_timeout = @read_timeout
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.verify_depth = 5

Expand Down Expand Up @@ -195,8 +200,8 @@ def post_ssl(address, method, data)

https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
https.open_timeout = 5
https.read_timeout = 15
https.open_timeout = @open_timeout
https.read_timeout = @read_timeout
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.verify_depth = 5

Expand Down