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, current=, set_current

Constructor Details

#initialize(data) ⇒ Environ

Returns a new instance of Environ.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/testcentricity_web/environment.rb', line 56

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']
  @option1	   = data['OPTIONAL_1']
  @option2	   = data['OPTIONAL_2']
  @dns	       = data['DNS']
  @db_username = data['DB_USERNAME']
  @db_password = data['DB_PASSWORD']
  super
end

Instance Attribute Details

#appendObject

Returns the value of attribute append.



49
50
51
# File 'lib/testcentricity_web/environment.rb', line 49

def append
  @append
end

#base_urlObject

Returns the value of attribute base_url.



46
47
48
# File 'lib/testcentricity_web/environment.rb', line 46

def base_url
  @base_url
end

#browserObject

Returns the value of attribute browser.



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

def browser
  @browser
end

#browser_sizeObject

Returns the value of attribute browser_size.



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

def browser_size
  @browser_size
end

#db_passwordObject

Returns the value of attribute db_password.



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

def db_password
  @db_password
end

#db_usernameObject

Returns the value of attribute db_username.



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

def db_username
  @db_username
end

#deviceObject

Returns the value of attribute device.



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

def device
  @device
end

#device_orientationObject

Returns the value of attribute device_orientation.



36
37
38
# File 'lib/testcentricity_web/environment.rb', line 36

def device_orientation
  @device_orientation
end

#device_osObject

Returns the value of attribute device_os.



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

def device_os
  @device_os
end

#device_typeObject

Returns the value of attribute device_type.



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

def device_type
  @device_type
end

#dnsObject

Returns the value of attribute dns.



52
53
54
# File 'lib/testcentricity_web/environment.rb', line 52

def dns
  @dns
end

#external_pageObject

Returns the value of attribute external_page.



42
43
44
# File 'lib/testcentricity_web/environment.rb', line 42

def external_page
  @external_page
end

#hostnameObject

Returns the value of attribute hostname.



45
46
47
# File 'lib/testcentricity_web/environment.rb', line 45

def hostname
  @hostname
end

#option1Object

Returns the value of attribute option1.



50
51
52
# File 'lib/testcentricity_web/environment.rb', line 50

def option1
  @option1
end

#option2Object

Returns the value of attribute option2.



51
52
53
# File 'lib/testcentricity_web/environment.rb', line 51

def option2
  @option2
end

#osObject

Returns the value of attribute os.



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

def os
  @os
end

#passwordObject

Returns the value of attribute password.



48
49
50
# File 'lib/testcentricity_web/environment.rb', line 48

def password
  @password
end

#platformObject

Returns the value of attribute platform.



37
38
39
# File 'lib/testcentricity_web/environment.rb', line 37

def platform
  @platform
end

#portal_contextObject

Returns the value of attribute portal_context.



41
42
43
# File 'lib/testcentricity_web/environment.rb', line 41

def portal_context
  @portal_context
end

#portal_statusObject

Returns the value of attribute portal_status.



40
41
42
# File 'lib/testcentricity_web/environment.rb', line 40

def portal_status
  @portal_status
end

#protocolObject

Returns the value of attribute protocol.



44
45
46
# File 'lib/testcentricity_web/environment.rb', line 44

def protocol
  @protocol
end

#signed_inObject

Returns the value of attribute signed_in.



39
40
41
# File 'lib/testcentricity_web/environment.rb', line 39

def signed_in
  @signed_in
end

#test_environmentObject

Returns the value of attribute test_environment.



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

def test_environment
  @test_environment
end

#user_idObject

Returns the value of attribute user_id.



47
48
49
# File 'lib/testcentricity_web/environment.rb', line 47

def user_id
  @user_id
end

Class Method Details

.browserObject



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

def self.browser
  @browser
end

.browser=(browser) ⇒ Object



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

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

.browser_sizeObject



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

def self.browser_size
  @browser_size
end

.browser_size=(size) ⇒ Object



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

def self.browser_size=(size)
  @browser_size = size
end

.device=(device) ⇒ Object



137
138
139
# File 'lib/testcentricity_web/environment.rb', line 137

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

.device_orientationObject



171
172
173
# File 'lib/testcentricity_web/environment.rb', line 171

def self.device_orientation
  @device_orientation
end

.device_orientation=(orientation) ⇒ Object



167
168
169
# File 'lib/testcentricity_web/environment.rb', line 167

def self.device_orientation=(orientation)
  @device_orientation = orientation.downcase.to_sym
end

.device_osObject



163
164
165
# File 'lib/testcentricity_web/environment.rb', line 163

def self.device_os
  @device_os
end

.device_os=(os) ⇒ Object



159
160
161
# File 'lib/testcentricity_web/environment.rb', line 159

def self.device_os=(os)
  @device_os = os.downcase.to_sym
end

.device_typeObject



155
156
157
# File 'lib/testcentricity_web/environment.rb', line 155

def self.device_type
  @device_type
end

.device_type=(type) ⇒ Object



151
152
153
# File 'lib/testcentricity_web/environment.rb', line 151

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

.external_pageObject



233
234
235
# File 'lib/testcentricity_web/environment.rb', line 233

def self.external_page
  @external_page
end

