al_papi 0.0.15 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -9,19 +9,62 @@ A wrapper around the Partner API calls. Allows post, priority post and get calls
9
9
 
10
10
  gem install 'al_papi'
11
11
 
12
- ## Usage
12
+ ## Configuration
13
13
 
14
- Make a request object using your api key:
14
+ Set configuration options to be used on requests:
15
15
 
16
16
  require 'al_papi'
17
17
 
18
- req = AlPapi::Request.new(api_key: 'yR43BtBDjadfavMy6a6aK0')
18
+ AlPapi.configure do |config|
19
+ config.api_key = 'yR43BtBDjadfavMy6a6aK0'
20
+ end
21
+
22
+ ## Account
23
+
24
+ Account endpoint lets you get basic info about your account, current queue times and any system messages.
25
+
26
+ # Pass your account ID into the info method
27
+ res = AlPapi::Account.info '1'
28
+
29
+ # Response body will be JSON response
30
+ res.body
31
+
32
+ # You can use the parsed_body method for convenience to access data
33
+ account_info = @res.parsed_body
34
+ account_info.user.current_balance # 500.00
35
+ account_info.queue.bing_time # 15
36
+ account_info.messages.system # ['The system is back online!']
37
+
38
+ Example response in JSON
39
+
40
+ {
41
+ "messages": {
42
+ "system": ['The system is back online!']
43
+ },
44
+ "queue": {
45
+ "bing_time": 15,
46
+ "google_time": 3,
47
+ "yahoo_time": 2
48
+ },
49
+ "user": {
50
+ "current_balance": 500.00,
51
+ "current_get_count": 2000,
52
+ "current_post_count": 1000,
53
+ "hourly_get_limit": 2000,
54
+ "hourly_post_limit": 1000
55
+ }
56
+ }
57
+
58
+ ## Keywords
59
+
60
+ Keywords endpoint allows you to POST keywords you want SERPs for and to GET those results
61
+ when they are ready.
19
62
 
20
63
  ### POST
21
64
 
22
65
  Post your keyword-engine-locale combination to the API:
23
66
 
24
- res = req.post keyword: "Centaur Love'n", engine: 'google', locale: 'en-us'
67
+ res = AlPapi::Keyword.post keyword: "Centaur Love'n", engine: 'google', locale: 'en-us'
25
68
 
26
69
  if res.success?
27
70
  p 'Centaur High Hoof'
@@ -33,7 +76,7 @@ Post your keyword-engine-locale combination to the API:
33
76
 
34
77
  Post your keyword to the priority queue if you need results in a more timely manner:
35
78
 
36
- res = req.priority_post keyword: "Mad Scientist", engine: 'bing', locale: 'en-ca'
79
+ res = AlPapi::Keyword.priority_post keyword: "Mad Scientist", engine: 'bing', locale: 'en-ca'
37
80
 
38
81
  if res.success?
39
82
  p 'Canadian Bing Scientist Time'
@@ -45,7 +88,7 @@ Post your keyword to the priority queue if you need results in a more timely man
45
88
 
46
89
  When you are ready to get your results you can do a GET request for your keyword-engine-locale combo:
47
90
 
48
- res = req.get keyword: "Mad Scientist", engine: 'bing', locale: 'en-ca'
91
+ res = AlPapi::Keyword.get keyword: "Mad Scientist", engine: 'bing', locale: 'en-ca'
49
92
 
50
93
  if res.success?
51
94
  p 'Canadian Bing Scientist Time'
@@ -82,6 +125,11 @@ When making an API request a response object is returned with any errors, http r
82
125
  # On GET requests the body will be a hash of your results if successful.
83
126
  res.body
84
127
 
128
+ # Parsed Body:
129
+ # Returns the parsed JSON body, if present, as a Hashie::Mash object.
130
+ # This can be useful to get an object with methods to call instead of
131
+ # indexing into nested hashes.
132
+
85
133
  # Code:
86
134
  # Returns http response code.
87
135
  # 204: On GET requests when no data is available yet
@@ -98,6 +146,30 @@ When making an API request a response object is returned with any errors, http r
98
146
  # Returns true or false if your account has been suspended
99
147
  res.suspended?
100
148
 
