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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/lib/search_console_api/resources/search_analytics/query.rb +9 -1
- data/lib/search_console_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f2f148deeca1caa2726aa3ef8d7f5c6fa70a8219d93fb878a45a8492672a62e
|
4
|
+
data.tar.gz: cf35d2bc4230fb99eb4cb5d31ff72c343e273a3173d633421eb1192f7a3fa0a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c1898eb1a0624fa0a4e641b88e6f047b6654591bf43fa6d45e16646a6ab79f124aa12412d128cf128c43e3fbba73c84c56644870d8c2b73265788d412155946
|
7
|
+
data.tar.gz: ba229f7ea69f1a198017a4be145a2219ffec9d00818bfc70fb34f5cee0fe9e5a5a8feba03935e169c8a3f65d4f5b7f411cd6c1171cbbc9556eb9a2aadbfc0939
|
data/Gemfile.lock
CHANGED
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
|
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:
|
38
|
+
path: request_path,
|
31
39
|
payload: payload
|
32
40
|
)
|
33
41
|
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.
|
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-
|
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
|