.get_screen_shotsObject



241
242
243
# File 'lib/testcentricity_web/environment.rb', line 241

def self.get_screen_shots
  @screen_shots
end

.is_desktop?Boolean

Returns:

  • (Boolean)


189
190
191
# File 'lib/testcentricity_web/environment.rb', line 189

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

.is_device?Boolean

Returns:

  • (Boolean)


141
142
143
# File 'lib/testcentricity_web/environment.rb', line 141

def self.is_device?
  @device
end

.is_mobile?Boolean

Returns:

  • (Boolean)


185
186
187
# File 'lib/testcentricity_web/environment.rb', line 185

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

.is_signed_in?Boolean

Returns:

  • (Boolean)


197
198
199
# File 'lib/testcentricity_web/environment.rb', line 197

def self.is_signed_in?
  @signed_in
end

.osObject



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

def self.os
  @os
end

.os=(os) ⇒ Object



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

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

.platform=(platform) ⇒ Object



181
182
183
# File 'lib/testcentricity_web/environment.rb', line 181

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

.portal_contextObject



225
226
227
# File 'lib/testcentricity_web/environment.rb', line 225

def self.portal_context
  @portal_context
end

.portal_context=(portal_context) ⇒ Object



221
222
223
# File 'lib/testcentricity_web/environment.rb', line 221

def self.portal_context=(portal_context)
  @portal_context = portal_context
end

.portal_stateObject



211
212
213
# File 'lib/testcentricity_web/environment.rb', line 211

def self.portal_state
  @portal_status
end

.portal_state=(portal_state) ⇒ Object



207
208
209
# File 'lib/testcentricity_web/environment.rb', line 207

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

.reset_contextsObject



245
246
247
# File 'lib/testcentricity_web/environment.rb', line 245

def self.reset_contexts
  @screen_shots = []
end

.save_screen_shot(screen_shot) ⇒ Object



237
238
239
# File 'lib/testcentricity_web/environment.rb', line 237

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

.session_codeObject



71
72
73
74
75
76
77
# File 'lib/testcentricity_web/environment.rb', line 71

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



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

def self.session_id
  @session_id
end

.session_time_stampObject



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

def self.session_time_stamp
  @session_time_stamp
end

.set_browser(browser) ⇒ Object

Deprecated.

Please use #browser= instead



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

def self.set_browser(browser)
  warn "[DEPRECATION] 'TestCentricity::Environ.set_browser' is deprecated.  Please use 'Environ.browser =' instead."
  @browser = browser.downcase.to_sym
end

.set_device(device) ⇒ Object

Deprecated.

Please use #device= instead



132
133
134
135
# File 'lib/testcentricity_web/environment.rb', line 132

def self.set_device(device)
  warn "[DEPRECATION] 'TestCentricity::Environ.set_device' is deprecated.  Please use 'Environ.device =' instead."
  @device = device
end

.set_device_type(type) ⇒ Object

Deprecated.

Please use #device_type= instead



146
147
148
149
# File 'lib/testcentricity_web/environment.rb', line 146

def self.set_device_type(type)
  warn "[DEPRECATION] 'TestCentricity::Environ.set_device_type' is deprecated.  Please use 'Environ.device_type =' instead."
  @device_type = type.downcase
end

.set_external_page(state) ⇒ Object



229
230
231
# File 'lib/testcentricity_web/environment.rb', line 229

def self.set_external_page(state)
  @external_page = state
end

.set_os(os) ⇒ Object

Deprecated.

Please use #os= instead



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

def self.set_os(os)
  warn "[DEPRECATION] 'TestCentricity::Environ.set_os' is deprecated.  Please use 'Environ.os =' instead."
  @os = os
end

.set_platform(platform) ⇒ Object

Deprecated.

Please use #platform= instead



176
177
178
179
# File 'lib/testcentricity_web/environment.rb', line 176

def self.set_platform(platform)
  warn "[DEPRECATION] 'TestCentricity::Environ.set_platform' is deprecated.  Please use 'Environ.platform =' instead."
  @platform = platform
end

.set_portal_context(portal_context) ⇒ Object

Deprecated.

Please use #portal_context= instead



216
217
218
219
# File 'lib/testcentricity_web/environment.rb', line 216

def self.set_portal_context(portal_context)
  warn "[DEPRECATION] 'TestCentricity::Environ.set_portal_context' is deprecated.  Please use 'Environ.portal_context =' instead."
  @portal_context = portal_context
end

.set_portal_state(portal_state) ⇒ Object

Deprecated.

Please use #portal_state= instead



202
203
204
205
# File 'lib/testcentricity_web/environment.rb', line 202

def self.set_portal_state(portal_state)
  warn "[DEPRECATION] 'TestCentricity::Environ.set_portal_state' is deprecated.  Please use 'Environ.portal_state =' instead."
  @portal_status = portal_state
end

.set_signed_in(signed_in) ⇒ Object



193
194
195
# File 'lib/testcentricity_web/environment.rb', line 193

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

.test_environmentObject



87
88
89
90
91
92
93
# File 'lib/testcentricity_web/environment.rb', line 87

def self.test_environment
  if @test_environment.blank?
    nil
  else
    @test_environment.downcase.to_sym
  end
end