Sha256: fd5a7a61dbec40ee5492201b93685c9f02a9bae28063027d3bb5efb7f57e1bae
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
unless ENV['CI'] require 'simplecov' SimpleCov.start do add_filter 'spec' end end require 'base64' require 'mtgox' require 'rspec' require 'webmock/rspec' def a_get(path) a_request(:get, 'https://mtgox.com' + path) end def stub_get(path) stub_request(:get, 'https://mtgox.com' + path) end def a_post(path) a_request(:post, 'https://mtgox.com' + path) end def stub_post(path) stub_request(:post, 'https://mtgox.com' + path) end def fixture_path File.expand_path('../fixtures', __FILE__) end def fixture(file) File.new(fixture_path + '/' + file) end module MtGox module Request private def add_nonce(options) options.merge!({nonce: 1321745961249676}) end end end def test_headers(body=test_body) signature = Base64.strict_encode64( OpenSSL::HMAC.digest 'sha512', Base64.decode64(MtGox.secret), body ) {'Rest-Key' => MtGox.key, 'Rest-Sign' => signature} end def test_body(options={}) options.merge!({nonce: 1321745961249676}).collect{|k, v| "#{k}=#{v}"} * '&' end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mtgox-0.8.2 | spec/helper.rb |
mtgox-0.8.1 | spec/helper.rb |