Class: ShipEngine::Utils::UserAgent
- Inherits:
-
Object
- Object
- ShipEngine::Utils::UserAgent
- Defined in:
- lib/shipengine/utils/user_agent.rb
Overview
Class responsible for managing the user agent.
Instance Attribute Summary collapse
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(version = VERSION, platform = RUBY_PLATFORM) ⇒ UserAgent
constructor
A new instance of UserAgent.
- #to_s ⇒ Object
Constructor Details
#initialize(version = VERSION, platform = RUBY_PLATFORM) ⇒ UserAgent
Returns a new instance of UserAgent.
11 12 13 14 15 16 17 |
# File 'lib/shipengine/utils/user_agent.rb', line 11 def initialize(version = VERSION, platform = RUBY_PLATFORM) raise ::StandardError, 'Cannot get version' unless version raise ::StandardError, 'Cannot get platform' unless platform @version = version @platform = platform end |
Instance Attribute Details
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
9 10 11 |
# File 'lib/shipengine/utils/user_agent.rb', line 9 def platform @platform end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/shipengine/utils/user_agent.rb', line 9 def version @version end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/shipengine/utils/user_agent.rb', line 19 def to_s "shipengine-ruby/#{@version} (#{@platform})" end |