149
+ ## Web Insight
150
+
151
+ ### Description
152
+
153
+ Web Insight queue takes a URL for the Partner API to scrape and parse out high level insight about the page
154
+ and return the results to your callback URL passed in or set for your account.
155
+
156
+ ### POST
157
+
158
+ Post the URL of the page you want to gain insight into and the callback URL knowing when your results are
159
+ ready to get.
160
+
161
+ res = AlPapi::WebInsight.post url: 'http://www.qwiki.com', callback: 'http://your-callback-url.com'
162
+
163
+ ### GET
164
+
165
+ When your results are ready to get you will receive a callback that contains the information on how
166
+ to get the insight on your URL. In the callback you should receive a date_created and time_created to use
167
+ in your get request. You will also use your original URL posted.
168
+
169
+ res = AlPapi::WebInsight.get url: 'http://www.qwiki.com', date_created: '2012-06-14', time_created: '01:50'
170
+
171
+ ## Extras
172
+
101
173
  ### Engines
102
174
 
103
175
  Supported engines are Google, Yahoo and Bing. To get a list of supported engines run the following:
@@ -109,9 +181,44 @@ Supported engines are Google, Yahoo and Bing. To get a list of supported engines
109
181
  Supported locales differ by the engine being used. In order to make sure you are using a supported locale
110
182
  for the engine you are posting a keyword to there is a locales class to help you:
111
183
 
112
- AlPapi::Locales.supported # returns an array of locales for the default engine Google
113
- AlPapi::Locales.supported 'bing' # for other engines pass in the engine name
114
- AlPapi::Locales.supported 'yahoo'
184
+ ### Supported
185
+
186
+ A way to see all the supported locales for a specified engine
187
+
188
+ AlPapi::Locales.supported # defaults to google
189
+
190
+ Example response
191
+
192
+ {
193
+ engine: google
194
+ locales: {
195
+ ko-kr: {
196
+ description: Korea - Korean
197
+ tld: http://www.google.co.kr
198
+ },
199
+ ...
200
+ el-gr: {
201
+ description: Greece - Greek
202
+ tld: http://www.google.gr
203
+ }
204
+ }
205
+ supported: true
206
+ }
207
+
208
+ ### Description
209
+
210
+ You can query the API to see if a specific locale is supported for an engine and get a description of that locale.
211
+
212
+ AlPapi::Locales.description 'google', 'ko-kr'
213
+
214
+ Example response
215
+
216
+ {
217
+ locale: ko-kr
218
+ description: Korea - Korean
219
+ supported: true
220
+ engine: google
221
+ }
115
222
 
116
223
  ## License
117
224
 
data/lib/al_papi.rb CHANGED
@@ -3,15 +3,39 @@ require 'rest-client'
3
3
  require 'net/http'
4
4
  require 'hashie'
5
5
 
6
- module AlPapi
7
-
8
- end
9
-
6
+ require File.dirname(__FILE__) + '/al_papi/account'
10
7
  require File.dirname(__FILE__) + '/al_papi/config'
8
+ require File.dirname(__FILE__) + '/al_papi/engines'
11
9
  require File.dirname(__FILE__) + '/al_papi/http'
12
- require File.dirname(__FILE__) + '/al_papi/request'
10
+ require File.dirname(__FILE__) + '/al_papi/keyword'
11
+ require File.dirname(__FILE__) + '/al_papi/locales'
13
12
  require File.dirname(__FILE__) + '/al_papi/request_error'
14
13
  require File.dirname(__FILE__) + '/al_papi/response'
15
- require File.dirname(__FILE__) + '/al_papi/locales'
16
- require File.dirname(__FILE__) + '/al_papi/engines'
17
14
  require File.dirname(__FILE__) + '/al_papi/web_insight'
