class Asana::HttpClient::EnvironmentInfo
Internal: Adds environment information to a Faraday request.
Constants
- USER_AGENT
Internal: The default user agent to use in all requests to the API.
Public Class Methods
new(user_agent = nil)
click to toggle source
# File lib/asana/http_client/environment_info.rb, line 11 def initialize(user_agent = nil) @user_agent = user_agent || USER_AGENT @openssl_version = OpenSSL::OPENSSL_VERSION @client_version = Asana::VERSION @os = os end
Public Instance Methods
configure(builder)
click to toggle source
Public: Augments a Faraday connection with information about the environment.
# File lib/asana/http_client/environment_info.rb, line 20 def configure(builder) builder.headers[:user_agent] = @user_agent builder.headers[:"X-Asana-Client-Lib"] = header end
Private Instance Methods
header()
click to toggle source
# File lib/asana/http_client/environment_info.rb, line 27 def header { os: @os, language: 'ruby', language_version: RUBY_VERSION, version: @client_version, openssl_version: @openssl_version } .map { |k, v| "#{k}=#{v}" }.join('&') end
os()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/asana/http_client/environment_info.rb, line 37 def os if RUBY_PLATFORM =~ /win32/ || RUBY_PLATFORM =~ /mingw/ 'windows' elsif RUBY_PLATFORM =~ /linux/ 'linux' elsif RUBY_PLATFORM =~ /darwin/ 'darwin' elsif RUBY_PLATFORM =~ /freebsd/ 'freebsd' else 'unknown' end end