Class: TestCentricity::Environ

Inherits:
DataObject show all
Defined in:
lib/testcentricity_web/environment.rb

Instance Attribute Summary collapse

Attributes inherited from DataObject

#context, #current, #hash_table

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

current, set_current

Constructor Details

#initialize(data) ⇒ Environ

Returns a new instance of Environ.



36
37
38
39
40
41
42
43
44
# File 'lib/testcentricity_web/environment.rb', line 36

def initialize(data)
  @protocol	= data['PROTOCOL']
  @hostname = data['HOST_NAME']
  @base_url	= data['BASE_URL']
  @user_id	= data['USER_ID']
  @password	= data['PASSWORD']
  @append	  = data['APPEND']
  super
end

Instance Attribute Details

#appendObject (readonly)

Returns the value of attribute append.



34
35
36
# File 'lib/testcentricity_web/environment.rb', line 34

def append
  @append
end

#base_urlObject (readonly)

Returns the value of attribute base_url.



31
32
33
# File 'lib/testcentricity_web/environment.rb', line 31

def base_url
  @base_url
end

#browserObject

Returns the value of attribute browser.



21
22
23
# File 'lib/testcentricity_web/environment.rb', line 21

def browser
  @browser
end

#deviceObject

Returns the value of attribute device.



23
24
25
# File 'lib/testcentricity_web/environment.rb', line 23

def device
  @device
end

#device_typeObject

Returns the value of attribute device_type.



24
25
26
# File 'lib/testcentricity_web/environment.rb', line 24

def device_type
  @device_type
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



30
31
32
# File 'lib/testcentricity_web/environment.rb', line 30

def hostname
  @hostname
end

#osObject

Returns the value of attribute os.



22
23
24
# File 'lib/testcentricity_web/environment.rb', line 22

def os
  @os
end

#passwordObject (readonly)

Returns the value of attribute password.



33
34
35
# File 'lib/testcentricity_web/environment.rb', line 33

def password
  @password
end

#platformObject

Returns the value of attribute platform.



25
26
27
# File 'lib/testcentricity_web/environment.rb', line 25

def platform
  @platform
end

#portal_statusObject

Returns the value of attribute portal_status.



27
28
29
# File 'lib/testcentricity_web/environment.rb', line 27

def portal_status
  @portal_status
end

#protocolObject (readonly)

Returns the value of attribute protocol.



29
30
31
# File 'lib/testcentricity_web/environment.rb', line 29

def protocol
  @protocol
end

#signed_inObject

Returns the value of attribute signed_in.



26
27
28
# File 'lib/testcentricity_web/environment.rb', line 26

def signed_in
  @signed_in
end

#user_idObject (readonly)

Returns the value of attribute user_id.



32
33
34
# File 'lib/testcentricity_web/environment.rb', line 32

def user_id
  @user_id
end

Class Method Details

.browserObject



66
67
68
# File 'lib/testcentricity_web/environment.rb', line 66

def self.browser
  @browser
end

.device_typeObject



90
91
92
# File 'lib/testcentricity_web/environment.rb', line 90

def self.device_type
  @device_type
end

.get_screen_shotsObject



126
127
128
# File 'lib/testcentricity_web/environment.rb', line 126

def self.get_screen_shots
  @screen_shots
end

.is_desktop?Boolean

Returns:

  • (Boolean)


102
103
104
# File 'lib/testcentricity_web/environment.rb', line 102

def self.is_desktop?
  @platform == :desktop
end

.is_device?Boolean

Returns:

  • (Boolean)


82
83
84
# File 'lib/testcentricity_web/environment.rb', line 82

def self.is_device?
  @device
end

.is_mobile?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/testcentricity_web/environment.rb', line 98

def self.is_mobile?
  @platform == :mobile
end

.is_signed_in?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/testcentricity_web/environment.rb', line 110

def self.is_signed_in?
  @signed_in
end

.osObject



74
75
76
# File 'lib/testcentricity_web/environment.rb', line 74

def self.os
  @os
end

.portal_stateObject



118
119
120
# File 'lib/testcentricity_web/environment.rb', line 118

def self.portal_state
  @portal_status
end

.reset_contextsObject



130
131
132
# File 'lib/testcentricity_web/environment.rb', line 130

def self.reset_contexts
  @screen_shots = []
end

.save_screen_shot(screen_shot) ⇒ Object



122
123
124
# File 'lib/testcentricity_web/environment.rb', line 122

def self.save_screen_shot(screen_shot)
  @screen_shots.push(screen_shot)
end

.session_codeObject



46
47
48
49
50
51
52
# File 'lib/testcentricity_web/environment.rb', line 46

def self.session_code
  if @session_code == nil
    characters = ('a'..'z').to_a
    @session_code = (0..12).map{characters.sample}.join
  end
  @session_code
end

.session_idObject



54
55
56
# File 'lib/testcentricity_web/environment.rb', line 54

def self.session_id
  @session_id
end

.session_time_stampObject



58
59
60
# File 'lib/testcentricity_web/environment.rb', line 58

def self.session_time_stamp
  @session_time_stamp
end

.set_browser(browser) ⇒ Object



62
63
64
# File 'lib/testcentricity_web/environment.rb', line 62

def self.set_browser(browser)
  @browser = browser.downcase.to_sym
end

.set_device(device) ⇒ Object



78
79
80
# File 'lib/testcentricity_web/environment.rb', line 78

def self.set_device(device)
  @device = device
end

.set_device_type(type) ⇒ Object



86
87
88
# File 'lib/testcentricity_web/environment.rb', line 86

def self.set_device_type(type)
  @device_type = type.downcase
end

.set_os(os) ⇒ Object



70
71
72
# File 'lib/testcentricity_web/environment.rb', line 70

def self.set_os(os)
  @os = os
end

.set_platform(platform) ⇒ Object



94
95
96
# File 'lib/testcentricity_web/environment.rb', line 94

def self.set_platform(platform)
  @platform = platform
end

.set_portal_state(portal_state) ⇒ Object



114
115
116
# File 'lib/testcentricity_web/environment.rb', line 114

def self.set_portal_state(portal_state)
  @portal_status = portal_state
end

.set_signed_in(signed_in) ⇒ Object



106
107
108
# File 'lib/testcentricity_web/environment.rb', line 106

def self.set_signed_in(signed_in)
  @signed_in = signed_in
end