15
+
16
+ module AlPapi
17
+
18
+ extend self
19
+
20
+ ##
21
+ # @example Configure takes block to set API key to be used in API calls.
22
+ # AlPapi.configure do |config|
23
+ # config.api_key = 'my-key'
24
+ # end
25
+
26
+ def configure
27
+ yield config
28
+ end
29
+
30
+ #
31
+ # @return [AlPapi::Config]
32
+
33
+ def config
34
+ @config ||= Config.new
35
+ end
36
+
37
+ def http # @private
38
+ Http.new(config)
39
+ end
40
+
41
+ end
@@ -0,0 +1,17 @@
1
+ module AlPapi
2
+
3
+ class Account
4
+
5
+ ##
6
+ # Details for your account including hourly POST/GET limits, current queue times and current balance.
7
+ # Also includes any system messages posted about the API.
8
+ #
9
+ # @param account_id [String] *Required* - Your account ID in the Partner API
10
+
11
+ def self.info(account_id)
12
+ AlPapi.http.get "/account/#{account_id}"
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -1,23 +1,25 @@
1
1
  module AlPapi
2
2
 
3
+ ##
4
+ #
5
+ # Config class used internally.
6
+ # Configure API calls using AlPapi.configure
7
+
3
8
  class Config
4
9
 
5
10
  DEFAULT_HOST = 'http://api.authoritylabs.com'
6
- DEFAULT_PORT = 80
11
+ DEFAULT_PORT = 80 # @private
7
12
 
8
13
  attr_accessor :api_key
9
- attr_reader :host, :port
14
+ attr_reader :host, :port # @private
10
15
 
11
16
  ##
12
17
  #
13
- # == Options
14
- #
15
- # [auth_key] Your Partner API api key. Required to make any API requests
18
+ # @private
16
19
 
17
- def initialize(options = {})
18
- @api_key = options[:api_key]
19
- @host = DEFAULT_HOST
20
- @port = DEFAULT_PORT
20
+ def initialize
21
+ @host = DEFAULT_HOST
22
+ @port = DEFAULT_PORT
21
23
  end
22
24
 
23
25
  end
@@ -2,8 +2,13 @@ module AlPapi
2
2
 
3
3
  class Engines
4
4
 
5
+ ##
6
+ # Supported engines for Partner API.
7
+ #
8
+ # @return [Array] Supported engines.
9
+
5
10
  def self.all
6
- %w(google bing yahoo)
11
+ %w[google bing yahoo]
7
12
  end
8
13
 
9
14
  end
data/lib/al_papi/http.rb CHANGED
@@ -16,10 +16,8 @@ module AlPapi
16
16
  request 'post', path, build_params(params)
17
17
  end
18
18
 
19
- def build_params(params = nil)
20
- return nil if params.empty?
21
- return nil unless params.is_a?(Hash)
22
- params.merge(auth_token: @config.api_key, format: 'json')
19
+ def build_params(params = {})
20
+ params.merge(:auth_token => @config.api_key, :format => 'json')
23
21
  end
24
22
 
25
23
  def request(http_verb, path, params = nil)
@@ -0,0 +1,45 @@
1
+ module AlPapi
2
+
3
+ class Keyword
4
+
5
+ ##
6
+ #
7
+ # POST a keyword/engine/locale combination to get SERP for.
8
+ #
9
+ # @param keyword [String] *Required* - The keyword you are ready to get results for.
10
+ # @param engine [String] _Optional_ - Defaults to google
11
+ # @param locale [String] _Optional_ - Defaults to en-us. See {AlPapi::Locales} for supported locales.
12
+ # @param pages_from [String] _Optional_ - Defaults is false. Google specific parameter to get results from locale passed in when set to true.
13
+ # @param callback [String] _Optional_ - Default is the callback you have set for your account. Set specific callbacks per request by using this paramerter. A POST is sent to this callback URL when results are returned.
14
+
15
+ def self.post(params = {}, priority = false)
16
+ path = priority ? '/keywords/priority' : '/keywords'
17
+ AlPapi.http.post path, params
18
+ end
19
+
20
+ ##
21
+ #
22
+ # See post method {AlPapi::Keyword.post} for required params
23
+
24
+ def self.priority_post(params = {})
25
+ post params, true
26
+ end
27
+
28
+ ##
29
+ #
30
+ # Get SERP results for keyword already POSTed or in Partner API already.
31
+ # See parameters for what can be passed in.
32
+ #
33
+ # @param keyword [String] *Required* - The keyword you are ready to get results for.
34
+ # @param engine [String] _Optional_ - Defaults to google
35
+ # @param locale [String] _Optional_ - Defaults to en-us. See {AlPapi::Locales} for supported locales.
36
+ # @param rank_date [String] _Optional_ - Defaults to today UTC time. Format of YYY-MM-DD ie. 2011-12-28
37
+ # @param data_format [String] _Optional_ - Default is JSON. If you want raw html pass "html" in for data_format
38
+
39
+ def self.get(params = {})
40
+ AlPapi.http.get '/keywords/get', params
41
+ end
42
+
43
+ end
44
+
45
+ end
@@ -2,224 +2,23 @@ module AlPapi
2
2
 
