search_console_api 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3968aa346b7e66d1096c29eef5dbcfab5814196b722fe2890dfcc2f671d70d63
4
- data.tar.gz: 9267710cb171c3974dc6d136ea3d2dc1429ae61e2606f0df0d167590338b0883
3
+ metadata.gz: b7a35fdc9e89bb108402bf38f44138e8bde0d0364495850005e1994ac0c28f84
4
+ data.tar.gz: 9cea169a9eff63101a8f6c9d7d265ef36dd8b5fdf18ed2ce75eebc7f38399e08
5
5
  SHA512:
6
- metadata.gz: 0c9905e38e8a5a0d891b52cd692e99fdd395380962d4b65adfb6d790fa944b01e761876b4c78c0c7834f432f2f0f2ecb394042bd3e41d085a974f0b111db1e23
7
- data.tar.gz: bef1b28a7ee2fcf906ae732152762b300e37f67beb387b56c7eca6eabb7d8ce7235839436e9d7d2e5cd4195e93b55961f2ababeeb651dbea1f182ffaf62fe812
6
+ metadata.gz: 90513f07be9b036e58c981b5c3b8728b735f47b81ce3f5ea06152c627d7244dbc7ffffa2bd8eb0b7f4cf30ccf0ee31e301a501f39df5b0b5d2a10f582696a917
7
+ data.tar.gz: 72a81468d652f9bbb9a48355ad5821d4e7444c84b7c99ef9e1464208a296a65c3bce1d44b36ade526ad9216c0252ebfd2caa95bec9a7efbe68ed0470dfc6eb4d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- search_console_api (0.0.3)
4
+ search_console_api (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -7,8 +7,8 @@ module SearchConsoleApi
7
7
  def initialize(access_token:, site: nil, start_date: nil, end_date: nil, dimensions: [], type: nil, dimension_filter_groups: [], aggregation_type: nil, row_limit: nil, start_row: nil, data_state: nil)
8
8
  @access_token = access_token
9
9
  @site = site
10
- @start_date = DateTime.parse(start_date).strftime("%Y-%m-%d")
11
- @end_date = DateTime.parse(end_date).strftime("%Y-%m-%d")
10
+ @start_date = DateTime.parse(start_date.to_s).strftime("%Y-%m-%d")
11
+ @end_date = DateTime.parse(end_date.to_s).strftime("%Y-%m-%d")
12
12
  @dimensions = dimensions
13
13
  @type = type
14
14
  @dimension_filter_groups = dimension_filter_groups
@@ -23,6 +23,8 @@ module SearchConsoleApi
23
23
  end
24
24
 
25
25
  def call
26
+ return [] unless response["rows"].is_a?(Array)
27
+
26
28
  response["rows"].each_with_object([]) do |attrs, rows|
27
29
  rows << Objects::QueryResponseRow.new(attrs, @dimensions)
28
30
  end
@@ -35,7 +37,7 @@ module SearchConsoleApi
35
37
  private
36
38
 
37
39
  def response
38
- Request.post(
40
+ @response ||= Request.post(
39
41
  access_token: @access_token,
40
42
  path: request_path,
41
43
  payload: payload
@@ -7,6 +7,8 @@ module SearchConsoleApi
7
7
  end
8
8
 
9
9
  def call
10
+ return [] unless response["siteEntry"].is_a?(Array)
11
+
10
12
  response["siteEntry"].each_with_object([]) do |attrs, sites|
11
13
  sites << Objects::Site.new(attrs)
12
14
  end
@@ -15,7 +17,7 @@ module SearchConsoleApi
15
17
  private
16
18
 
17
19
  def response
18
- Request.get(access_token: @access_token, path: "/sites")
20
+ @response ||= Request.get(access_token: @access_token, path: "/sites")
19
21
  end
20
22
  end
21
23
  end
@@ -1,3 +1,3 @@
1
1
  module SearchConsoleApi
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: search_console_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Garcia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-12 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A very humble wrapper for the Google Search Console API to be used in
14
14
  conjuntion with OAuth2