Class: Watchmob::HeurekaPage
- Inherits:
-
Page
- Object
- Page
- Watchmob::HeurekaPage
show all
- Defined in:
- lib/watchmob/heureka_page.rb
Instance Attribute Summary
Attributes inherited from Page
#document, #uri
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Page
#initialize
Constructor Details
This class inherits a constructor from Watchmob::Page
Class Method Details
.find(name) ⇒ Object
6
7
8
9
10
11
|
# File 'lib/watchmob/heureka_page.rb', line 6
def self.find(name)
search = HeurekaSearchPage.search(name)
uri = search.first_result_uri
uri.path += "/specifikace/"
new(uri)
end
|
Instance Method Details
#autofocus ⇒ Object
43
44
45
|
# File 'lib/watchmob/heureka_page.rb', line 43
def autofocus
param_value(3688).andand.eql? "ano"
end
|
#battery_capacity ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/watchmob/heureka_page.rb', line 25
def battery_capacity
capacity = param_value(1615).andand.to_f
if !capacity.nil? and capacity <= 10
capacity * 1000
else
capacity
end
end
|
#mass ⇒ Object
21
22
23
|
# File 'lib/watchmob/heureka_page.rb', line 21
def mass
param_value(1607).andand.to_f
end
|
#name ⇒ Object
17
18
19
|
# File 'lib/watchmob/heureka_page.rb', line 17
def name
document.at_css(".main-info h2").andand.inner_text
end
|
#param_unit(param) ⇒ Object
65
66
67
|
# File 'lib/watchmob/heureka_page.rb', line 65
def param_unit(param)
document.at_css("#param-unit-#{param}").andand.inner_text
end
|
#param_value(param) ⇒ Object
61
62
63
|
# File 'lib/watchmob/heureka_page.rb', line 61
def param_value(param)
document.at_css("#param-value-#{param}").andand.inner_text
end
|
#param_value_to_min(param) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/watchmob/heureka_page.rb', line 47
def param_value_to_min(param)
value = param_value(param).andand.to_f
case unit = param_unit(param)
when /hodin/
value * 60
when /min/
value
when nil
nil
else
raise RuntimeError, "Unknown unit #{unit}"
end
end
|
#stand_by ⇒ Object
35
36
37
|
# File 'lib/watchmob/heureka_page.rb', line 35
def stand_by
param_value_to_min(1616).andand.to_f
end
|
#talk_time ⇒ Object
39
40
41
|
# File 'lib/watchmob/heureka_page.rb', line 39
def talk_time
param_value_to_min(1617).andand.to_f
end
|
#title ⇒ Object
13
14
15
|
# File 'lib/watchmob/heureka_page.rb', line 13
def title
"Heureka"
end
|