mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-06 00:03:36 -04:00
rename Alice=>Faraday in the readme
This commit is contained in:
parent
2db6886d74
commit
4715140d65
22
README.rdoc
22
README.rdoc
@ -6,17 +6,17 @@ This mess is gonna get raw, like sushi. So, haters to the left.
|
||||
|
||||
== Usage
|
||||
|
||||
conn = Alice::Connection.new(:url => 'http://sushi.com') do |builder|
|
||||
builder.use Alice::Request::Yajl # convert body to json with Yajl lib
|
||||
builder.use Alice::Adapter::Logger # log the request somewhere?
|
||||
builder.use Alice::Adapter::Typhoeus # make http request with typhoeus
|
||||
builder.use Alice::Response::Yajl # # parse body with yajl
|
||||
conn = Faraday::Connection.new(:url => 'http://sushi.com') do |builder|
|
||||
builder.use Faraday::Request::Yajl # convert body to json with Yajl lib
|
||||
builder.use Faraday::Adapter::Logger # log the request somewhere?
|
||||
builder.use Faraday::Adapter::Typhoeus # make http request with typhoeus
|
||||
builder.use Faraday::Response::Yajl # # parse body with yajl
|
||||
|
||||
# or use shortcuts
|
||||
builder.request :yajl # Alice::Request::Yajl
|
||||
builder.adapter :logger # Alice::Adapter::Logger
|
||||
builder.adapter :typhoeus # Alice::Adapter::Typhoeus
|
||||
builder.response :yajl # Alice::Response::Yajl
|
||||
builder.request :yajl # Faraday::Request::Yajl
|
||||
builder.adapter :logger # Faraday::Adapter::Logger
|
||||
builder.adapter :typhoeus # Faraday::Adapter::Typhoeus
|
||||
builder.response :yajl # Faraday::Response::Yajl
|
||||
end
|
||||
|
||||
resp1 = conn.get '/nigiri/sake.json'
|
||||
@ -29,13 +29,13 @@ This mess is gonna get raw, like sushi. So, haters to the left.
|
||||
== Testing
|
||||
|
||||
# It's possible to define stubbed request outside a test adapter block.
|
||||
stubs = Alice::Test::Stubs.new do |stub|
|
||||
stubs = Faraday::Test::Stubs.new do |stub|
|
||||
stub.get('/tamago') { [200, 'egg', {} }
|
||||
end
|
||||
|
||||
# You can pass stubbed request to the test adapter or define them in a block
|
||||
# or a combination of the two.
|
||||
test = Alice::Connection.new do |builder|
|
||||
test = Faraday::Connection.new do |builder|
|
||||
builder.adapter :test, stubs do |stub|
|
||||
stub.get('/ebi') {[ 200, 'shrimp', {} ]}
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user