lib/asana/http_client/environment_info.rb in asana-2.0.1 vs lib/asana/http_client/environment_info.rb in asana-2.0.2
- old
+ new
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
require_relative '../version'
require 'openssl'
module Asana
class HttpClient
# Internal: Adds environment information to a Faraday request.
class EnvironmentInfo
# Internal: The default user agent to use in all requests to the API.
- USER_AGENT = "ruby-asana v#{Asana::VERSION}".freeze
+ USER_AGENT = "ruby-asana v#{Asana::VERSION}"
def initialize(user_agent = nil)
@user_agent = user_agent || USER_AGENT
@openssl_version = OpenSSL::OPENSSL_VERSION
@client_version = Asana::VERSION
@@ -17,11 +19,11 @@
# Public: Augments a Faraday connection with information about the
# environment.
def configure(builder)
builder.headers[:user_agent] = @user_agent
- builder.headers[:"X-Asana-Client-Lib"] = header
+ builder.headers[:'X-Asana-Client-Lib'] = header
end
private
def header
@@ -31,23 +33,22 @@
version: @client_version,
openssl_version: @openssl_version }
.map { |k, v| "#{k}=#{v}" }.join('&')
end
- # rubocop:disable Metrics/MethodLength
def os
- if RUBY_PLATFORM =~ /win32/ || RUBY_PLATFORM =~ /mingw/
+ case RUBY_PLATFORM
+ when /win32/, /mingw/
'windows'
- elsif RUBY_PLATFORM =~ /linux/
+ when /linux/
'linux'
- elsif RUBY_PLATFORM =~ /darwin/
+ when /darwin/
'darwin'
- elsif RUBY_PLATFORM =~ /freebsd/
+ when /freebsd/
'freebsd'
else
'unknown'
end
end
- # rubocop:enable Metrics/MethodLength
end
end
end