Class: DeepL::AppInfo
- Inherits:
-
Struct
- Object
- Struct
- DeepL::AppInfo
- Defined in:
- lib/deepl/app_info.rb
Overview
Identifies your application in the User-Agent header as <app_name>/<app_version>.
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#app_version ⇒ Object
Returns the value of attribute app_version.
Class Method Summary collapse
-
.from(value) ⇒ Object
Accepts an AppInfo or a hash with
:app_nameand:app_version.
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name
9 10 11 |
# File 'lib/deepl/app_info.rb', line 9 def app_name @app_name end |
#app_version ⇒ Object
Returns the value of attribute app_version
9 10 11 |
# File 'lib/deepl/app_info.rb', line 9 def app_version @app_version end |
Class Method Details
.from(value) ⇒ Object
Accepts an AppInfo or a hash with :app_name and :app_version.
11 12 13 14 15 16 17 |
# File 'lib/deepl/app_info.rb', line 11 def self.from(value) return nil if value.nil? return value if value.is_a?(AppInfo) new(app_name: value[:app_name] || value['app_name'], app_version: value[:app_version] || value['app_version']) end |