3
3
  class Locales
4
4
 
5
- GOOGLE_LOCALES = [
6
- 'af-za',
7
- 'ar-ae',
8
- 'ar-bh',
9
- 'ar-il',
10
- 'ar-qa',
11
- 'ar-sa',
12
- 'ar-tn',
13
- 'bg-bg',
14
- 'ca-ct',
15
- 'cs-cz',
16
- 'da-dk',
17
- 'de-at',
18
- 'de-be',
19
- 'de-ch',
20
- 'de-de',
21
- 'de-ro',
22
- 'el-gr',
23
- 'en-ae',
24
- 'en-au',
25
- 'en-be',
26
- 'en-bh',
27
- 'en-ca',
28
- 'en-hk',
29
- 'en-id',
30
- 'en-ie',
31
- 'en-il',
32
- 'en-in',
33
- 'en-mt',
34
- 'en-my',
35
- 'en-ng',
36
- 'en-nz',
37
- 'en-ph',
38
- 'en-sa',
39
- 'en-sg',
40
- 'en-th',
41
- 'en-tw',
42
- 'en-ua',
43
- 'en-uk',
44
- 'en-us',
45
- 'en-vn',
46
- 'en-qa',
47
- 'en-za',
48
- 'es-ar',
49
- 'es-cl',
50
- 'es-co',
51
- 'es-es',
52
- 'es-mx',
53
- 'es-pe',
54
- 'es-pr',
55
- 'es-us',
56
- 'es-ve',
57
- 'et-ee',
58
- 'fi-fl',
59
- 'fr-be',
60
- 'fr-ca',
61
- 'fr-ch',
62
- 'fr-fr',
63
- 'fr-tn',
64
- 'fr-vn',
65
- 'ga-ie',
66
- 'ha-ng',
67
- 'he-il',
68
- 'hi-in',
69
- 'hr-hr',
70
- 'hu-hu',
71
- 'hu-ro',
72
- 'id-id',
73
- 'ie-en',
74
- 'ig-ng',
75
- 'it-ch',
76
- 'it-it',
77
- 'ja-jp',
78
- 'jw-id',
79
- 'ko-kr',
80
- 'lt-lt',
81
- 'lt-lv',
82
- 'lv-lv',
83
- 'mi-nz',
84
- 'ms-my',
85
- 'ms-sg',
86
- 'mt-mt',
87
- 'nl-be',
88
- 'nl-nl',
89
- 'no-no',
90
- 'pl-pl',
91
- 'pt-br',
92
- 'pt-pt',
93
- 'rm-ch',
94
- 'ro-ro',
95
- 'ru-et',
96
- 'ru-lv',
97
- 'ru-ru',
98
- 'ru-ua',
99
- 'sl-si',
100
- 'sk-sk',
101
- 'sr-rs',
102
- 'sv-fi',
103
- 'sv-se',
104
- 'ta-sg',
105
- 'th-th',
106
- 'tl-ph',
107
- 'tr-tr',
108
- 'uk-ua',
109
- 'vi-vn',
110
- 'xh-za',
111
- 'yo-ng',
112
- 'zh-cn-hk',
113
- 'zh-hk-hk',
114
- 'zh-cn-sg',
115
- 'zh-cn-tw',
116
- 'zh-cn-vn',
117
- 'zh-tw-tw',
118
- 'zu-za'
119
- ]
120
-
121
- YAHOO_LOCALES = [
122
- 'da-dk',
123
- 'de-at',
124
- 'de-ch',
125
- 'de-de',
126
- 'el-gr',
127
- 'en-au',
128
- 'en-ca',
129
- 'en-ie',
130
- 'en-in',
131
- 'en-my',
132
- 'en-nz',
133
- 'en-ph',
134
- 'en-sg',
135
- 'en-tw',
136
- 'en-uk',
137
- 'en-us',
138
- 'es-ar',
139
- 'es-cl',
140
- 'es-co',
141
- 'es-es',
142
- 'es-mx',
143
- 'es-pe',
144
- 'es-us',
145
- 'es-ve',
146
- 'fi-fl',
147
- 'fr-ca',
148
- 'fr-ch',
149
- 'fr-fr',
150
- 'id-id',
151
- 'it-ch',
152
- 'it-it',
153
- 'ja-jp',
154
- 'ko-kr',
155
- 'kr-kr',
156
- 'nl-nl',
157
- 'no-no',
158
- 'pt-br',
159
- 'ro-ro',
160
- 'ru-ru',
161
- 'sv-se',
162
- 'th-th',
163
- 'tr-tr',
164
- 'vi-vn',
165
- 'zh-cn',
166
- 'zh-cn-tw',
167
- 'zh-hk'
168
- ]
169
-
170
- BING_LOCALES = [
171
- 'ar-sa',
172
- 'de-at',
173
- 'de-ch',
174
- 'de-de',
175
- 'da-dk',
176
- 'en-au',
177
- 'en-ca',
178
- 'en-ch',
179
- 'en-ie',
180
- 'en-in',
181
- 'en-nz',
182
- 'en-sa',
183
- 'en-sg',
184
- 'en-uk',
185
- 'en-us',
186
- 'es-ar',
187
- 'es-co',
188
- 'es-cl',
189
- 'es-es',
190
- 'es-mx',
191
- 'es-pe',
192
- 'es-us',
193
- 'es-ve',
194
- 'fr-ca',
195
- 'fr-ch',
196
- 'fr-fr',
197
- 'it-ch',
198
- 'it-it',
199
- 'ja-jp',
200
- 'ms-my',
201
- 'nl-be',
202
- 'nl-nl',
203
- 'no-no',
204
- 'pt-br',
205
- 'rm-ch',
206
- 'ru-ru',
207
- 'sv-se',
208
- 'tl-ph',
209
- 'vi-vn',
210
- 'zh-cn',
211
- 'zh-cn-tw',
212
- 'zh-hk'
213
- ]
214
-
215
5
  ##
