serp_metrics 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -3
- data/lib/serp_metrics.rb +1 -1
- data/lib/serp_metrics/command_sets/queues.rb +3 -0
- data/lib/serp_metrics/command_sets/queues/base.rb +25 -0
- data/lib/serp_metrics/command_sets/queues/delayed.rb +15 -0
- data/lib/serp_metrics/command_sets/queues/priority.rb +15 -0
- data/lib/serp_metrics/commands.rb +6 -2
- data/lib/serp_metrics/version.rb +1 -1
- data/spec/cassettes/serp_metrics__command_sets__account/credit_fetches_credit_information.yml +5 -5
- data/spec/cassettes/serp_metrics__command_sets__account/time_fetches_time.yml +4 -4
- data/spec/cassettes/serp_metrics__command_sets__engines/codes_fetches_search_engine_codes.yml +5 -5
- data/spec/cassettes/serp_metrics__command_sets__flux/flux_fetches_flux_trend.yml +5 -5
- data/spec/cassettes/serp_metrics__command_sets__keywords/add_adds_keyword.yml +19 -19
- data/spec/cassettes/serp_metrics__command_sets__keywords/all_retrieves_keywords.yml +24 -24
- data/spec/cassettes/serp_metrics__command_sets__keywords/check_retrieves_checks.yml +24 -24
- data/spec/cassettes/serp_metrics__command_sets__keywords/remove_removes_keyword.yml +24 -24
- data/spec/cassettes/serp_metrics__command_sets__keywords/serp_retrieves_serp_for_check.yml +14 -14
- data/spec/cassettes/serp_metrics__command_sets__queues__delayed/add_with_location_adds_delayed.yml +42 -0
- data/spec/cassettes/serp_metrics__command_sets__queues__delayed/add_without_location_adds_delayed.yml +42 -0
- data/spec/cassettes/serp_metrics__command_sets__queues__delayed/get_checks_delayed.yml +81 -0
- data/spec/cassettes/{serp_metrics__command_sets__priorities → serp_metrics__command_sets__queues__priority}/add_with_location_adds_priority.yml +5 -5
- data/spec/cassettes/{serp_metrics__command_sets__priorities → serp_metrics__command_sets__queues__priority}/add_without_location_adds_priority.yml +5 -5
- data/spec/cassettes/{serp_metrics__command_sets__priorities → serp_metrics__command_sets__queues__priority}/get_checks_priority.yml +10 -10
- data/spec/lib/serp_metrics/command_sets/queues/delayed_spec.rb +51 -0
- data/spec/lib/serp_metrics/command_sets/{priorities_spec.rb → queues/priority_spec.rb} +5 -5
- data/spec/lib/serp_metrics/commands_spec.rb +15 -4
- data/spec/spec_helper.rb +1 -1
- metadata +21 -10
- data/lib/serp_metrics/command_sets/priorities.rb +0 -23
data/spec/cassettes/serp_metrics__command_sets__queues__delayed/add_with_location_adds_delayed.yml
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.serpmetrics.com/delayed/add
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796873&auth=KmO1tWZa4IRWRRs2mnH5I5LpGwWlog8ulbUQsQbDerk%3D¶ms=%7B%22keyword%22%3A%22restaurants%22%2C%22engines%22%3A%5B%22google_en-us%22%5D%2C%22location%22%3A%22Nashville%22%7D
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 201
|
15
|
+
message: Created
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx/1.2.9
|
19
|
+
Date:
|
20
|
+
- Sat, 30 Nov 2013 07:30:25 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=UTF-8
|
23
|
+
Transfer-Encoding:
|
24
|
+
- chunked
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
X-Powered-By:
|
28
|
+
- PHP/5.4.13--pl1-gentoo
|
29
|
+
Set-Cookie:
|
30
|
+
- app=3vsd88h7spc8jefbtt1pu0fuq0; path=/; HttpOnly
|
31
|
+
Expires:
|
32
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
33
|
+
Cache-Control:
|
34
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
35
|
+
Pragma:
|
36
|
+
- no-cache
|
37
|
+
body:
|
38
|
+
encoding: US-ASCII
|
39
|
+
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"delayed_id\":\"5299965c4513a748440000a8\",\"location\":\"Nashville\"}],\"request_time\":1385796625}"
|
40
|
+
http_version:
|
41
|
+
recorded_at: Sat, 30 Nov 2013 07:34:33 GMT
|
42
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.serpmetrics.com/delayed/add
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796873&auth=KmO1tWZa4IRWRRs2mnH5I5LpGwWlog8ulbUQsQbDerk%3D¶ms=%7B%22keyword%22%3A%22restaurants%22%2C%22engines%22%3A%5B%22google_en-us%22%5D%7D
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 201
|
15
|
+
message: Created
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx/1.2.9
|
19
|
+
Date:
|
20
|
+
- Sat, 30 Nov 2013 07:34:35 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=UTF-8
|
23
|
+
Transfer-Encoding:
|
24
|
+
- chunked
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
X-Powered-By:
|
28
|
+
- PHP/5.4.13--pl1-gentoo
|
29
|
+
Set-Cookie:
|
30
|
+
- app=91ditprqep23f92gfn19tagdc2; path=/; HttpOnly
|
31
|
+
Expires:
|
32
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
33
|
+
Cache-Control:
|
34
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
35
|
+
Pragma:
|
36
|
+
- no-cache
|
37
|
+
body:
|
38
|
+
encoding: US-ASCII
|
39
|
+
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"delayed_id\":\"5299965c4513a748440000a8\"}],\"request_time\":1385796875}"
|
40
|
+
http_version:
|
41
|
+
recorded_at: Sat, 30 Nov 2013 07:34:33 GMT
|
42
|
+
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,81 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.serpmetrics.com/delayed/add
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796873&auth=KmO1tWZa4IRWRRs2mnH5I5LpGwWlog8ulbUQsQbDerk%3D¶ms=%7B%22keyword%22%3A%22restaurants%22%2C%22engines%22%3A%5B%22google_en-us%22%5D%7D
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 201
|
15
|
+
message: Created
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- nginx/1.2.9
|
19
|
+
Date:
|
20
|
+
- Sat, 30 Nov 2013 07:40:12 GMT
|
21
|
+
Content-Type:
|
22
|
+
- application/json; charset=UTF-8
|
23
|
+
Transfer-Encoding:
|
24
|
+
- chunked
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
X-Powered-By:
|
28
|
+
- PHP/5.4.13--pl1-gentoo
|
29
|
+
Set-Cookie:
|
30
|
+
- app=65otnm8nlosdbgjc6n710qa0k3; path=/; HttpOnly
|
31
|
+
Expires:
|
32
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
33
|
+
Cache-Control:
|
34
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
35
|
+
Pragma:
|
36
|
+
- no-cache
|
37
|
+
body:
|
38
|
+
encoding: US-ASCII
|
39
|
+
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"delayed_id\":\"5299965c4513a748440000a8\"}],\"request_time\":1385797212}"
|
40
|
+
http_version:
|
41
|
+
recorded_at: Sat, 30 Nov 2013 07:34:33 GMT
|
42
|
+
- request:
|
43
|
+
method: post
|
44
|
+
uri: http://api.serpmetrics.com/delayed/status
|
45
|
+
body:
|
46
|
+
encoding: US-ASCII
|
47
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796873&auth=KmO1tWZa4IRWRRs2mnH5I5LpGwWlog8ulbUQsQbDerk%3D¶ms=%7B%22delayed_id%22%3A%225299965c4513a748440000a8%22%7D
|
48
|
+
headers:
|
49
|
+
Content-Type:
|
50
|
+
- application/x-www-form-urlencoded
|
51
|
+
response:
|
52
|
+
status:
|
53
|
+
code: 404
|
54
|
+
message: Not Found
|
55
|
+
headers:
|
56
|
+
Server:
|
57
|
+
- nginx/1.2.9
|
58
|
+
Date:
|
59
|
+
- Sat, 30 Nov 2013 07:30:24 GMT
|
60
|
+
Content-Type:
|
61
|
+
- application/json; charset=UTF-8
|
62
|
+
Transfer-Encoding:
|
63
|
+
- chunked
|
64
|
+
Connection:
|
65
|
+
- close
|
66
|
+
X-Powered-By:
|
67
|
+
- PHP/5.4.13--pl1-gentoo
|
68
|
+
Set-Cookie:
|
69
|
+
- app=kfg8ufejgffff42neapt72c0a4; path=/; HttpOnly
|
70
|
+
Expires:
|
71
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
72
|
+
Cache-Control:
|
73
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
74
|
+
Pragma:
|
75
|
+
- no-cache
|
76
|
+
body:
|
77
|
+
encoding: US-ASCII
|
78
|
+
string: "{\"status\":\"error\",\"message\":\"Awaiting queue slot.\",\"request_time\":1385796624}"
|
79
|
+
http_version:
|
80
|
+
recorded_at: Sat, 30 Nov 2013 07:34:33 GMT
|
81
|
+
recorded_with: VCR 2.4.0
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: http://api.serpmetrics.com/priority/add
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
|
-
string: key=<SERP_METRICS_KEY_ENCODED>&ts=
|
8
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796397&auth=gZhSCcStSVOKWve6sdJ5jpgyFNw2gXBc5HIth%2FIV92w%3D¶ms=%7B%22keyword%22%3A%22restaurants%22%2C%22engines%22%3A%5B%22google_en-us%22%5D%2C%22location%22%3A%22Nashville%22%7D
|
9
9
|
headers:
|
10
10
|
Content-Type:
|
11
11
|
- application/x-www-form-urlencoded
|
@@ -17,7 +17,7 @@ http_interactions:
|
|
17
17
|
Server:
|
18
18
|
- nginx/1.2.9
|
19
19
|
Date:
|
20
|
-
- Sat, 30 Nov 2013
|
20
|
+
- Sat, 30 Nov 2013 07:32:03 GMT
|
21
21
|
Content-Type:
|
22
22
|
- application/json; charset=UTF-8
|
23
23
|
Transfer-Encoding:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
X-Powered-By:
|
28
28
|
- PHP/5.4.13--pl1-gentoo
|
29
29
|
Set-Cookie:
|
30
|
-
- app=
|
30
|
+
- app=m77c043qd363092ben34jhbhn4; path=/; HttpOnly
|
31
31
|
Expires:
|
32
32
|
- Thu, 19 Nov 1981 08:52:00 GMT
|
33
33
|
Cache-Control:
|
@@ -36,7 +36,7 @@ http_interactions:
|
|
36
36
|
- no-cache
|
37
37
|
body:
|
38
38
|
encoding: US-ASCII
|
39
|
-
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"priority_id\":\"
|
39
|
+
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"priority_id\":\"5299934c3fc134e66000007a\",\"location\":\"Nashville\"}],\"request_time\":1385796723}"
|
40
40
|
http_version:
|
41
|
-
recorded_at: Sat, 30 Nov 2013
|
41
|
+
recorded_at: Sat, 30 Nov 2013 07:26:37 GMT
|
42
42
|
recorded_with: VCR 2.4.0
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: http://api.serpmetrics.com/priority/add
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
|
-
string: key=<SERP_METRICS_KEY_ENCODED>&ts=
|
8
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796397&auth=gZhSCcStSVOKWve6sdJ5jpgyFNw2gXBc5HIth%2FIV92w%3D¶ms=%7B%22keyword%22%3A%22restaurants%22%2C%22engines%22%3A%5B%22google_en-us%22%5D%7D
|
9
9
|
headers:
|
10
10
|
Content-Type:
|
11
11
|
- application/x-www-form-urlencoded
|
@@ -17,7 +17,7 @@ http_interactions:
|
|
17
17
|
Server:
|
18
18
|
- nginx/1.2.9
|
19
19
|
Date:
|
20
|
-
- Sat, 30 Nov 2013
|
20
|
+
- Sat, 30 Nov 2013 07:27:08 GMT
|
21
21
|
Content-Type:
|
22
22
|
- application/json; charset=UTF-8
|
23
23
|
Transfer-Encoding:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
X-Powered-By:
|
28
28
|
- PHP/5.4.13--pl1-gentoo
|
29
29
|
Set-Cookie:
|
30
|
-
- app=
|
30
|
+
- app=holkrttrihtbe89vq7jk06fnt1; path=/; HttpOnly
|
31
31
|
Expires:
|
32
32
|
- Thu, 19 Nov 1981 08:52:00 GMT
|
33
33
|
Cache-Control:
|
@@ -36,7 +36,7 @@ http_interactions:
|
|
36
36
|
- no-cache
|
37
37
|
body:
|
38
38
|
encoding: US-ASCII
|
39
|
-
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"priority_id\":\"
|
39
|
+
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"priority_id\":\"5299934c3fc134e66000007a\"}],\"request_time\":1385796428}"
|
40
40
|
http_version:
|
41
|
-
recorded_at: Sat, 30 Nov 2013
|
41
|
+
recorded_at: Sat, 30 Nov 2013 07:26:37 GMT
|
42
42
|
recorded_with: VCR 2.4.0
|
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: http://api.serpmetrics.com/priority/add
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
|
-
string: key=<SERP_METRICS_KEY_ENCODED>&ts=
|
8
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796397&auth=gZhSCcStSVOKWve6sdJ5jpgyFNw2gXBc5HIth%2FIV92w%3D¶ms=%7B%22keyword%22%3A%22restaurants%22%2C%22engines%22%3A%5B%22google_en-us%22%5D%7D
|
9
9
|
headers:
|
10
10
|
Content-Type:
|
11
11
|
- application/x-www-form-urlencoded
|
@@ -17,7 +17,7 @@ http_interactions:
|
|
17
17
|
Server:
|
18
18
|
- nginx/1.2.9
|
19
19
|
Date:
|
20
|
-
- Sat, 30 Nov 2013
|
20
|
+
- Sat, 30 Nov 2013 07:26:43 GMT
|
21
21
|
Content-Type:
|
22
22
|
- application/json; charset=UTF-8
|
23
23
|
Transfer-Encoding:
|
@@ -27,7 +27,7 @@ http_interactions:
|
|
27
27
|
X-Powered-By:
|
28
28
|
- PHP/5.4.13--pl1-gentoo
|
29
29
|
Set-Cookie:
|
30
|
-
- app=
|
30
|
+
- app=m9t7s2243ug50n4ucrmb1qip53; path=/; HttpOnly
|
31
31
|
Expires:
|
32
32
|
- Thu, 19 Nov 1981 08:52:00 GMT
|
33
33
|
Cache-Control:
|
@@ -36,15 +36,15 @@ http_interactions:
|
|
36
36
|
- no-cache
|
37
37
|
body:
|
38
38
|
encoding: US-ASCII
|
39
|
-
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"priority_id\":\"
|
39
|
+
string: "{\"status\":\"ok\",\"data\":[{\"phrase\":\"restaurants\",\"engine_code\":\"google_en-us\",\"priority_id\":\"5299934c3fc134e66000007a\"}],\"request_time\":1385796403}"
|
40
40
|
http_version:
|
41
|
-
recorded_at: Sat, 30 Nov 2013
|
41
|
+
recorded_at: Sat, 30 Nov 2013 07:26:37 GMT
|
42
42
|
- request:
|
43
43
|
method: post
|
44
44
|
uri: http://api.serpmetrics.com/priority/status
|
45
45
|
body:
|
46
46
|
encoding: US-ASCII
|
47
|
-
string: key=<SERP_METRICS_KEY_ENCODED>&ts=
|
47
|
+
string: key=<SERP_METRICS_KEY_ENCODED>&ts=1385796397&auth=gZhSCcStSVOKWve6sdJ5jpgyFNw2gXBc5HIth%2FIV92w%3D¶ms=%7B%22priority_id%22%3A%225299934c3fc134e66000007a%22%7D
|
48
48
|
headers:
|
49
49
|
Content-Type:
|
50
50
|
- application/x-www-form-urlencoded
|
@@ -56,7 +56,7 @@ http_interactions:
|
|
56
56
|
Server:
|
57
57
|
- nginx/1.2.9
|
58
58
|
Date:
|
59
|
-
- Sat, 30 Nov 2013
|
59
|
+
- Sat, 30 Nov 2013 07:31:36 GMT
|
60
60
|
Content-Type:
|
61
61
|
- application/json; charset=UTF-8
|
62
62
|
Transfer-Encoding:
|
@@ -66,7 +66,7 @@ http_interactions:
|
|
66
66
|
X-Powered-By:
|
67
67
|
- PHP/5.4.13--pl1-gentoo
|
68
68
|
Set-Cookie:
|
69
|
-
- app=
|
69
|
+
- app=qqb8j2j54e66ujkk1qvps1k112; path=/; HttpOnly
|
70
70
|
Expires:
|
71
71
|
- Thu, 19 Nov 1981 08:52:00 GMT
|
72
72
|
Cache-Control:
|
@@ -75,7 +75,7 @@ http_interactions:
|
|
75
75
|
- no-cache
|
76
76
|
body:
|
77
77
|
encoding: US-ASCII
|
78
|
-
string: "{\"status\":\"error\",\"message\":\"Currently in queue, please retry shortly\",\"request_time\":
|
78
|
+
string: "{\"status\":\"error\",\"message\":\"Currently in queue, please retry shortly\",\"request_time\":1385796696}"
|
79
79
|
http_version:
|
80
|
-
recorded_at: Sat, 30 Nov 2013
|
80
|
+
recorded_at: Sat, 30 Nov 2013 07:26:37 GMT
|
81
81
|
recorded_with: VCR 2.4.0
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SerpMetrics::CommandSets::Queues::Delayed, :vcr do
|
4
|
+
before do
|
5
|
+
api_configuration = YAML.load_file('spec/api_credentials.yml')
|
6
|
+
@client = SerpMetrics.client.configure do |client|
|
7
|
+
client.key = api_configuration['key']
|
8
|
+
client.secret = api_configuration['secret']
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "add" do
|
13
|
+
context "without location" do
|
14
|
+
it "adds delayed" do
|
15
|
+
response = @client.delayed.add("restaurants", ['google_en-us'])
|
16
|
+
response['status'].should == 'ok'
|
17
|
+
|
18
|
+
delayed = response['data'].first
|
19
|
+
delayed['phrase'].should == "restaurants"
|
20
|
+
delayed['engine_code'].should == 'google_en-us'
|
21
|
+
delayed['location'].should be_nil
|
22
|
+
delayed['delayed_id'].should_not be_empty
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context "with location" do
|
27
|
+
it "adds delayed" do
|
28
|
+
response = @client.delayed.add("restaurants", ['google_en-us'], "Nashville")
|
29
|
+
response['status'].should == 'ok'
|
30
|
+
|
31
|
+
delayed = response['data'].first
|
32
|
+
delayed['phrase'].should == "restaurants"
|
33
|
+
delayed['engine_code'].should == 'google_en-us'
|
34
|
+
delayed['location'].should == "Nashville"
|
35
|
+
delayed['delayed_id'].should_not be_empty
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "get" do
|
41
|
+
it "checks delayed" do
|
42
|
+
response = @client.delayed.add("restaurants", ['google_en-us'])
|
43
|
+
|
44
|
+
delayed = response['data'].first
|
45
|
+
delayed_id = delayed['delayed_id']
|
46
|
+
|
47
|
+
response = @client.delayed.get(delayed_id)
|
48
|
+
response['status'].should_not be_nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe SerpMetrics::CommandSets::
|
3
|
+
describe SerpMetrics::CommandSets::Queues::Priority, :vcr do
|
4
4
|
before do
|
5
5
|
api_configuration = YAML.load_file('spec/api_credentials.yml')
|
6
6
|
@client = SerpMetrics.client.configure do |client|
|
@@ -12,7 +12,7 @@ describe SerpMetrics::CommandSets::Priorities, :vcr do
|
|
12
12
|
describe "add" do
|
13
13
|
context "without location" do
|
14
14
|
it "adds priority" do
|
15
|
-
response = @client.
|
15
|
+
response = @client.priority.add("restaurants", ['google_en-us'])
|
16
16
|
response['status'].should == 'ok'
|
17
17
|
|
18
18
|
priority = response['data'].first
|
@@ -25,7 +25,7 @@ describe SerpMetrics::CommandSets::Priorities, :vcr do
|
|
25
25
|
|
26
26
|
context "with location" do
|
27
27
|
it "adds priority" do
|
28
|
-
response = @client.
|
28
|
+
response = @client.priority.add("restaurants", ['google_en-us'], "Nashville")
|
29
29
|
response['status'].should == 'ok'
|
30
30
|
|
31
31
|
priority = response['data'].first
|
@@ -39,12 +39,12 @@ describe SerpMetrics::CommandSets::Priorities, :vcr do
|
|
39
39
|
|
40
40
|
describe "get" do
|
41
41
|
it "checks priority" do
|
42
|
-
response = @client.
|
42
|
+
response = @client.priority.add("restaurants", ['google_en-us'])
|
43
43
|
|
44
44
|
priority = response['data'].first
|
45
45
|
priority_id = priority['priority_id']
|
46
46
|
|
47
|
-
response = @client.
|
47
|
+
response = @client.priority.get(priority_id)
|
48
48
|
response['status'].should_not be_nil
|
49
49
|
end
|
50
50
|
end
|
@@ -27,14 +27,25 @@ describe SerpMetrics::Client do
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
describe ".
|
30
|
+
describe ".delayed" do
|
31
31
|
it "assigns client for command set" do
|
32
|
-
@client.
|
32
|
+
@client.delayed.client.should be_equal(@client)
|
33
33
|
end
|
34
34
|
|
35
35
|
it "caches command set for client" do
|
36
|
-
old_command_set = @client.
|
37
|
-
@client.
|
36
|
+
old_command_set = @client.delayed
|
37
|
+
@client.delayed.should be_equal(old_command_set)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ".priority" do
|
42
|
+
it "assigns client for command set" do
|
43
|
+
@client.priority.client.should be_equal(@client)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "caches command set for client" do
|
47
|
+
old_command_set = @client.priority
|
48
|
+
@client.priority.should be_equal(old_command_set)
|
38
49
|
end
|
39
50
|
end
|
40
51
|
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serp_metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -63,7 +63,10 @@ files:
|
|
63
63
|
- lib/serp_metrics/command_sets/engines.rb
|
64
64
|
- lib/serp_metrics/command_sets/flux.rb
|
65
65
|
- lib/serp_metrics/command_sets/keywords.rb
|
66
|
-
- lib/serp_metrics/command_sets/
|
66
|
+
- lib/serp_metrics/command_sets/queues.rb
|
67
|
+
- lib/serp_metrics/command_sets/queues/base.rb
|
68
|
+
- lib/serp_metrics/command_sets/queues/delayed.rb
|
69
|
+
- lib/serp_metrics/command_sets/queues/priority.rb
|
67
70
|
- lib/serp_metrics/commands.rb
|
68
71
|
- lib/serp_metrics/response.rb
|
69
72
|
- lib/serp_metrics/version.rb
|
@@ -78,15 +81,19 @@ files:
|
|
78
81
|
- spec/cassettes/serp_metrics__command_sets__keywords/check_retrieves_checks.yml
|
79
82
|
- spec/cassettes/serp_metrics__command_sets__keywords/remove_removes_keyword.yml
|
80
83
|
- spec/cassettes/serp_metrics__command_sets__keywords/serp_retrieves_serp_for_check.yml
|
81
|
-
- spec/cassettes/
|
82
|
-
- spec/cassettes/
|
83
|
-
- spec/cassettes/
|
84
|
+
- spec/cassettes/serp_metrics__command_sets__queues__delayed/add_with_location_adds_delayed.yml
|
85
|
+
- spec/cassettes/serp_metrics__command_sets__queues__delayed/add_without_location_adds_delayed.yml
|
86
|
+
- spec/cassettes/serp_metrics__command_sets__queues__delayed/get_checks_delayed.yml
|
87
|
+
- spec/cassettes/serp_metrics__command_sets__queues__priority/add_with_location_adds_priority.yml
|
88
|
+
- spec/cassettes/serp_metrics__command_sets__queues__priority/add_without_location_adds_priority.yml
|
89
|
+
- spec/cassettes/serp_metrics__command_sets__queues__priority/get_checks_priority.yml
|
84
90
|
- spec/lib/serp_metrics/client_spec.rb
|
85
91
|
- spec/lib/serp_metrics/command_sets/account_spec.rb
|
86
92
|
- spec/lib/serp_metrics/command_sets/engines_spec.rb
|
87
93
|
- spec/lib/serp_metrics/command_sets/flux_spec.rb
|
88
94
|
- spec/lib/serp_metrics/command_sets/keywords_spec.rb
|
89
|
-
- spec/lib/serp_metrics/command_sets/
|
95
|
+
- spec/lib/serp_metrics/command_sets/queues/delayed_spec.rb
|
96
|
+
- spec/lib/serp_metrics/command_sets/queues/priority_spec.rb
|
90
97
|
- spec/lib/serp_metrics/commands_spec.rb
|
91
98
|
- spec/lib/serp_metrics/response_spec.rb
|
92
99
|
- spec/lib/serp_metrics/version_spec.rb
|
@@ -127,15 +134,19 @@ test_files:
|
|
127
134
|
- spec/cassettes/serp_metrics__command_sets__keywords/check_retrieves_checks.yml
|
128
135
|
- spec/cassettes/serp_metrics__command_sets__keywords/remove_removes_keyword.yml
|
129
136
|
- spec/cassettes/serp_metrics__command_sets__keywords/serp_retrieves_serp_for_check.yml
|
130
|
-
- spec/cassettes/
|
131
|
-
- spec/cassettes/
|
132
|
-
- spec/cassettes/
|
137
|
+
- spec/cassettes/serp_metrics__command_sets__queues__delayed/add_with_location_adds_delayed.yml
|
138
|
+
- spec/cassettes/serp_metrics__command_sets__queues__delayed/add_without_location_adds_delayed.yml
|
139
|
+
- spec/cassettes/serp_metrics__command_sets__queues__delayed/get_checks_delayed.yml
|
140
|
+
- spec/cassettes/serp_metrics__command_sets__queues__priority/add_with_location_adds_priority.yml
|
141
|
+
- spec/cassettes/serp_metrics__command_sets__queues__priority/add_without_location_adds_priority.yml
|
142
|
+
- spec/cassettes/serp_metrics__command_sets__queues__priority/get_checks_priority.yml
|
133
143
|
- spec/lib/serp_metrics/client_spec.rb
|
134
144
|
- spec/lib/serp_metrics/command_sets/account_spec.rb
|
135
145
|
- spec/lib/serp_metrics/command_sets/engines_spec.rb
|
136
146
|
- spec/lib/serp_metrics/command_sets/flux_spec.rb
|
137
147
|
- spec/lib/serp_metrics/command_sets/keywords_spec.rb
|
138
|
-
- spec/lib/serp_metrics/command_sets/
|
148
|
+
- spec/lib/serp_metrics/command_sets/queues/delayed_spec.rb
|
149
|
+
- spec/lib/serp_metrics/command_sets/queues/priority_spec.rb
|
139
150
|
- spec/lib/serp_metrics/commands_spec.rb
|
140
151
|
- spec/lib/serp_metrics/response_spec.rb
|
141
152
|
- spec/lib/serp_metrics/version_spec.rb
|