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



21
22
23
# File 'lib/affirm/testing_support/http_responses.rb', line 21

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

#read_json_fixture(name) ⇒ Object



25
26
27
# File 'lib/affirm/testing_support/http_responses.rb', line 25

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

#stub_basic_authObject



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

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

#stub_headersObject



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

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