search_console_api 0.0.1 → 0.0.2

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: 5cd291d9d52be7af01d919c485db008c77e102cc7a11b91cb47bed9da882b1e5
4
- data.tar.gz: '09f0b97510c12afb3adf85b3969a8526b5b3e15a7ffa4209cc4dc62800617313'
3
+ metadata.gz: 4f2f148deeca1caa2726aa3ef8d7f5c6fa70a8219d93fb878a45a8492672a62e
4
+ data.tar.gz: cf35d2bc4230fb99eb4cb5d31ff72c343e273a3173d633421eb1192f7a3fa0a6
5
5
  SHA512:
6
- metadata.gz: f2c2ae2790058ea42f01533493ab8f6e11c4a9e6f1ac6a1917cb4189317cbe8385e2c07c465303fef3c03f325711ecd1724f5ed07d6c73f8645760c178a01726
7
- data.tar.gz: 77fc275c283e23aa72a9611d2a82963436dc9e4900bdbd600b32e8f56f714f872f218ef728e36c3eec6913c763e736e80c4540ad1ebb7f904784ecce6677bdb0
6
+ metadata.gz: 3c1898eb1a0624fa0a4e641b88e6f047b6654591bf43fa6d45e16646a6ab79f124aa12412d128cf128c43e3fbba73c84c56644870d8c2b73265788d412155946
7
+ data.tar.gz: ba229f7ea69f1a198017a4be145a2219ffec9d00818bfc70fb34f5cee0fe9e5a5a8feba03935e169c8a3f65d4f5b7f411cd6c1171cbbc9556eb9a2aadbfc0939
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- search_console_api (0.0.1)
4
+ search_console_api (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -45,7 +45,7 @@ You will probably want to add the `dimensions` parameters (like in the second ex
45
45
  response = client.query(site: my_site, start_date: "2024/03/01", end_date: "2024/04/01")
46
46
  => [#<SearchConsoleApi::Objects::QueryResponseRow:0x000000010929d510 @clicks=69, @ctr=0.04542462146148782, @impressions=1519, @keys=nil, @position=15.596445029624753>]
47
47
 
48
- # a more compled query:
48
+ # a more complex query:
49
49
  response = client.query(site: my_site, start_date: "2024/03/01", end_date: "2024/04/01", dimensions: ["query"], row_limit: 3)
50
50
  =>
51
51
  [#<SearchConsoleApi::Objects::QueryResponseRow:0x0000000109324c18
@@ -69,6 +69,9 @@ response = client.query(site: my_site, start_date: "2024/03/01", end_date: "2024
69
69
  @keys=["location agreement template"],
70
70
  @position=5.392857142857143,
71
71
  @query="location agreement template">]
72
+
73
+ # You can also use a simple url instead of a Site object in the parameters:
74
+ response = client.query(site: "https://example.com", start_date: "2024/03/01", end_date: "2024/04/01", dimensions: ["query"], row_limit: 3)
72
75
  ```
73
76
 
74
77
  The response will be an array of `SearchConsoleApi::Objects::QueryResponseRow` objects, representing each row of the original response.
@@ -14,6 +14,10 @@ module SearchConsoleApi
14
14
  @row_limit = row_limit
15
15
  @start_row = start_row
16
16
  @data_state = data_state
17
+
18
+ unless @site.is_a?(SearchConsoleApi::Objects::Site)
19
+ @site = SearchConsoleApi::Objects::Site.new({"siteUrl" => @site})
20
+ end
17
21
  end
18
22
 
19
23
  def call
@@ -22,12 +26,16 @@ module SearchConsoleApi
22
26
  end
23
27
  end
24
28
 
29
+ def request_path
30
+ "/sites/#{@site.encoded_site_url}/searchAnalytics/query"
31
+ end
32
+
25
33
  private
26
34
 
27
35
  def response
28
36
  Request.post(
29
37
  access_token: @access_token,
30
- path: "/sites/#{@site.encoded_site_url}/searchAnalytics/query",
38
+ path: request_path,
31
39
  payload: payload
32
40
  )
33
41
  end
@@ -1,3 +1,3 @@
1
1
  module SearchConsoleApi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
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.1
4
+ version: 0.0.2
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-10 00:00:00.000000000 Z
11
+ date: 2024-03-12 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