Class: DeepL::AppInfo

Inherits:
Struct
  • Object
show all
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

Class Method Summary collapse

Instance Attribute Details

#app_name ⇒ Object

Returns the value of attribute app_name

Returns:

  • (Object) —

    the current value of 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

Returns:

  • (Object) —

    the current value of 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