linkemperor-api 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/linkemperor-api/customers.rb +103 -40
- data/lib/linkemperor-api/vendors.rb +35 -10
- data/lib/linkemperor-api/version.rb +1 -1
- metadata +2 -2
@@ -1,9 +1,10 @@
|
|
1
|
+
|
1
2
|
require 'net/http'
|
2
3
|
require 'uri'
|
3
4
|
require 'json'
|
4
5
|
|
5
6
|
class LinkemperorCustomer
|
6
|
-
class
|
7
|
+
class LinkemperorCustomerException < RuntimeError
|
7
8
|
end
|
8
9
|
|
9
10
|
def initialize(api_key, base_path = nil)
|
@@ -17,7 +18,7 @@ class LinkemperorCustomer
|
|
17
18
|
if result.is_a?(Net::HTTPSuccess)
|
18
19
|
JSON.parse(result.body)
|
19
20
|
else
|
20
|
-
raise
|
21
|
+
raise LinkemperorCustomerException.new result.body
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -50,7 +51,7 @@ class LinkemperorCustomer
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
else
|
53
|
-
raise
|
54
|
+
raise LinkemperorCustomerException.new result.body
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
@@ -67,7 +68,7 @@ class LinkemperorCustomer
|
|
67
68
|
# - id: Article ID
|
68
69
|
def get_articles_by_id(id)
|
69
70
|
if id.nil?
|
70
|
-
raise
|
71
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
71
72
|
end
|
72
73
|
exec_get("#{@base_path}/api/v2/customers/articles/#{id}.json?api_key=#{@api_key}")
|
73
74
|
end
|
@@ -79,15 +80,15 @@ class LinkemperorCustomer
|
|
79
80
|
# - body: Article Body (Spintax OK)
|
80
81
|
def create_article(campaign_id, title, body)
|
81
82
|
if campaign_id.nil?
|
82
|
-
raise
|
83
|
+
raise LinkemperorCustomerException.new('campaign_id should not be empty')
|
83
84
|
end
|
84
85
|
|
85
86
|
if title.nil?
|
86
|
-
raise
|
87
|
+
raise LinkemperorCustomerException.new('title should not be empty')
|
87
88
|
end
|
88
89
|
|
89
90
|
if body.nil?
|
90
|
-
raise
|
91
|
+
raise LinkemperorCustomerException.new('body should not be empty')
|
91
92
|
end
|
92
93
|
parameters = {'article' => {'campaign_id' => campaign_id, 'title' => title, 'body' => body}}
|
93
94
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/articles.json?api_key=#{@api_key}")
|
@@ -98,7 +99,7 @@ class LinkemperorCustomer
|
|
98
99
|
# - id: Article ID
|
99
100
|
def delete_article(id)
|
100
101
|
if id.nil?
|
101
|
-
raise
|
102
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
102
103
|
end
|
103
104
|
parameters = {}
|
104
105
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/articles/#{id}.json?api_key=#{@api_key}")
|
@@ -109,7 +110,7 @@ class LinkemperorCustomer
|
|
109
110
|
# - id: Campaign ID
|
110
111
|
def get_campaign_articles(id)
|
111
112
|
if id.nil?
|
112
|
-
raise
|
113
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
113
114
|
end
|
114
115
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/articles.json?api_key=#{@api_key}")
|
115
116
|
end
|
@@ -126,7 +127,7 @@ class LinkemperorCustomer
|
|
126
127
|
# - id: Blast ID
|
127
128
|
def get_blast_by_id(id)
|
128
129
|
if id.nil?
|
129
|
-
raise
|
130
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
130
131
|
end
|
131
132
|
exec_get("#{@base_path}/api/v2/customers/blasts/#{id}.json?api_key=#{@api_key}")
|
132
133
|
end
|
@@ -136,7 +137,7 @@ class LinkemperorCustomer
|
|
136
137
|
# - id: Campaign ID
|
137
138
|
def get_campaign_blasts(id)
|
138
139
|
if id.nil?
|
139
|
-
raise
|
140
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
140
141
|
end
|
141
142
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/blasts.json?api_key=#{@api_key}")
|
142
143
|
end
|
@@ -153,7 +154,7 @@ class LinkemperorCustomer
|
|
153
154
|
# - id: Campaign ID
|
154
155
|
def get_campaign_by_id(id)
|
155
156
|
if id.nil?
|
156
|
-
raise
|
157
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
157
158
|
end
|
158
159
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}")
|
159
160
|
end
|
@@ -163,7 +164,7 @@ class LinkemperorCustomer
|
|
163
164
|
# - id: Campaign ID
|
164
165
|
def get_campaign_sites(id)
|
165
166
|
if id.nil?
|
166
|
-
raise
|
167
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
167
168
|
end
|
168
169
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/sites.json?api_key=#{@api_key}")
|
169
170
|
end
|
@@ -173,7 +174,7 @@ class LinkemperorCustomer
|
|
173
174
|
# - id: Campaign ID
|
174
175
|
def get_campaign_targets(id)
|
175
176
|
if id.nil?
|
176
|
-
raise
|
177
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
177
178
|
end
|
178
179
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/targets.json?api_key=#{@api_key}")
|
179
180
|
end
|
@@ -183,50 +184,80 @@ class LinkemperorCustomer
|
|
183
184
|
# - id: Campaign ID
|
184
185
|
def get_campaign_trouble_spots(id)
|
185
186
|
if id.nil?
|
186
|
-
raise
|
187
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
187
188
|
end
|
188
189
|
exec_get("#{@base_path}/api/v2/customers/campaigns/#{id}/trouble_spots.json?api_key=#{@api_key}")
|
189
190
|
end
|
190
191
|
|
191
192
|
# This method creates a new campaign. Remember that if you exceed your plan limit on Campaigns, there may be additional charges.
|
193
|
+
#
|
194
|
+
# If you allocate more total blasts than you have available, we will automatically upgrade your plan so that every campaign has at least one daily blast assigned.
|
192
195
|
# Parameters:
|
193
196
|
# - name: Name of the Campaign.
|
194
197
|
# - notes: Notes
|
195
|
-
|
198
|
+
# - active: Is the campaign active?
|
199
|
+
# - assigned_blasts_per_day: Blasts per day
|
200
|
+
# - default_target_keyword_value: Default target keyword value. Valid options are: calculated (default), equal, or zero
|
201
|
+
# - visit_value: Per visit value
|
202
|
+
def create_campaign(name, notes = nil, active = nil, assigned_blasts_per_day = nil, default_target_keyword_value = nil, visit_value = nil)
|
196
203
|
if name.nil?
|
197
|
-
raise
|
204
|
+
raise LinkemperorCustomerException.new('name should not be empty')
|
198
205
|
end
|
199
|
-
parameters = {'campaign' => {'name' => name, 'notes' => notes}}
|
206
|
+
parameters = {'campaign' => {'name' => name, 'notes' => notes, 'active' => active, 'assigned_blasts_per_day' => assigned_blasts_per_day, 'default_target_keyword_value' => default_target_keyword_value, 'visit_value' => visit_value}}
|
200
207
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/campaigns.json?api_key=#{@api_key}")
|
201
208
|
end
|
202
209
|
|
210
|
+
# This method updates an existing Campaign.
|
211
|
+
# Parameters:
|
212
|
+
# - id: ID # of the Campaign
|
213
|
+
# - name: Name of the Campaign.
|
214
|
+
# - notes: Notes
|
215
|
+
# - active: Is the campaign active?
|
216
|
+
# - assigned_blasts_per_day: Blasts per day
|
217
|
+
# - default_target_keyword_value: Default target keyword value. Valid options are: calculated (default), equal, or zero
|
218
|
+
# - visit_value: Per visit value
|
219
|
+
def update_campaign(id, name = nil, notes = nil, active = nil, assigned_blasts_per_day = nil, default_target_keyword_value = nil, visit_value = nil)
|
220
|
+
if id.nil?
|
221
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
222
|
+
end
|
223
|
+
parameters = {'campaign' => {'name' => name, 'notes' => notes, 'active' => active, 'assigned_blasts_per_day' => assigned_blasts_per_day, 'default_target_keyword_value' => default_target_keyword_value, 'visit_value' => visit_value}}
|
224
|
+
exec_post(parameters, 'put', "#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}")
|
225
|
+
end
|
226
|
+
|
203
227
|
# This method deletes the Campaign you specify.
|
204
228
|
# Parameters:
|
205
229
|
# - id: Campaign ID
|
206
230
|
def delete_campaign(id)
|
207
231
|
if id.nil?
|
208
|
-
raise
|
232
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
209
233
|
end
|
210
234
|
parameters = {}
|
211
235
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/campaigns/#{id}.json?api_key=#{@api_key}")
|
212
236
|
end
|
213
237
|
|
238
|
+
# This method reallocates your linkbuilding percentages equally between all active campaigns.
|
239
|
+
# Parameters:
|
240
|
+
# none
|
241
|
+
def linkbuilding_reallocate_equally()
|
242
|
+
parameters = {}
|
243
|
+
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/linkbuilding/reallocate_equally.json?api_key=#{@api_key}")
|
244
|
+
end
|
245
|
+
|
214
246
|
# This method is used to purchase link building.<br /><br />
|
215
247
|
# We call a single purchase an Order, and each order can contain multiple Blasts.<br /><br />
|
216
248
|
# First, you'll need to determine which of our link building Services you'd like to order. Use the /services endpoint of the API to get a list of available services.<br /><br />
|
217
249
|
# Now let's talk about building the actual order. An OrderRequest specifies the Services to order and the Targets (URL/anchor text) to build links to. Each Order can have multiple OrderRequests.<br /><br />
|
218
250
|
# You can see a sample OrderRequest (in JSON) by clicking "Model Schema" under the "Schema Used In Your Request" section just below.
|
219
251
|
# Parameters:
|
220
|
-
# - how_pay: How to pay for the Order. 'cash' to generate an invoice that will be settled against your account on file, or 'credits' to pull from the pool of existing credits in your account.
|
221
252
|
# - callback_url: The URL to notify when the status of the Order is updated. This occurs when component Blasts either succeed (and URLs are available for viewing) or fail (and replacement Blasts have been ordered.)
|
222
253
|
# - custom: You may provide any string here. We will save it as part of the Order and include it in the returned data whenever you check on an Order's status. It's great for holding your internal ID number for the Order.
|
223
254
|
# - special_requirements: Special requirements
|
224
255
|
# - requests: This is where the actual object describing your order goes. This is either a JSON nested array or XML nested tags (depending on your current format). The schema for this field is described below in the section titled Schema Used In Your Request.
|
225
|
-
def create_order(requests,
|
256
|
+
def create_order(requests, callback_url = nil, custom = nil, special_requirements = nil)
|
226
257
|
if requests.nil?
|
227
|
-
raise
|
258
|
+
raise LinkemperorCustomerException.new('requests should not be empty')
|
228
259
|
end
|
229
|
-
parameters = {'order' => {'
|
260
|
+
parameters = {'order' => {'callback_url' => callback_url, 'custom' => custom, 'special_requirements' => special_requirements, 'requests' => requests}}
|
230
261
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/orders.json?api_key=#{@api_key}")
|
231
262
|
end
|
232
263
|
|
@@ -236,7 +267,7 @@ class LinkemperorCustomer
|
|
236
267
|
# - id: ID # of the Order
|
237
268
|
def get_order_by_id(id)
|
238
269
|
if id.nil?
|
239
|
-
raise
|
270
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
240
271
|
end
|
241
272
|
exec_get("#{@base_path}/api/v2/customers/orders/#{id}.json?api_key=#{@api_key}")
|
242
273
|
end
|
@@ -271,7 +302,7 @@ class LinkemperorCustomer
|
|
271
302
|
# - id: Site ID
|
272
303
|
def get_site_by_id(id)
|
273
304
|
if id.nil?
|
274
|
-
raise
|
305
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
275
306
|
end
|
276
307
|
exec_get("#{@base_path}/api/v2/customers/sites/#{id}.json?api_key=#{@api_key}")
|
277
308
|
end
|
@@ -284,15 +315,15 @@ class LinkemperorCustomer
|
|
284
315
|
# - rss_feed: RSS Feed for this Site
|
285
316
|
def create_site(campaign_id, name, domain_name, rss_feed = nil)
|
286
317
|
if campaign_id.nil?
|
287
|
-
raise
|
318
|
+
raise LinkemperorCustomerException.new('campaign_id should not be empty')
|
288
319
|
end
|
289
320
|
|
290
321
|
if name.nil?
|
291
|
-
raise
|
322
|
+
raise LinkemperorCustomerException.new('name should not be empty')
|
292
323
|
end
|
293
324
|
|
294
325
|
if domain_name.nil?
|
295
|
-
raise
|
326
|
+
raise LinkemperorCustomerException.new('domain_name should not be empty')
|
296
327
|
end
|
297
328
|
parameters = {'site' => {'campaign_id' => campaign_id, 'name' => name, 'domain_name' => domain_name, 'rss_feed' => rss_feed}}
|
298
329
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/sites.json?api_key=#{@api_key}")
|
@@ -303,7 +334,7 @@ class LinkemperorCustomer
|
|
303
334
|
# - id: Site ID
|
304
335
|
def delete_site(id)
|
305
336
|
if id.nil?
|
306
|
-
raise
|
337
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
307
338
|
end
|
308
339
|
parameters = {}
|
309
340
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/sites/#{id}.json?api_key=#{@api_key}")
|
@@ -321,7 +352,7 @@ class LinkemperorCustomer
|
|
321
352
|
# - id: Target ID
|
322
353
|
def get_target_by_id(id)
|
323
354
|
if id.nil?
|
324
|
-
raise
|
355
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
325
356
|
end
|
326
357
|
exec_get("#{@base_path}/api/v2/customers/targets/#{id}.json?api_key=#{@api_key}")
|
327
358
|
end
|
@@ -331,24 +362,37 @@ class LinkemperorCustomer
|
|
331
362
|
# - campaign_id: Campaign ID
|
332
363
|
# - url_input: Fully qualified URL for the target.
|
333
364
|
# - keyword_input: Keywords to add to the target. Separate multiple keywords with linebreaks.
|
334
|
-
|
365
|
+
# - visit_value: Value of a visit to this target.
|
366
|
+
def create_target(campaign_id, url_input, keyword_input = nil, visit_value = nil)
|
335
367
|
if campaign_id.nil?
|
336
|
-
raise
|
368
|
+
raise LinkemperorCustomerException.new('campaign_id should not be empty')
|
337
369
|
end
|
338
370
|
|
339
371
|
if url_input.nil?
|
340
|
-
raise
|
372
|
+
raise LinkemperorCustomerException.new('url_input should not be empty')
|
341
373
|
end
|
342
|
-
parameters = {'target' => {'campaign_id' => campaign_id, 'url_input' => url_input, 'keyword_input' => keyword_input}}
|
374
|
+
parameters = {'target' => {'campaign_id' => campaign_id, 'url_input' => url_input, 'keyword_input' => keyword_input, 'visit_value' => visit_value}}
|
343
375
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/targets.json?api_key=#{@api_key}")
|
344
376
|
end
|
345
377
|
|
378
|
+
# This method updates an existing Target.
|
379
|
+
# Parameters:
|
380
|
+
# - id: ID # of the Target
|
381
|
+
# - visit_value: Value of a visit to this target.
|
382
|
+
def update_target(id, visit_value = nil)
|
383
|
+
if id.nil?
|
384
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
385
|
+
end
|
386
|
+
parameters = {'target' => {'visit_value' => visit_value}}
|
387
|
+
exec_post(parameters, 'put', "#{@base_path}/api/v2/customers/targets/#{id}.json?api_key=#{@api_key}")
|
388
|
+
end
|
389
|
+
|
346
390
|
# This method deletes the Target you specify.
|
347
391
|
# Parameters:
|
348
392
|
# - id: Target ID
|
349
393
|
def delete_target(id)
|
350
394
|
if id.nil?
|
351
|
-
raise
|
395
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
352
396
|
end
|
353
397
|
parameters = {}
|
354
398
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/targets/#{id}.json?api_key=#{@api_key}")
|
@@ -367,7 +411,7 @@ class LinkemperorCustomer
|
|
367
411
|
# - id: Keyword ID
|
368
412
|
def get_target_keyword_by_id(id)
|
369
413
|
if id.nil?
|
370
|
-
raise
|
414
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
371
415
|
end
|
372
416
|
exec_get("#{@base_path}/api/v2/customers/target_keywords/#{id}.json?api_key=#{@api_key}")
|
373
417
|
end
|
@@ -378,22 +422,34 @@ class LinkemperorCustomer
|
|
378
422
|
# - keyword_string: Keyword string
|
379
423
|
def create_target_keyword(target_id, keyword_string)
|
380
424
|
if target_id.nil?
|
381
|
-
raise
|
425
|
+
raise LinkemperorCustomerException.new('target_id should not be empty')
|
382
426
|
end
|
383
427
|
|
384
428
|
if keyword_string.nil?
|
385
|
-
raise
|
429
|
+
raise LinkemperorCustomerException.new('keyword_string should not be empty')
|
386
430
|
end
|
387
431
|
parameters = {'target_keyword' => {'target_id' => target_id, 'keyword_string' => keyword_string}}
|
388
432
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/customers/target_keywords.json?api_key=#{@api_key}")
|
389
433
|
end
|
390
434
|
|
435
|
+
# This method updates an existing TargetKeyword.
|
436
|
+
# Parameters:
|
437
|
+
# - id: ID # of the TargetKeyword
|
438
|
+
# - value: Value of a visit to this TargetKeyword.
|
439
|
+
def update_target(id, value = nil)
|
440
|
+
if id.nil?
|
441
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
442
|
+
end
|
443
|
+
parameters = {'target_keyword' => {'value' => value}}
|
444
|
+
exec_post(parameters, 'put', "#{@base_path}/api/v2/customers/target_keywords/#{id}.json?api_key=#{@api_key}")
|
445
|
+
end
|
446
|
+
|
391
447
|
# This method deletes the Keyword you specify.
|
392
448
|
# Parameters:
|
393
449
|
# - id: Keyword ID
|
394
450
|
def delete_target_keyword(id)
|
395
451
|
if id.nil?
|
396
|
-
raise
|
452
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
397
453
|
end
|
398
454
|
parameters = {}
|
399
455
|
exec_post(parameters, 'delete', "#{@base_path}/api/v2/customers/target_keywords/#{id}.json?api_key=#{@api_key}")
|
@@ -413,9 +469,16 @@ class LinkemperorCustomer
|
|
413
469
|
# - id: TroubleSpot ID
|
414
470
|
def get_trouble_spot_by_id(id)
|
415
471
|
if id.nil?
|
416
|
-
raise
|
472
|
+
raise LinkemperorCustomerException.new('id should not be empty')
|
417
473
|
end
|
418
474
|
exec_get("#{@base_path}/api/v2/customers/trouble_spots/#{id}.json?api_key=#{@api_key}")
|
419
475
|
end
|
420
476
|
|
477
|
+
# This endpoint is no longer used.
|
478
|
+
# Parameters:
|
479
|
+
# none
|
480
|
+
def info_blast_credit_balance()
|
481
|
+
exec_get("#{@base_path}/api/v2/customers/info/blast_credit_balance.json?api_key=#{@api_key}")
|
482
|
+
end
|
483
|
+
|
421
484
|
end
|
@@ -4,7 +4,7 @@ require 'uri'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
class LinkemperorVendor
|
7
|
-
class
|
7
|
+
class LinkemperorVendorException < RuntimeError
|
8
8
|
end
|
9
9
|
|
10
10
|
def initialize(api_key, base_path = nil)
|
@@ -18,7 +18,7 @@ class LinkemperorVendor
|
|
18
18
|
if result.is_a?(Net::HTTPSuccess)
|
19
19
|
JSON.parse(result.body)
|
20
20
|
else
|
21
|
-
raise
|
21
|
+
raise LinkemperorVendorException.new result.body
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -51,7 +51,7 @@ class LinkemperorVendor
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
else
|
54
|
-
raise
|
54
|
+
raise LinkemperorVendorException.new result.body
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -88,7 +88,7 @@ class LinkemperorVendor
|
|
88
88
|
# - id: ID # of the Blast
|
89
89
|
def get_blast_by_id(id)
|
90
90
|
if id.nil?
|
91
|
-
raise
|
91
|
+
raise LinkemperorVendorException.new('id should not be empty')
|
92
92
|
end
|
93
93
|
exec_get("#{@base_path}/api/v2/vendors/blasts/#{id}.json?api_key=#{@api_key}")
|
94
94
|
end
|
@@ -101,16 +101,21 @@ class LinkemperorVendor
|
|
101
101
|
#
|
102
102
|
# If you are required to provide login information for the built urls,
|
103
103
|
# provide it in the url itself using the following format: http://user:password@domain.com/path
|
104
|
+
#
|
105
|
+
# This endpoint can be a little hard to implement, so make sure your JSON payload looks something like this one. If you're using
|
106
|
+
# XML, then you'll need to modify accordingly.
|
107
|
+
#
|
108
|
+
# { "blast": { "links": ["http://foo.com", "http://bar.com"] } }
|
104
109
|
# Parameters:
|
105
110
|
# - id: ID # of the Blast
|
106
|
-
# - links: A string containing the list of links to submit (newline delimited)
|
111
|
+
# - links: A string containing the list of links to submit (newline delimited) OR an array of links.
|
107
112
|
def submit_built_link(id, links)
|
108
113
|
if id.nil?
|
109
|
-
raise
|
114
|
+
raise LinkemperorVendorException.new('id should not be empty')
|
110
115
|
end
|
111
116
|
|
112
117
|
if links.nil?
|
113
|
-
raise
|
118
|
+
raise LinkemperorVendorException.new('links should not be empty')
|
114
119
|
end
|
115
120
|
parameters = {'blast' => {'links' => links}}
|
116
121
|
exec_post(parameters, 'put', "#{@base_path}/api/v2/vendors/blasts/#{id}.json?api_key=#{@api_key}")
|
@@ -128,7 +133,7 @@ class LinkemperorVendor
|
|
128
133
|
# - id: ID # of the Service
|
129
134
|
def get_service_by_id(id)
|
130
135
|
if id.nil?
|
131
|
-
raise
|
136
|
+
raise LinkemperorVendorException.new('id should not be empty')
|
132
137
|
end
|
133
138
|
exec_get("#{@base_path}/api/v2/vendors/services/#{id}.json?api_key=#{@api_key}")
|
134
139
|
end
|
@@ -140,11 +145,31 @@ class LinkemperorVendor
|
|
140
145
|
# - id: ID # of the Service
|
141
146
|
def get_failed_domains(id)
|
142
147
|
if id.nil?
|
143
|
-
raise
|
148
|
+
raise LinkemperorVendorException.new('id should not be empty')
|
144
149
|
end
|
145
150
|
exec_get("#{@base_path}/api/v2/vendors/services/#{id}/failed_domains.json?api_key=#{@api_key}")
|
146
151
|
end
|
147
152
|
|
153
|
+
# Pause a currently active service.
|
154
|
+
# Parameters:
|
155
|
+
# - id: ID # of the Service
|
156
|
+
def pause_running_service(id)
|
157
|
+
if id.nil?
|
158
|
+
raise LinkemperorVendorException.new('id should not be empty')
|
159
|
+
end
|
160
|
+
exec_get("#{@base_path}/api/v2/vendors/services/#{id}/pause.json?api_key=#{@api_key}")
|
161
|
+
end
|
162
|
+
|
163
|
+
# Resume a currently paused service.
|
164
|
+
# Parameters:
|
165
|
+
# - id: ID # of the Service
|
166
|
+
def resume_paused_service(id)
|
167
|
+
if id.nil?
|
168
|
+
raise LinkemperorVendorException.new('id should not be empty')
|
169
|
+
end
|
170
|
+
exec_get("#{@base_path}/api/v2/vendors/services/#{id}/run.json?api_key=#{@api_key}")
|
171
|
+
end
|
172
|
+
|
148
173
|
# Creates a test blast for your Service. It will not affect your score or marketplace rank. However, if you submit URLs that fail to pass our link checker, they will be reflected in the failed_domains method of the API.
|
149
174
|
#
|
150
175
|
# This is particularly useful for testing new URL lists or potential link sources.
|
@@ -154,7 +179,7 @@ class LinkemperorVendor
|
|
154
179
|
# - id: ID # of the Service
|
155
180
|
def create_test_blast(id)
|
156
181
|
if id.nil?
|
157
|
-
raise
|
182
|
+
raise LinkemperorVendorException.new('id should not be empty')
|
158
183
|
end
|
159
184
|
parameters = {}
|
160
185
|
exec_post(parameters, 'post', "#{@base_path}/api/v2/vendors/services/#{id}/test_blast.json?api_key=#{@api_key}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkemperor-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Link Emperor API for Customers and Vendors
|
15
15
|
email:
|