Module: Affirm::TestingSupport::HttpResponses

Defined in:
lib/affirm/testing_support/http_responses.rb

Instance Method Summary collapse

Instance Method Details

#read_http_fixture(name) ⇒ Object



19
20
21
# File 'lib/affirm/testing_support/http_responses.rb', line 19

def read_http_fixture(name)
  File.read(File.join(File.dirname(__FILE__), "fixtures.http", name))
end

#read_json_fixture(name) ⇒ Object



23
24
25
# File 'lib/affirm/testing_support/http_responses.rb', line 23

def read_json_fixture(name)
  JSON.parse(File.read(File.join(File.dirname(__FILE__), "fixtures.json", name)))
end

#stub_basic_authObject



12
13
14
15
16
17
# File 'lib/affirm/testing_support/http_responses.rb', line 12

def stub_basic_auth
  [
    Affirm.config.public_api_key,
    Affirm.config.private_api_key
  ]
end

#stub_headersObject



4
5
6
7
8
9
10
# File 'lib/affirm/testing_support/http_responses.rb', line 4

def stub_headers
  {
    "Accept" => "application/json",
    "Content-type" => "application/json",
    "User-Agent" => /^Affirm\/#{Affirm::VERSION} Ruby\/#{RUBY_VERSION} OpenSSL\/.*$/
  }
end