216
6
  #
217
- # [engine] Defaults to google. Returns Partner API supported locales.
218
- # Allowed engines are google, bing, yahoo.
7
+ # Get supported locales for specified engine.
8
+ # @param engine [String] Defaults to google. Returns Partner API supported locales for engine or not supported message.
219
9
 
220
10
  def self.supported(engine = 'google')
221
- return [] unless AlPapi::Engines.all.include?(engine.downcase)
222
- self.const_get("#{engine.upcase}_LOCALES")
11
+ AlPapi.http.get "/supported/#{engine}"
12
+ end
13
+
14
+ ##
15
+ #
16
+ # Get further metadata on a specific locale for an engine.
17
+ # @param engine [String] Defaults to google.
18
+ # @param locale [String] Defaults to en-us.
19
+
20
+ def self.description(engine = 'google', locale = 'en-us')
21
+ AlPapi.http.get "/supported/#{engine}/#{locale.downcase}"
223
22
  end
224
23
 
225
24
  end
@@ -3,7 +3,7 @@ module AlPapi
3
3
  class RequestError
4
4
 
5
5
  attr_reader :message, :code, :path, :params
6
-
6
+
7
7
  def initialize(_message, _code, _path, _params) # @private
8
8
  @message, @code, @path, @params = _message, _code, _path, _params
9
9
  end
@@ -4,6 +4,11 @@ module AlPapi
4
4
 
5
5
  attr_reader :success, :body, :errors, :code, :path, :params, :over_limit, :suspeneded
6
6
 
7
+ ##
8
+ # Initializing response object to be returned from API calls, used internally.
9
+ #
10
+ # @private
11
+
7
12
  def initialize(http, _code, _path, _params) # @private
8
13
  @success, @body, @errors = http.success, http.response, http.errors
9
14
  @over_limit, @suspended = http.over_limit, http.suspended
@@ -13,25 +18,38 @@ module AlPapi
13
18
  ##
14
19
  #
15
20
  # Convenience method to determine if request was successfull or not
21
+ # @return [Boolean]
16
22
 
17
23
  def success?
18
- return @success
24
+ !!@success
19
25
  end
