cortex-snippets-client 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cortex/snippets/version.rb +1 -1
- data/lib/cortex/snippets/webpage.rb +25 -20
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69d33e7f18162eec2d559b14d5b4bccc3e11e89c
|
4
|
+
data.tar.gz: 951cd8527f1983b4c14282dd1a13f200ee1e3856
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73ab2963e44404f588c7c790b1fc5b2c90a063a1533958f6de93c575e1c2320ba0e1391c6579f4a8c9eca13978ff28e6b9fe27fe196b8968800ee8b7c01672ef
|
7
|
+
data.tar.gz: 2db3bf33566db5ca9219f8af32e35c82421c76a531d807bafb0fe203e6f745feb92e661bbebee7d9fb351527dbee70ac7464d38f21c0b6148c895d999db43582
|
@@ -1,20 +1,25 @@
|
|
1
1
|
module Cortex
|
2
2
|
module Snippets
|
3
3
|
class Webpage
|
4
|
+
attr_reader :response, :url, :contents, :status
|
5
|
+
|
4
6
|
def initialize(cortex_client, url)
|
5
|
-
@
|
7
|
+
@url = url
|
8
|
+
@response = cortex_client.webpages.get_feed(url)
|
9
|
+
@status = @response.status
|
10
|
+
@contents = @response.contents
|
6
11
|
end
|
7
12
|
|
8
13
|
def seo_title
|
9
|
-
@
|
14
|
+
@contents[:seo_title]
|
10
15
|
end
|
11
16
|
|
12
17
|
def seo_description
|
13
|
-
@
|
18
|
+
@contents[:seo_description]
|
14
19
|
end
|
15
20
|
|
16
21
|
def seo_keywords
|
17
|
-
@
|
22
|
+
@contents[:seo_keyword_list]
|
18
23
|
end
|
19
24
|
|
20
25
|
def seo_robots
|
@@ -22,38 +27,38 @@ module Cortex
|
|
22
27
|
index_options = [:noindex, :nofollow, :noodp, :nosnippet, :noarchive, :noimageindex]
|
23
28
|
|
24
29
|
index_options.each do |index_option|
|
25
|
-
robot_information << index_option if @
|
30
|
+
robot_information << index_option if @contents[index_option]
|
26
31
|
end
|
27
32
|
|
28
33
|
robot_information
|
29
34
|
end
|
30
35
|
|
31
36
|
def noindex
|
32
|
-
@
|
37
|
+
@contents[:noindex]
|
33
38
|
end
|
34
39
|
|
35
40
|
def nofollow
|
36
|
-
@
|
41
|
+
@contents[:nofollow]
|
37
42
|
end
|
38
43
|
|
39
44
|
def noodp
|
40
|
-
@
|
45
|
+
@contents[:noodp]
|
41
46
|
end
|
42
47
|
|
43
48
|
def nosnippet
|
44
|
-
@
|
49
|
+
@contents[:nosnippet]
|
45
50
|
end
|
46
51
|
|
47
52
|
def noarchive
|
48
|
-
@
|
53
|
+
@contents[:noarchive]
|
49
54
|
end
|
50
55
|
|
51
56
|
def noimageindex
|
52
|
-
@
|
57
|
+
@contents[:noimageindex]
|
53
58
|
end
|
54
|
-
|
59
|
+
|
55
60
|
def tables_widget_data
|
56
|
-
JSON.parse(@
|
61
|
+
JSON.parse(@contents[:tables_widget_json] || 'null', quirks_mode: true)
|
57
62
|
end
|
58
63
|
|
59
64
|
def tables_widget_data_for(section_name)
|
@@ -61,7 +66,7 @@ module Cortex
|
|
61
66
|
end
|
62
67
|
|
63
68
|
def carousels_widget_data
|
64
|
-
JSON.parse(@
|
69
|
+
JSON.parse(@contents[:carousels_widget_json] || 'null', quirks_mode: true)
|
65
70
|
end
|
66
71
|
|
67
72
|
def carousels_widget_data_for(section_name)
|
@@ -69,7 +74,7 @@ module Cortex
|
|
69
74
|
end
|
70
75
|
|
71
76
|
def galleries_widget_data
|
72
|
-
JSON.parse(@
|
77
|
+
JSON.parse(@contents[:galleries_widget_json] || 'null', quirks_mode: true)
|
73
78
|
end
|
74
79
|
|
75
80
|
def galleries_widget_data_for(section_name)
|
@@ -77,7 +82,7 @@ module Cortex
|
|
77
82
|
end
|
78
83
|
|
79
84
|
def accordion_group_widget_data
|
80
|
-
JSON.parse(@
|
85
|
+
JSON.parse(@contents[:accordion_group_widget_json] || 'null', quirks_mode: true)
|
81
86
|
end
|
82
87
|
|
83
88
|
def accordion_group_widget_data_for(section_name)
|
@@ -85,11 +90,11 @@ module Cortex
|
|
85
90
|
end
|
86
91
|
|
87
92
|
def charts_widget_data
|
88
|
-
JSON.parse(@
|
93
|
+
JSON.parse(@contents[:charts_widget_json] || 'null', quirks_mode: true)
|
89
94
|
end
|
90
95
|
|
91
96
|
def buy_box_widget_data
|
92
|
-
JSON.parse(@
|
97
|
+
JSON.parse(@contents[:buy_box_widget_json] || 'null', quirks_mode: true)
|
93
98
|
end
|
94
99
|
|
95
100
|
def charts_widget_data_for(section_name)
|
@@ -97,11 +102,11 @@ module Cortex
|
|
97
102
|
end
|
98
103
|
|
99
104
|
def product_data
|
100
|
-
JSON.parse(@
|
105
|
+
JSON.parse(@contents[:product_data_json] || 'null', quirks_mode: true)
|
101
106
|
end
|
102
107
|
|
103
108
|
def snippets
|
104
|
-
@
|
109
|
+
@contents[:snippets]
|
105
110
|
end
|
106
111
|
end
|
107
112
|
end
|