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.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/testcentricity_web/environment.rb', line 50

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.



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

def append
  @append
end

#base_urlObject

Returns the value of attribute base_url.



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

def base_url
  @base_url
end

#browserObject

Returns the value of attribute browser.



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

def browser
  @browser
end

#db_passwordObject

Returns the value of attribute db_password.



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

def db_password
  @db_password
end

#db_usernameObject

Returns the value of attribute db_username.



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

def db_username
  @db_username
end

#deviceObject

Returns the value of attribute device.



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

def device
  @device
end

#device_typeObject

Returns the value of attribute device_type.



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

def device_type
  @device_type
end

#dnsObject

Returns the value of attribute dns.



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

def dns
  @dns
end

#external_pageObject

Returns the value of attribute external_page.



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

def external_page
  @external_page
end

#hostnameObject

Returns the value of attribute hostname.



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

def hostname
  @hostname
end

#option1Object

Returns the value of attribute option1.



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

def option1
  @option1
end

#option2Object

Returns the value of attribute option2.



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

def option2
  @option2
end

#osObject

Returns the value of attribute os.



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

def os
  @os
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#platformObject

Returns the value of attribute platform.



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

def platform
  @platform
end

#portal_statusObject

Returns the value of attribute portal_status.



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

def portal_status
  @portal_status
end

#protocolObject

Returns the value of attribute protocol.



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

def protocol
  @protocol
end

#signed_inObject

Returns the value of attribute signed_in.



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

def signed_in
  @signed_in
end

#user_idObject

Returns the value of attribute user_id.



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

def user_id
  @user_id
end

Class Method Details

.browserObject



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

def self.browser
  @browser
end

.device_typeObject



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

def self.device_type
  @device_type
end

.external_pageObject



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

def self.external_page
  @external_page
end

.get_screen_shotsObject



153
154
155
# File 'lib/testcentricity_web/environment.rb', line 153

def self.get_screen_shots
  @screen_shots
end

.is_desktop?Boolean

Returns:

  • (Boolean)


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

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

.is_device?Boolean

Returns:

  • (Boolean)


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

def self.is_device?
  @device
end

.is_mobile?Boolean

Returns:

  • (Boolean)


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

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

.is_signed_in?Boolean

Returns:

  • (Boolean)


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

def self.is_signed_in?
  @signed_in
end

.osObject



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

def self.os
  @os
end

.portal_stateObject



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

def self.portal_state
  @portal_status
end

.reset_contextsObject



157
158
159
# File 'lib/testcentricity_web/environment.rb', line 157

def self.reset_contexts
  @screen_shots = []
end

.save_screen_shot(screen_shot) ⇒ Object



149
150
151
# File 'lib/testcentricity_web/environment.rb', line 149

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

.session_codeObject



65
66
67
68
69
70
71
# File 'lib/testcentricity_web/environment.rb', line 65

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



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

def self.session_id
  @session_id
end

.session_time_stampObject



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

def self.session_time_stamp
  @session_time_stamp
end

.set_browser(browser) ⇒ Object



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

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

.set_device(device) ⇒ Object



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

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

.set_device_type(type) ⇒ Object



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

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

.set_external_page(state) ⇒ Object



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

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

.set_os(os) ⇒ Object



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

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

.set_platform(platform) ⇒ Object



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

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

.set_portal_state(portal_state) ⇒ Object



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

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

.set_signed_in(signed_in) ⇒ Object



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

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