20
26
 
21
27
  ##
22
28
  #
23
29
  # Convenience method to see if you have reached your hourly limit
30
+ # @return [Boolean]
24
31
 
25
32
  def over_limit?
26
- return @over_limit
33
+ !!@over_limit
27
34
  end
28
35
 
29
36
  ##
30
37
  #
31
38
  # Convenience method to see if your account is supended
39
+ # @return [Boolean]
32
40
 
33
41
  def suspended?
34
- return @suspended
42
+ !!@suspended
43
+ end
44
+
45
+ ##
46
+ #
47
+ # Parses JSON body of request and returns a Hashie::Mash
48
+ # @return [Hashie::Mash]
49
+
50
+ def parsed_body
51
+ hash = JSON.parse(@body) rescue {}
52
+ Hashie::Mash.new hash
35
53
  end
36
54
 
37
55
  end
@@ -2,64 +2,45 @@ module AlPapi
2
2
 
3
3
  class WebInsight
4
4
 
5
- attr_reader :config
6
-
7
5
  ##
8
- #
9
- # [config] * Hash { auth_key: 'your_auth_token' }
10
- # * OR AlPapi::Config
11
-
12
- def initialize(config)
13
- @config = config.is_a?(AlPapi::Config) ? config : Config.new(config)
14
- @success, @errors = false, []
15
- end
16
-
17
- def http # @private
18
- Http.new(@config)
19
- end
20
-
21
- ##
22
- # == Params
23
6
  #
24
7
  # URL for the page you want insight into and the callback url you have implemented to know
25
8
  # when results are ready to get.
26
9
  #
27
- # [url] <b>Required</b> -
28
- # The web page you want to gain insight on.
29
- # [callback] <em>Required</em> -
30
- # Default is set on your account through the website.
31
- # Set specific callbacks here for each request. Callback a url that
32
- # is sent a POST when results are returned.
10
+ # @param url [String] *Required* - The web page you want to gain insight on.
11
+ # @param callback [String] *Required* - Default is the callback you have set for your account. Set specific callbacks per request by using this paramerter. A POST is sent to this callback URL when results are returned.
12
+ # @raise [] When required parameter is not found.
33
13
 
34
- def post(params = {}, priority = false)
14
+ def self.post(params = {})
35
15
  check_params Hashie::Mash.new(params), *%w[url callback]
36
- http.post '/web/insight', params
16
+ AlPapi.http.post '/web/insight', params
37
17
  end
38
18
 
39
19
  ##
40
- # == Params
41
20
  #
42
- # Parameters should be the same url as what was posted to the Partner API and the
21
+ # Parameters should be the same url as what was posted to the Partner API and the
43
22
  # date_created and time_created values passed back to you via the callback posted.
44
23
  #
45
- # [url] <b>Required</b> -
46
- # The URL originally posted to Partner API
47
- # [date_created] <em>Required</em> -
48
- # The date_created that was returned in the callback.
49
- # [time_created] <em>Required</em> -
50
- # The time_created that was returned in the callback.
24
+ # @param url [String] *Required* - The URL originally posted to Partner API
25
+ # @param date_created [String] *Required* - The date_created that was returned in the callback.
26
+ # @param time_created [String] *Required* - The time_created that was returned in the callback.
51
27
 
52
- def get(params = {})
28
+ def self.get(params = {})
53
29
  check_params Hashie::Mash.new(params), *%w[date_created time_created]
54
- http.get '/web/insight', params
30
+ AlPapi.http.get '/web/insight', params
55
31
  end
56
32
 
57
- def check_params(params, *param)
33
+ ##
34
+ #
35
+ # Check if required params exist
36
+ # @private
37
+
38
+ def self.check_params(params, *param)
58
39
  param.each do |p|
59
40
  raise "#{p} parameter is required." if params[p].nil? || params[p.to_s].empty?
60
41
  end
61
42
  end
62
43
 
63
44
  end
64
-
45
+
65
46
  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.15
