cortex-snippets-client 1.1.8 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7ae00a884766dfbca402f2a8bff3942a428b444b
4
- data.tar.gz: a89ffe893ebf87e8b0783944c409385993be675e
3
+ metadata.gz: 121d29bad86ddf332d53b68a548d2cbdc4a41961
4
+ data.tar.gz: af22ef08cc4e2a40c91b556a70cd8a09e435450f
5
5
  SHA512:
6
- metadata.gz: d824cd442c589124cf3c59e265b8863569183bbe83eec7e524749c62ca33ecfcecf9d7081c6fc62a1778ed3ee6bd4cd22093f9510ad28885c40524a31a0a9ea9
7
- data.tar.gz: c5a27401f0bf9ecdd12253111fa2eac2104b21d4d80432e912a4d4985f8d64b8bc85d8fb1aa83c2fb70691c5ac42043c86644035ee05e00ef343f051b930cf34
6
+ metadata.gz: 4f175994fbfc381db38a7e7d62bbb215620809a55c98ef97cdaf91dd4f97f52d4bf2b09e83323131ce0c803d11fe331c97e241a1cab368006eb530ca459bf415
7
+ data.tar.gz: 00ee942abbea532d4b6a899a8968e5bf6e976f2aadf4c4447e404b0927f23e9dd8b035715d57e15ab0ec3459a60ac662273bb9dfdba455f881eca8692ccdfbdb
@@ -1,5 +1,5 @@
1
1
  module Cortex
2
2
  module Snippets
3
- VERSION = '1.1.8'
3
+ VERSION = '1.2.0'
4
4
  end
5
5
  end
@@ -1,25 +1,20 @@
1
1
  module Cortex
2
2
  module Snippets
3
3
  class Webpage
4
- attr_reader :response, :url, :contents, :status
5
-
6
4
  def initialize(cortex_client, url)
7
- @url = url
8
- @response = cortex_client.webpages.get_feed(url)
9
- @status = @response.status
10
- @contents = @response.contents
5
+ @webpage = cortex_client.webpages.get_feed(url).contents
11
6
  end
12
7
 
13
8
  def seo_title
14
- @contents[:seo_title]
9
+ @webpage[:seo_title]
15
10
  end
16
11
 
17
12
  def seo_description
18
- @contents[:seo_description]
13
+ @webpage[:seo_description]
19
14
  end
20
15
 
21
16
  def seo_keywords
22
- @contents[:seo_keyword_list]
17
+ @webpage[:seo_keyword_list]
23
18
  end
24
19
 
25
20
  def seo_robots
@@ -27,45 +22,38 @@ module Cortex
27
22
  index_options = [:noindex, :nofollow, :noodp, :nosnippet, :noarchive, :noimageindex]
28
23
 
29
24
  index_options.each do |index_option|
30
- robot_information << index_option if @contents[index_option]
25
+ robot_information << index_option if @webpage[index_option]
31
26
  end
32
27
 
33
28
  robot_information
34
29
  end
35
30
 
36
31
  def noindex
37
- @contents[:noindex]
32
+ @webpage[:noindex]
38
33
  end
39
34
 
40
35
  def nofollow
41
- @contents[:nofollow]
36
+ @webpage[:nofollow]
42
37
  end
43
38
 
44
39
  def noodp
45
- @contents[:noodp]
40
+ @webpage[:noodp]
46
41
  end
47
42
 
48
43
  def nosnippet
49
- @contents[:nosnippet]
44
+ @webpage[:nosnippet]
50
45
  end
51
46
 
52
47
  def noarchive
53
- @contents[:noarchive]
48
+ @webpage[:noarchive]
54
49
  end
55
50
 
56
51
  def noimageindex
57
- @contents[:noimageindex]
58
- end
59
-
60
- def dynamic_yield
61
- {
62
- sku: @contents[:dynamic_yield_sku],
63
- category: @contents[:dynamic_yield_category]
64
- }
52
+ @webpage[:noimageindex]
65
53
  end
66
54
 
67
55
  def tables_widget_data
68
- JSON.parse(@contents[:tables_widget_json] || 'null', quirks_mode: true)
56
+ JSON.parse(@webpage[:tables_widget_json] || 'null', quirks_mode: true)
69
57
  end
70
58
 
71
59
  def tables_widget_data_for(section_name)
@@ -73,7 +61,7 @@ module Cortex
73
61
  end
74
62
 
75
63
  def carousels_widget_data
76
- JSON.parse(@contents[:carousels_widget_json] || 'null', quirks_mode: true)
64
+ JSON.parse(@webpage[:carousels_widget_json] || 'null', quirks_mode: true)
77
65
  end
78
66
 
79
67
  def carousels_widget_data_for(section_name)
@@ -81,7 +69,7 @@ module Cortex
81
69
  end
82
70
 
83
71
  def galleries_widget_data
84
- JSON.parse(@contents[:galleries_widget_json] || 'null', quirks_mode: true)
72
+ JSON.parse(@webpage[:galleries_widget_json] || 'null', quirks_mode: true)
85
73
  end
86
74
 
87
75
  def galleries_widget_data_for(section_name)
@@ -89,7 +77,7 @@ module Cortex
89
77
  end
90
78
 
91
79
  def accordion_group_widget_data
92
- JSON.parse(@contents[:accordion_group_widget_json] || 'null', quirks_mode: true)
80
+ JSON.parse(@webpage[:accordion_group_widget_json] || 'null', quirks_mode: true)
93
81
  end
94
82
 
95
83
  def accordion_group_widget_data_for(section_name)
@@ -97,19 +85,23 @@ module Cortex
97
85
  end
98
86
 
99
87
  def charts_widget_data
100
- JSON.parse(@contents[:charts_widget_json] || 'null', quirks_mode: true)
88
+ JSON.parse(@webpage[:charts_widget_json] || 'null', quirks_mode: true)
101
89
  end
102
90
 
103
91
  def buy_box_widget_data
104
- JSON.parse(@contents[:buy_box_widget_json] || 'null', quirks_mode: true)
92
+ JSON.parse(@webpage[:buy_box_widget_json] || 'null', quirks_mode: true)
105
93
  end
106
94
 
107
95
  def charts_widget_data_for(section_name)
108
96
  charts_widget_data&.[](section_name) || {}
109
97
  end
110
98
 
99
+ def product_data
100
+ JSON.parse(@webpage[:product_data_json] || 'null', quirks_mode: true)
101
+ end
102
+
111
103
  def snippets
112
- @contents[:snippets]
104
+ @webpage[:snippets]
113
105
  end
114
106
  end
115
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cortex-snippets-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - CareerBuilder Employer Site & Content Products
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cortex-client