al_papi 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +75 -0
- data/lib/al_papi/http.rb +1 -1
- data/lib/al_papi/request.rb +1 -1
- data/lib/al_papi/request_error.rb +1 -1
- data/lib/al_papi/response.rb +1 -1
- metadata +9 -9
- data/README.rdoc +0 -27
data/README.md
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
AuthorityLabs Partner API Gem
|
2
|
+
=============================
|
3
|
+
|
4
|
+
A wrapper around the Partner API calls. Allows post, priority post and get calls.
|
5
|
+
|
6
|
+
* Github: http://github.com/mtchavez/al_papi
|
7
|
+
|
8
|
+
## Install
|
9
|
+
|
10
|
+
gem install 'al_papi'
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
Make a request object using your api key:
|
15
|
+
|
16
|
+
require 'al_papi'
|
17
|
+
|
18
|
+
req = AlPapi::Request.new(api_key: 'yR43BtBDjadfavMy6a6aK0')
|
19
|
+
|
20
|
+
### POST
|
21
|
+
|
22
|
+
Post your keyword-engine-locale combination to the API:
|
23
|
+
|
24
|
+
res = req.post keyword: "Centaur Love'n", engine: 'google', locale: 'en-us'
|
25
|
+
|
26
|
+
if res.success?
|
27
|
+
p 'Centaur High Hoof'
|
28
|
+
else
|
29
|
+
p 'PAPI Fail'
|
30
|
+
end
|
31
|
+
|
32
|
+
### Priority POST
|
33
|
+
|
34
|
+
Post your keyword to the priority queue if you need results in a more timely manner:
|
35
|
+
|
36
|
+
res = req.priority_post keyword: "Mad Scientist", engine: 'bing', locale: 'en-ca'
|
37
|
+
|
38
|
+
if res.success?
|
39
|
+
p 'Canadian Bing Scientist Time'
|
40
|
+
else
|
41
|
+
p 'PAPI Fail'
|
42
|
+
end
|
43
|
+
|
44
|
+
### GET
|
45
|
+
|
46
|
+
When you are ready to get your results you can do a GET request for your keyword-engine-locale combo:
|
47
|
+
res = req.post keyword: "Mad Scientist", engine: 'bing', locale: 'en-ca'
|
48
|
+
|
49
|
+
if res.success?
|
50
|
+
p 'Canadian Bing Scientist Time'
|
51
|
+
res.body # Hash of your results for that keyword-engine-locale
|
52
|
+
else
|
53
|
+
p 'PAPI Fail'
|
54
|
+
end
|
55
|
+
|
56
|
+
### Engines
|
57
|
+
|
58
|
+
Supported engines are Google, Yahoo and Bing. To get a list of supported engines run the following:
|
59
|
+
|
60
|
+
AlPapi::Engines.all
|
61
|
+
|
62
|
+
### Locales
|
63
|
+
|
64
|
+
Supported locales differ by the engine being used. In order to make sure you are using a supported locale
|
65
|
+
for the engine you are posting a keyword to there is a locales class to help you:
|
66
|
+
|
67
|
+
AlPapi::Locales.supported # returns an array of locales for the default engine Google
|
68
|
+
AlPapi::Locales.supported 'bing' # for other engines pass in the engine name
|
69
|
+
AlPapi::Locales.supported 'yahoo'
|
70
|
+
|
71
|
+
## License
|
72
|
+
|
73
|
+
Written by Chavez
|
74
|
+
|
75
|
+
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
|
data/lib/al_papi/http.rb
CHANGED
data/lib/al_papi/request.rb
CHANGED
data/lib/al_papi/response.rb
CHANGED
@@ -4,7 +4,7 @@ module AlPapi
|
|
4
4
|
|
5
5
|
attr_reader :success, :body, :errors, :code, :path, :params
|
6
6
|
|
7
|
-
def initialize(http, _code, _path, _params) #
|
7
|
+
def initialize(http, _code, _path, _params) # @private
|
8
8
|
@success, @body, @errors = http.success, http.response, http.errors
|
9
9
|
@code, @path, @params = _code, _path, _params
|
10
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: al_papi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &70322318185480 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.6.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70322318185480
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rspec
|
27
|
-
requirement: &
|
27
|
+
requirement: &70322318184620 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,13 +32,13 @@ dependencies:
|
|
32
32
|
version: '2.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70322318184620
|
36
36
|
description: Wraps AuthorityLabs Partner API calls in a gem.
|
37
37
|
email: ''
|
38
38
|
executables: []
|
39
39
|
extensions: []
|
40
40
|
extra_rdoc_files:
|
41
|
-
- README.
|
41
|
+
- README.md
|
42
42
|
files:
|
43
43
|
- lib/al_papi.rb
|
44
44
|
- lib/al_papi/config.rb
|
@@ -48,12 +48,12 @@ files:
|
|
48
48
|
- lib/al_papi/request_error.rb
|
49
49
|
- lib/al_papi/request.rb
|
50
50
|
- lib/al_papi/response.rb
|
51
|
-
- README.
|
51
|
+
- README.md
|
52
52
|
homepage: http://github.com/mtchavez/al_papi
|
53
53
|
licenses: []
|
54
54
|
post_install_message:
|
55
55
|
rdoc_options:
|
56
|
-
- --charset=UTF-8
|
56
|
+
- --charset=UTF-8 --main=README.md
|
57
57
|
require_paths:
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README.rdoc
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
= AuthorityLabs Partner API Gem
|
2
|
-
|
3
|
-
A wrapper around the Partner API calls. Allows post, priority post and get calls.
|
4
|
-
|
5
|
-
* Github: http://github.com/mtchavez/al_papi
|
6
|
-
|
7
|
-
== Install:
|
8
|
-
|
9
|
-
gem install 'al_papi'
|
10
|
-
|
11
|
-
== Usage:
|
12
|
-
|
13
|
-
require 'al_papi'
|
14
|
-
|
15
|
-
req = AlPapi::Request.new(api_key: 'yR43BtBDjadfavMy6a6aK0')
|
16
|
-
|
17
|
-
req.post { :keyword => 'Centaurs', :locale => 'en-us', :engine => 'google' }
|
18
|
-
|
19
|
-
req.get { :keyword => 'Centaurs', :locale => 'en-us', :engine => 'google' }
|
20
|
-
|
21
|
-
req.priority_post { :keyword => 'Centaurs', :locale => 'en-us', :engine => 'google' }
|
22
|
-
|
23
|
-
== License
|
24
|
-
|
25
|
-
Written by Chavez
|
26
|
-
|
27
|
-
Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
|