Sha256: a659d36732a9ce44e454de160641373298e0790279c3eeb3cde5d1cf0e87026e

Contents?: true

Size: 890 Bytes

Versions: 15

Compression:

Stored size: 890 Bytes

Contents

YGL_API_KEY = YAML.load_file(File.join(File.dirname(__FILE__), '/../you_got_listed_api_key.yml'))["api_key"]

def new_ygl
  YouGotListed::Client.new(YGL_API_KEY)
end

def mock_get(base_uri, method, response_fixture, params = {})
  url = base_uri + method
  unless params.blank?
    stub_http_request(:get, url).with(:query => params).to_return(:body => mocked_response(response_fixture))
  else
    stub_http_request(:get, url).to_return(:body => mocked_response(response_fixture))
  end
end

def mocked_response(response_fixture)
  File.read(File.join(File.dirname(__FILE__), '/../fixtures/responses', "#{response_fixture}"))
end

def httparty_get(base_uri, method, response_fixture, params = {})
  mock_get(base_uri, method, response_fixture, params)
  url = base_uri + method
  VCR.use_cassette(method.gsub('/', '_')) do
    HTTParty.get url, :format => :xml, :query => params
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
you_got_listed-0.5.0 spec/support/webmock_helper.rb
you_got_listed-0.4.0 spec/support/webmock_helper.rb
you_got_listed-0.3.6 spec/support/webmock_helper.rb
you_got_listed-0.3.5 spec/support/webmock_helper.rb
you_got_listed-0.3.4 spec/support/webmock_helper.rb
you_got_listed-0.3.3 spec/support/webmock_helper.rb
you_got_listed-0.3.2 spec/support/webmock_helper.rb
you_got_listed-0.3.1 spec/support/webmock_helper.rb
you_got_listed-0.3.0 spec/support/webmock_helper.rb
you_got_listed-0.2.5 spec/support/webmock_helper.rb
you_got_listed-0.2.4 spec/support/webmock_helper.rb
you_got_listed-0.2.3 spec/support/webmock_helper.rb
you_got_listed-0.2.2 spec/support/webmock_helper.rb
you_got_listed-0.2.1 spec/support/webmock_helper.rb
you_got_listed-0.2.0 spec/support/webmock_helper.rb