4
+ version: 1.0.0
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: 2012-01-05 00:00:00.000000000 Z
12
+ date: 2012-10-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &70322796432540 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 1.6.7
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70322796432540
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 1.6.7
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: hashie
27
- requirement: &70322796431940 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,15 @@ dependencies:
32
37
  version: '2.0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70322796431940
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '2.0'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &70322796431440 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ! '>='
@@ -43,7 +53,60 @@ dependencies:
43
53
  version: '2.0'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *70322796431440
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: simplecov
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: 0.7.1
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.7.1
78
+ - !ruby/object:Gem::Dependency
79
+ name: vcr
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: 2.2.5
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: 2.2.5
94
+ - !ruby/object:Gem::Dependency
95
+ name: webmock
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 1.8.11
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 1.8.11
47
110
  description: Wraps AuthorityLabs Partner API calls in a gem.
48
111
  email: ''
49
112
  executables: []
@@ -51,15 +114,16 @@ extensions: []
51
114
  extra_rdoc_files:
52
115
  - README.md
53
116
  files:
54
- - lib/al_papi.rb
117
+ - lib/al_papi/account.rb
55
118
  - lib/al_papi/config.rb
56
119
  - lib/al_papi/engines.rb
57
120
  - lib/al_papi/http.rb
121
+ - lib/al_papi/keyword.rb
58
122
  - lib/al_papi/locales.rb
59
123
  - lib/al_papi/request_error.rb
60
- - lib/al_papi/request.rb
61
124
  - lib/al_papi/response.rb
62
125
  - lib/al_papi/web_insight.rb
126
+ - lib/al_papi.rb
63
127
  - README.md
64
128
  homepage: http://github.com/mtchavez/al_papi
65
129
  licenses: []
@@ -82,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
146
  version: '0'
83
147
  requirements: []
84
148
  rubyforge_project:
85
- rubygems_version: 1.8.17
149
+ rubygems_version: 1.8.24
86
150
  signing_key:
87
151
  specification_version: 3
88
152
  summary: AuthorityLabs Partner API Wrapper
@@ -1,75 +0,0 @@
1
- module AlPapi
2
-
3
- class Request
4
-
5
- attr_reader :config
6
-
7
- ##
8
- #
9
- # [config] * Hash { auth_key: 'your_auth_token' }
10
- # * OR AlPapi::Config
11
-
12
- def initialize(config)
13
- @config = config.is_a?(AlPapi::Config) ? config : Config.new(config)
14
- @success, @errors = false, []
15
- end
16
-
17
- def http # @private
18
- Http.new(@config)
19
- end
20
-
21
- ##
22
- # == Params
23
- #
24
- # [keyword] <b>Required</b> -
25
- # Your keyword you want to get results for
26
- # [engine] <em>Optional</em> -
27
- # Defaults to google. Allowed engines are google, yahoo, bing.
28
- # [locale] <em>Optional</em> -
29
- # Defaults to en-us. See AlPapi::Locales for supported locales.
30
- # [pages_from] <em>Optional</em> -
31
- # Default is false. Google specific parameter to get results from
32
- # the locale passed in when set to true.
33
- # [callback] <em>Optional</em> -
34
- # Default is set on your account through the website.
35
- # Set specific callbacks here for each request. Callback a url that
36
- # is sent a POST when results are returned.
37
-
38
- def post(params = {}, priority = false)
39
- path = priority ? '/keywords/priority' : '/keywords'
40
- http.post path, params
41
- end
42
-
43
- ##
44
- # == Params
45
- #
46
- # See post for required params
47
-
48
- def priority_post(params = {})
49
- post params, true
50
- end
51
-
52
- ##
53
- # == Params
54
- #
55
- # Parameters should be the same as what was posted to the Partner API where applies.
56
- #
57
- # [keyword] <b>Required</b> -
58
- # The keyword you are ready to get results for.
59
- # [engine] <em>Optional</em> -
60
- # Defaults to google. Allowed engines are google, yahoo, bing.
61
- # [locale] <em>Optional</em> -
62
- # Defaults to en-us. See AlPapi::Locales for supported locales.
63
- # [rank_date] <em>Optional</em> -
64
- # Default is set to today UTC time.
65
- # Date should be in format of YYYY-MM-DD ie. 2011-12-28
66
- # [data_format] <em>Optional</em> -
67
- # Default is JSON. Options are HTML or JSON.
68
-
69
- def get(params = {})
70
- http.get '/keywords/get', params
71
- end
72
-
73
- end
74
-
75
- end