Class: Applitools::AppEnvironment

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/core/app_environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AppEnvironment

Returns a new instance of AppEnvironment.



7
8
9
10
11
12
13
# File 'lib/applitools/core/app_environment.rb', line 7

def initialize(options = {})
  self.os = options[:os]
  self.hosting_app = options[:hosting_app]
  self.display_size = options[:display_size]
  self.inferred_environment = options[:inferred]
  self.device_info = options[:device_info]
end

Instance Attribute Details

#device_infoObject

Returns the value of attribute device_info.



5
6
7
# File 'lib/applitools/core/app_environment.rb', line 5

def device_info
  @device_info
end

#display_sizeObject

Returns the value of attribute display_size.



5
6
7
# File 'lib/applitools/core/app_environment.rb', line 5

def display_size
  @display_size
end

#hosting_appObject

Returns the value of attribute hosting_app.



5
6
7
# File 'lib/applitools/core/app_environment.rb', line 5

def hosting_app
  @hosting_app
end

#inferred_environmentObject

Returns the value of attribute inferred_environment.



5
6
7
# File 'lib/applitools/core/app_environment.rb', line 5

def inferred_environment
  @inferred_environment
end

#osObject

Returns the value of attribute os.



5
6
7
# File 'lib/applitools/core/app_environment.rb', line 5

def os
  @os
end

Instance Method Details

#json_dataObject



15
16
17
18
19
20
21
22
23
# File 'lib/applitools/core/app_environment.rb', line 15

def json_data
  {
      'os' => os,
      'hostingApp' => hosting_app,
      'displaySize' => display_size && display_size.to_hash,
      'inferred' => inferred_environment,
      'deviceInfo' => device_info.nil? || device_info.empty? ? 'Desktop' : device_info
  }
end

#to_hashObject



25
26
27
# File 'lib/applitools/core/app_environment.rb', line 25

def to_hash
  json_data
end

#to_sObject



29
30
31
32
33
34
35
# File 'lib/applitools/core/app_environment.rb', line 29

def to_s
  result = ''
  to_hash.each_pair do |k, v|
    result << "#{k}: #{v}; "
  end
  result
end