Module: Userbin::Request

Defined in:
lib/userbin/request.rb

Defined Under Namespace

Modules: Middleware

Class Method Summary collapse

Class Method Details

.client_user_agentObject


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/userbin/request.rb', line 4

def self.client_user_agent
  @uname ||= get_uname
  lang_version = "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})"

  {
    :bindings_version => Userbin::VERSION,
    :lang => 'ruby',
    :lang_version => lang_version,
    :platform => RUBY_PLATFORM,
    :publisher => 'userbin',
    :uname => @uname
  }
end

.get_unameObject


18
19
20
21
22
# File 'lib/userbin/request.rb', line 18

def self.get_uname
  `uname -a 2>/dev/null`.strip if RUBY_PLATFORM =~ /linux|darwin/i
rescue Errno::ENOMEM # couldn't create subprocess
  "uname lookup failed"
end