Skip to content

Instantly share code, notes, and snippets.

@krainboltgreene
Created November 10, 2014 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krainboltgreene/4b98ff2100b8ab295fcd to your computer and use it in GitHub Desktop.
Save krainboltgreene/4b98ff2100b8ab295fcd to your computer and use it in GitHub Desktop.
require "webstack/client"
uri = "http://api.endorsemint.com/accounts"
Webstack::Client.new(verb: "GET", uri: uri) do
# Request middleware
request.stack do
Client::Transaction::Middleware.new(self)
end
request.stack do
Client::Account::Middleware.new(self)
end
request.stack do
Serializer::Middleware.new(meta, body, { "application/json" => Oj, "application/xml" => Ox })
end
request.stack do
Authentication::Bearer::Middleware.new(meta, token)
end
# Response middleware
response.stack do
Deserializer::Middleware.new(meta, body, { "application/json" => Oj, "application/xml" => Ox })
end
response.stack do
Client::Transaction::Middleware.new(self)
end
response.stack do
Client::Account::Middleware.new(self)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment