Module: Citrix::Training::Helpers::HttpClient
- Included in:
- Namespace::Registrants, Namespace::Trainings
- Defined in:
- lib/citrix/training/helpers/http_client.rb
Instance Method Summary collapse
Instance Method Details
#http_client ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/citrix/training/helpers/http_client.rb', line 13 def http_client @http_client ||= Aitch::Namespace.new.tap do |ns| ns.configure do |config| if $DEBUG require "logger" config.logger = Logger.new($stdout) end config.user_agent = "Citrix::Rubygems/#{Citrix::VERSION}" config.default_headers = { "Authorization" => -> { "OAuth oauth_token=#{credentials.oauth_token}" }, "Accept" => "application/json", "Content-Type" => "application/json" } end end end |
#json_parser ⇒ Object
5 6 7 |
# File 'lib/citrix/training/helpers/http_client.rb', line 5 def json_parser Aitch::ResponseParser::JSONParser.engine end |
#url_for(*args) ⇒ Object
9 10 11 |
# File 'lib/citrix/training/helpers/http_client.rb', line 9 def url_for(*args) File.join(API_ENDPOINT, *args.map(&:to_s)) end |