centralindex 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/CentralIndex.rb +1145 -0
  2. metadata +62 -0
@@ -0,0 +1,1145 @@
1
+ require 'net/http'
2
+
3
+ # global to hold the api key
4
+ $apiKey = ""
5
+
6
+ class CentralIndex
7
+
8
+ # constructor
9
+ def initialize(apiKey, debugMode)
10
+ @apiKey = apiKey
11
+ @debugMode = debugMode
12
+ end
13
+
14
+ # make 'curl' request to the api server
15
+ def doCurl(method,path,params)
16
+ # api constants
17
+ domain = 'api.centralindex.com'
18
+ endpoint = '/v1'
19
+ path = endpoint+path
20
+ params['api_key'] = @apiKey
21
+ retval = ''
22
+
23
+ # create an HTTP connection
24
+ http = Net::HTTP.new(domain)
25
+ if @debugMode
26
+ http.set_debug_output $stderr
27
+ end
28
+
29
+ if(method == 'get')
30
+ # crazy dance to get urlencode parameters from Ruby
31
+ request = Net::HTTP::Get.new(path)
32
+ request.set_form_data( params, sep = '&' )
33
+ request = Net::HTTP::Get.new( path+ '?' + request.body )
34
+ retval = http.request(request)
35
+ end
36
+ if(method == 'post')
37
+ request = Net::HTTP::Post.new(path)
38
+ request.set_form_data(params)
39
+ retval = http.request(request)
40
+ end
41
+ if(method == 'put')
42
+ request = Net::HTTP::Put.new(path)
43
+ request.set_form_data(params)
44
+ retval = http.request(request)
45
+ end
46
+ if(method == 'delete')
47
+ request = Net::HTTP::Put.new(path)
48
+ request.set_form_data(params)
49
+ retval = http.request(request)
50
+ end
51
+ return retval.body
52
+ end
53
+
54
+
55
+ def getStatus()
56
+ params = Hash.new
57
+ return doCurl("get","/status",params)
58
+ end
59
+
60
+
61
+ def getLogo( a, b, c, d)
62
+ params = Hash.new
63
+ params['a'] = a
64
+ params['b'] = b
65
+ params['c'] = c
66
+ params['d'] = d
67
+ return doCurl("get","/logo",params)
68
+ end
69
+
70
+
71
+ def putLogo( a)
72
+ params = Hash.new
73
+ params['a'] = a
74
+ return doCurl("put","/logo",params)
75
+ end
76
+
77
+
78
+ def postEntityBulkCsv( filedata)
79
+ params = Hash.new
80
+ params['filedata'] = filedata
81
+ return doCurl("post","/entity/bulk/csv",params)
82
+ end
83
+
84
+
85
+ def getEntityBulkCsvStatus( upload_id)
86
+ params = Hash.new
87
+ params['upload_id'] = upload_id
88
+ return doCurl("get","/entity/bulk/csv/status",params)
89
+ end
90
+
91
+
92
+ def putEntity( type, scope, country, trust, our_data)
93
+ params = Hash.new
94
+ params['type'] = type
95
+ params['scope'] = scope
96
+ params['country'] = country
97
+ params['trust'] = trust
98
+ params['our_data'] = our_data
99
+ return doCurl("put","/entity",params)
100
+ end
101
+
102
+
103
+ def getEntityBy_supplier_id( supplier_id)
104
+ params = Hash.new
105
+ params['supplier_id'] = supplier_id
106
+ return doCurl("get","/entity/by_supplier_id",params)
107
+ end
108
+
109
+
110
+ def getEntitySearch( what, entity_name, where, per_page, page, longitude, latitude, country, language)
111
+ params = Hash.new
112
+ params['what'] = what
113
+ params['entity_name'] = entity_name
114
+ params['where'] = where
115
+ params['per_page'] = per_page
116
+ params['page'] = page
117
+ params['longitude'] = longitude
118
+ params['latitude'] = latitude
119
+ params['country'] = country
120
+ params['language'] = language
121
+ return doCurl("get","/entity/search",params)
122
+ end
123
+
124
+
125
+ def getEntitySearchWhatBylocation( what, where, per_page, page, country, language)
126
+ params = Hash.new
127
+ params['what'] = what
128
+ params['where'] = where
129
+ params['per_page'] = per_page
130
+ params['page'] = page
131
+ params['country'] = country
132
+ params['language'] = language
133
+ return doCurl("get","/entity/search/what/bylocation",params)
134
+ end
135
+
136
+
137
+ def getEntitySearchWhatByboundingbox( what, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language)
138
+ params = Hash.new
139
+ params['what'] = what
140
+ params['latitude_1'] = latitude_1
141
+ params['longitude_1'] = longitude_1
142
+ params['latitude_2'] = latitude_2
143
+ params['longitude_2'] = longitude_2
144
+ params['per_page'] = per_page
145
+ params['page'] = page
146
+ params['country'] = country
147
+ params['language'] = language
148
+ return doCurl("get","/entity/search/what/byboundingbox",params)
149
+ end
150
+
151
+
152
+ def getEntitySearchWhoByboundingbox( who, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country)
153
+ params = Hash.new
154
+ params['who'] = who
155
+ params['latitude_1'] = latitude_1
156
+ params['longitude_1'] = longitude_1
157
+ params['latitude_2'] = latitude_2
158
+ params['longitude_2'] = longitude_2
159
+ params['per_page'] = per_page
160
+ params['page'] = page
161
+ params['country'] = country
162
+ return doCurl("get","/entity/search/who/byboundingbox",params)
163
+ end
164
+
165
+
166
+ def getEntitySearchWhoBylocation( who, where, per_page, page, country)
167
+ params = Hash.new
168
+ params['who'] = who
169
+ params['where'] = where
170
+ params['per_page'] = per_page
171
+ params['page'] = page
172
+ params['country'] = country
173
+ return doCurl("get","/entity/search/who/bylocation",params)
174
+ end
175
+
176
+
177
+ def getEntitySearchWhat( what, per_page, page, country, language)
178
+ params = Hash.new
179
+ params['what'] = what
180
+ params['per_page'] = per_page
181
+ params['page'] = page
182
+ params['country'] = country
183
+ params['language'] = language
184
+ return doCurl("get","/entity/search/what",params)
185
+ end
186
+
187
+
188
+ def getEntitySearchWho( who, per_page, page, country)
189
+ params = Hash.new
190
+ params['who'] = who
191
+ params['per_page'] = per_page
192
+ params['page'] = page
193
+ params['country'] = country
194
+ return doCurl("get","/entity/search/who",params)
195
+ end
196
+
197
+
198
+ def getEntitySearchBylocation( where, per_page, page, country, language)
199
+ params = Hash.new
200
+ params['where'] = where
201
+ params['per_page'] = per_page
202
+ params['page'] = page
203
+ params['country'] = country
204
+ params['language'] = language
205
+ return doCurl("get","/entity/search/bylocation",params)
206
+ end
207
+
208
+
209
+ def getEntitySearchByboundingbox( latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language)
210
+ params = Hash.new
211
+ params['latitude_1'] = latitude_1
212
+ params['longitude_1'] = longitude_1
213
+ params['latitude_2'] = latitude_2
214
+ params['longitude_2'] = longitude_2
215
+ params['per_page'] = per_page
216
+ params['page'] = page
217
+ params['country'] = country
218
+ params['language'] = language
219
+ return doCurl("get","/entity/search/byboundingbox",params)
220
+ end
221
+
222
+
223
+ def getEntityAdvertisers( tag, where, limit, country, language)
224
+ params = Hash.new
225
+ params['tag'] = tag
226
+ params['where'] = where
227
+ params['limit'] = limit
228
+ params['country'] = country
229
+ params['language'] = language
230
+ return doCurl("get","/entity/advertisers",params)
231
+ end
232
+
233
+
234
+ def getEntity( entity_id)
235
+ params = Hash.new
236
+ params['entity_id'] = entity_id
237
+ return doCurl("get","/entity",params)
238
+ end
239
+
240
+
241
+ def getEntityBy_user_id( user_id)
242
+ params = Hash.new
243
+ params['user_id'] = user_id
244
+ return doCurl("get","/entity/by_user_id",params)
245
+ end
246
+
247
+
248
+ def getEntityRevisions( entity_id)
249
+ params = Hash.new
250
+ params['entity_id'] = entity_id
251
+ return doCurl("get","/entity/revisions",params)
252
+ end
253
+
254
+
255
+ def getEntityRevisionsByRevisionID( entity_id, revision_id)
256
+ params = Hash.new
257
+ params['entity_id'] = entity_id
258
+ params['revision_id'] = revision_id
259
+ return doCurl("get","/entity/revisions/byRevisionID",params)
260
+ end
261
+
262
+
263
+ def postEntityUnmerge( entity_id, supplier_masheryid, supplier_id)
264
+ params = Hash.new
265
+ params['entity_id'] = entity_id
266
+ params['supplier_masheryid'] = supplier_masheryid
267
+ params['supplier_id'] = supplier_id
268
+ return doCurl("post","/entity/unmerge",params)
269
+ end
270
+
271
+
272
+ def getEntityChangelog( entity_id)
273
+ params = Hash.new
274
+ params['entity_id'] = entity_id
275
+ return doCurl("get","/entity/changelog",params)
276
+ end
277
+
278
+
279
+ def postEntityMerge( from, to)
280
+ params = Hash.new
281
+ params['from'] = from
282
+ params['to'] = to
283
+ return doCurl("post","/entity/merge",params)
284
+ end
285
+
286
+
287
+ def getToolsReindex()
288
+ params = Hash.new
289
+ return doCurl("get","/tools/reindex",params)
290
+ end
291
+
292
+
293
+ def getEntityReport( entity_id, gen_id, language)
294
+ params = Hash.new
295
+ params['entity_id'] = entity_id
296
+ params['gen_id'] = gen_id
297
+ params['language'] = language
298
+ return doCurl("get","/entity/report",params)
299
+ end
300
+
301
+
302
+ def getToolsDecodereport( token)
303
+ params = Hash.new
304
+ params['token'] = token
305
+ return doCurl("get","/tools/decodereport",params)
306
+ end
307
+
308
+
309
+ def postEntityMigrate_category( from, to, limit)
310
+ params = Hash.new
311
+ params['from'] = from
312
+ params['to'] = to
313
+ params['limit'] = limit
314
+ return doCurl("post","/entity/migrate_category",params)
315
+ end
316
+
317
+
318
+ def putBusiness( name, address1, address2, address3, district, town, county, postcode, country, latitude, longitude, timezone, telephone_number, telephone_type, email, website, category_id, category_name)
319
+ params = Hash.new
320
+ params['name'] = name
321
+ params['address1'] = address1
322
+ params['address2'] = address2
323
+ params['address3'] = address3
324
+ params['district'] = district
325
+ params['town'] = town
326
+ params['county'] = county
327
+ params['postcode'] = postcode
328
+ params['country'] = country
329
+ params['latitude'] = latitude
330
+ params['longitude'] = longitude
331
+ params['timezone'] = timezone
332
+ params['telephone_number'] = telephone_number
333
+ params['telephone_type'] = telephone_type
334
+ params['email'] = email
335
+ params['website'] = website
336
+ params['category_id'] = category_id
337
+ params['category_name'] = category_name
338
+ return doCurl("put","/business",params)
339
+ end
340
+
341
+
342
+ def getEntityAdd( language)
343
+ params = Hash.new
344
+ params['language'] = language
345
+ return doCurl("get","/entity/add",params)
346
+ end
347
+
348
+
349
+ def getLookupLocation( string, country)
350
+ params = Hash.new
351
+ params['string'] = string
352
+ params['country'] = country
353
+ return doCurl("get","/lookup/location",params)
354
+ end
355
+
356
+
357
+ def getLookupCategory( string, language)
358
+ params = Hash.new
359
+ params['string'] = string
360
+ params['language'] = language
361
+ return doCurl("get","/lookup/category",params)
362
+ end
363
+
364
+
365
+ def getLookupLegacyCategory( id, type)
366
+ params = Hash.new
367
+ params['id'] = id
368
+ params['type'] = type
369
+ return doCurl("get","/lookup/legacy/category",params)
370
+ end
371
+
372
+
373
+ def postEntityName( entity_id, name, formal_name)
374
+ params = Hash.new
375
+ params['entity_id'] = entity_id
376
+ params['name'] = name
377
+ params['formal_name'] = formal_name
378
+ return doCurl("post","/entity/name",params)
379
+ end
380
+
381
+
382
+ def postEntityBackground( entity_id, number_of_employees, turnover, net_profit, vat_number, duns_number, registered_company_number)
383
+ params = Hash.new
384
+ params['entity_id'] = entity_id
385
+ params['number_of_employees'] = number_of_employees
386
+ params['turnover'] = turnover
387
+ params['net_profit'] = net_profit
388
+ params['vat_number'] = vat_number
389
+ params['duns_number'] = duns_number
390
+ params['registered_company_number'] = registered_company_number
391
+ return doCurl("post","/entity/background",params)
392
+ end
393
+
394
+
395
+ def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)
396
+ params = Hash.new
397
+ params['entity_id'] = entity_id
398
+ params['title'] = title
399
+ params['forename'] = forename
400
+ params['surname'] = surname
401
+ params['job_title'] = job_title
402
+ params['description'] = description
403
+ params['email'] = email
404
+ params['phone_number'] = phone_number
405
+ return doCurl("post","/entity/employee",params)
406
+ end
407
+
408
+
409
+ def deleteEntityEmployee( entity_id, gen_id)
410
+ params = Hash.new
411
+ params['entity_id'] = entity_id
412
+ params['gen_id'] = gen_id
413
+ return doCurl("delete","/entity/employee",params)
414
+ end
415
+
416
+
417
+ def postEntityPhone( entity_id, number, description, premium_rate, telephone_type, tps, ctps)
418
+ params = Hash.new
419
+ params['entity_id'] = entity_id
420
+ params['number'] = number
421
+ params['description'] = description
422
+ params['premium_rate'] = premium_rate
423
+ params['telephone_type'] = telephone_type
424
+ params['tps'] = tps
425
+ params['ctps'] = ctps
426
+ return doCurl("post","/entity/phone",params)
427
+ end
428
+
429
+
430
+ def deleteEntityPhone( entity_id, gen_id)
431
+ params = Hash.new
432
+ params['entity_id'] = entity_id
433
+ params['gen_id'] = gen_id
434
+ return doCurl("delete","/entity/phone",params)
435
+ end
436
+
437
+
438
+ def postEntityFax( entity_id, number, description, premium_rate)
439
+ params = Hash.new
440
+ params['entity_id'] = entity_id
441
+ params['number'] = number
442
+ params['description'] = description
443
+ params['premium_rate'] = premium_rate
444
+ return doCurl("post","/entity/fax",params)
445
+ end
446
+
447
+
448
+ def deleteEntityFax( entity_id, gen_id)
449
+ params = Hash.new
450
+ params['entity_id'] = entity_id
451
+ params['gen_id'] = gen_id
452
+ return doCurl("delete","/entity/fax",params)
453
+ end
454
+
455
+
456
+ def putCategory( category_id, language, name)
457
+ params = Hash.new
458
+ params['category_id'] = category_id
459
+ params['language'] = language
460
+ params['name'] = name
461
+ return doCurl("put","/category",params)
462
+ end
463
+
464
+
465
+ def postCategoryMappings( category_id, type, id, name)
466
+ params = Hash.new
467
+ params['category_id'] = category_id
468
+ params['type'] = type
469
+ params['id'] = id
470
+ params['name'] = name
471
+ return doCurl("post","/category/mappings",params)
472
+ end
473
+
474
+
475
+ def postCategorySynonym( category_id, synonym, language)
476
+ params = Hash.new
477
+ params['category_id'] = category_id
478
+ params['synonym'] = synonym
479
+ params['language'] = language
480
+ return doCurl("post","/category/synonym",params)
481
+ end
482
+
483
+
484
+ def deleteCategorySynonym( category_id, synonym, language)
485
+ params = Hash.new
486
+ params['category_id'] = category_id
487
+ params['synonym'] = synonym
488
+ params['language'] = language
489
+ return doCurl("delete","/category/synonym",params)
490
+ end
491
+
492
+
493
+ def postCategoryMerge( from, to)
494
+ params = Hash.new
495
+ params['from'] = from
496
+ params['to'] = to
497
+ return doCurl("post","/category/merge",params)
498
+ end
499
+
500
+
501
+ def postEntityCategory( entity_id, category_id, category_name)
502
+ params = Hash.new
503
+ params['entity_id'] = entity_id
504
+ params['category_id'] = category_id
505
+ params['category_name'] = category_name
506
+ return doCurl("post","/entity/category",params)
507
+ end
508
+
509
+
510
+ def deleteEntityCategory( entity_id, gen_id)
511
+ params = Hash.new
512
+ params['entity_id'] = entity_id
513
+ params['gen_id'] = gen_id
514
+ return doCurl("delete","/entity/category",params)
515
+ end
516
+
517
+
518
+ def postEntityGeopoint( entity_id, longitude, latitude, accuracy)
519
+ params = Hash.new
520
+ params['entity_id'] = entity_id
521
+ params['longitude'] = longitude
522
+ params['latitude'] = latitude
523
+ params['accuracy'] = accuracy
524
+ return doCurl("post","/entity/geopoint",params)
525
+ end
526
+
527
+
528
+ def getMatchByphone( phone, company_name, latitude, longitude, name_strictness, location_strictness)
529
+ params = Hash.new
530
+ params['phone'] = phone
531
+ params['company_name'] = company_name
532
+ params['latitude'] = latitude
533
+ params['longitude'] = longitude
534
+ params['name_strictness'] = name_strictness
535
+ params['location_strictness'] = location_strictness
536
+ return doCurl("get","/match/byphone",params)
537
+ end
538
+
539
+
540
+ def getMatchBylocation( company_name, latitude, longitude, name_strictness, location_strictness)
541
+ params = Hash.new
542
+ params['company_name'] = company_name
543
+ params['latitude'] = latitude
544
+ params['longitude'] = longitude
545
+ params['name_strictness'] = name_strictness
546
+ params['location_strictness'] = location_strictness
547
+ return doCurl("get","/match/bylocation",params)
548
+ end
549
+
550
+
551
+ def getToolsStopwords( text)
552
+ params = Hash.new
553
+ params['text'] = text
554
+ return doCurl("get","/tools/stopwords",params)
555
+ end
556
+
557
+
558
+ def getToolsStem( text)
559
+ params = Hash.new
560
+ params['text'] = text
561
+ return doCurl("get","/tools/stem",params)
562
+ end
563
+
564
+
565
+ def getToolsPhonetic( text)
566
+ params = Hash.new
567
+ params['text'] = text
568
+ return doCurl("get","/tools/phonetic",params)
569
+ end
570
+
571
+
572
+ def getToolsProcess_string( text)
573
+ params = Hash.new
574
+ params['text'] = text
575
+ return doCurl("get","/tools/process_string",params)
576
+ end
577
+
578
+
579
+ def getToolsProcess_phone( number)
580
+ params = Hash.new
581
+ params['number'] = number
582
+ return doCurl("get","/tools/process_phone",params)
583
+ end
584
+
585
+
586
+ def getToolsSpider( url)
587
+ params = Hash.new
588
+ params['url'] = url
589
+ return doCurl("get","/tools/spider",params)
590
+ end
591
+
592
+
593
+ def getToolsGeocode( address)
594
+ params = Hash.new
595
+ params['address'] = address
596
+ return doCurl("get","/tools/geocode",params)
597
+ end
598
+
599
+
600
+ def getToolsIodocs( mode, path, endpoint, doctype)
601
+ params = Hash.new
602
+ params['mode'] = mode
603
+ params['path'] = path
604
+ params['endpoint'] = endpoint
605
+ params['doctype'] = doctype
606
+ return doCurl("get","/tools/iodocs",params)
607
+ end
608
+
609
+
610
+ def getToolsDocs( object, format)
611
+ params = Hash.new
612
+ params['object'] = object
613
+ params['format'] = format
614
+ return doCurl("get","/tools/docs",params)
615
+ end
616
+
617
+
618
+ def getToolsFormatPhone( number, country)
619
+ params = Hash.new
620
+ params['number'] = number
621
+ params['country'] = country
622
+ return doCurl("get","/tools/format/phone",params)
623
+ end
624
+
625
+
626
+ def postEntityInvoice_address( entity_id, address1, address2, address3, district, town, county, postcode, address_type)
627
+ params = Hash.new
628
+ params['entity_id'] = entity_id
629
+ params['address1'] = address1
630
+ params['address2'] = address2
631
+ params['address3'] = address3
632
+ params['district'] = district
633
+ params['town'] = town
634
+ params['county'] = county
635
+ params['postcode'] = postcode
636
+ params['address_type'] = address_type
637
+ return doCurl("post","/entity/invoice_address",params)
638
+ end
639
+
640
+
641
+ def deleteEntityInvoice_address( entity_id)
642
+ params = Hash.new
643
+ params['entity_id'] = entity_id
644
+ return doCurl("delete","/entity/invoice_address",params)
645
+ end
646
+
647
+
648
+ def postEntityTag( entity_id, tag, language)
649
+ params = Hash.new
650
+ params['entity_id'] = entity_id
651
+ params['tag'] = tag
652
+ params['language'] = language
653
+ return doCurl("post","/entity/tag",params)
654
+ end
655
+
656
+
657
+ def deleteEntityTag( entity_id, gen_id)
658
+ params = Hash.new
659
+ params['entity_id'] = entity_id
660
+ params['gen_id'] = gen_id
661
+ return doCurl("delete","/entity/tag",params)
662
+ end
663
+
664
+
665
+ def postEntityPostal_address( entity_id, address1, address2, address3, district, town, county, postcode, address_type)
666
+ params = Hash.new
667
+ params['entity_id'] = entity_id
668
+ params['address1'] = address1
669
+ params['address2'] = address2
670
+ params['address3'] = address3
671
+ params['district'] = district
672
+ params['town'] = town
673
+ params['county'] = county
674
+ params['postcode'] = postcode
675
+ params['address_type'] = address_type
676
+ return doCurl("post","/entity/postal_address",params)
677
+ end
678
+
679
+
680
+ def postEntityAdvertiser( entity_id, tags, locations, expiry, is_national, language)
681
+ params = Hash.new
682
+ params['entity_id'] = entity_id
683
+ params['tags'] = tags
684
+ params['locations'] = locations
685
+ params['expiry'] = expiry
686
+ params['is_national'] = is_national
687
+ params['language'] = language
688
+ return doCurl("post","/entity/advertiser",params)
689
+ end
690
+
691
+
692
+ def deleteEntityAdvertiser( entity_id, gen_id)
693
+ params = Hash.new
694
+ params['entity_id'] = entity_id
695
+ params['gen_id'] = gen_id
696
+ return doCurl("delete","/entity/advertiser",params)
697
+ end
698
+
699
+
700
+ def postEntityEmail( entity_id, email_address, email_description)
701
+ params = Hash.new
702
+ params['entity_id'] = entity_id
703
+ params['email_address'] = email_address
704
+ params['email_description'] = email_description
705
+ return doCurl("post","/entity/email",params)
706
+ end
707
+
708
+
709
+ def deleteEntityEmail( entity_id, gen_id)
710
+ params = Hash.new
711
+ params['entity_id'] = entity_id
712
+ params['gen_id'] = gen_id
713
+ return doCurl("delete","/entity/email",params)
714
+ end
715
+
716
+
717
+ def postEntityWebsite( entity_id, website_url, display_url, website_description)
718
+ params = Hash.new
719
+ params['entity_id'] = entity_id
720
+ params['website_url'] = website_url
721
+ params['display_url'] = display_url
722
+ params['website_description'] = website_description
723
+ return doCurl("post","/entity/website",params)
724
+ end
725
+
726
+
727
+ def deleteEntityWebsite( entity_id, gen_id)
728
+ params = Hash.new
729
+ params['entity_id'] = entity_id
730
+ params['gen_id'] = gen_id
731
+ return doCurl("delete","/entity/website",params)
732
+ end
733
+
734
+
735
+ def postEntityImage( entity_id, filedata, image_name)
736
+ params = Hash.new
737
+ params['entity_id'] = entity_id
738
+ params['filedata'] = filedata
739
+ params['image_name'] = image_name
740
+ return doCurl("post","/entity/image",params)
741
+ end
742
+
743
+
744
+ def deleteEntityImage( entity_id, gen_id)
745
+ params = Hash.new
746
+ params['entity_id'] = entity_id
747
+ params['gen_id'] = gen_id
748
+ return doCurl("delete","/entity/image",params)
749
+ end
750
+
751
+
752
+ def getLocation( location_id)
753
+ params = Hash.new
754
+ params['location_id'] = location_id
755
+ return doCurl("get","/location",params)
756
+ end
757
+
758
+
759
+ def postLocation( location_id, name, formal_name, latitude, longitude, resolution, country, population, description, timezone, is_duplicate, is_default)
760
+ params = Hash.new
761
+ params['location_id'] = location_id
762
+ params['name'] = name
763
+ params['formal_name'] = formal_name
764
+ params['latitude'] = latitude
765
+ params['longitude'] = longitude
766
+ params['resolution'] = resolution
767
+ params['country'] = country
768
+ params['population'] = population
769
+ params['description'] = description
770
+ params['timezone'] = timezone
771
+ params['is_duplicate'] = is_duplicate
772
+ params['is_default'] = is_default
773
+ return doCurl("post","/location",params)
774
+ end
775
+
776
+
777
+ def postLocationSynonym( location_id, synonym, language)
778
+ params = Hash.new
779
+ params['location_id'] = location_id
780
+ params['synonym'] = synonym
781
+ params['language'] = language
782
+ return doCurl("post","/location/synonym",params)
783
+ end
784
+
785
+
786
+ def deleteLocationSynonym( location_id, synonym, language)
787
+ params = Hash.new
788
+ params['location_id'] = location_id
789
+ params['synonym'] = synonym
790
+ params['language'] = language
791
+ return doCurl("delete","/location/synonym",params)
792
+ end
793
+
794
+
795
+ def postLocationSource( location_id, type, url, ref)
796
+ params = Hash.new
797
+ params['location_id'] = location_id
798
+ params['type'] = type
799
+ params['url'] = url
800
+ params['ref'] = ref
801
+ return doCurl("post","/location/source",params)
802
+ end
803
+
804
+
805
+ def postEntityStatus( entity_id, status)
806
+ params = Hash.new
807
+ params['entity_id'] = entity_id
808
+ params['status'] = status
809
+ return doCurl("post","/entity/status",params)
810
+ end
811
+
812
+
813
+ def postEntityLogo( entity_id, filedata, logo_name)
814
+ params = Hash.new
815
+ params['entity_id'] = entity_id
816
+ params['filedata'] = filedata
817
+ params['logo_name'] = logo_name
818
+ return doCurl("post","/entity/logo",params)
819
+ end
820
+
821
+
822
+ def deleteEntityLogo( entity_id, gen_id)
823
+ params = Hash.new
824
+ params['entity_id'] = entity_id
825
+ params['gen_id'] = gen_id
826
+ return doCurl("delete","/entity/logo",params)
827
+ end
828
+
829
+
830
+ def postEntityVideo( entity_id, title, description, thumbnail, embed_code)
831
+ params = Hash.new
832
+ params['entity_id'] = entity_id
833
+ params['title'] = title
834
+ params['description'] = description
835
+ params['thumbnail'] = thumbnail
836
+ params['embed_code'] = embed_code
837
+ return doCurl("post","/entity/video",params)
838
+ end
839
+
840
+
841
+ def deleteEntityVideo( entity_id, gen_id)
842
+ params = Hash.new
843
+ params['entity_id'] = entity_id
844
+ params['gen_id'] = gen_id
845
+ return doCurl("delete","/entity/video",params)
846
+ end
847
+
848
+
849
+ def postEntityAffiliate_link( entity_id, affiliate_name, affiliate_link, affiliate_message, affiliate_logo)
850
+ params = Hash.new
851
+ params['entity_id'] = entity_id
852
+ params['affiliate_name'] = affiliate_name
853
+ params['affiliate_link'] = affiliate_link
854
+ params['affiliate_message'] = affiliate_message
855
+ params['affiliate_logo'] = affiliate_logo
856
+ return doCurl("post","/entity/affiliate_link",params)
857
+ end
858
+
859
+
860
+ def deleteEntityAffiliate_link( entity_id, gen_id)
861
+ params = Hash.new
862
+ params['entity_id'] = entity_id
863
+ params['gen_id'] = gen_id
864
+ return doCurl("delete","/entity/affiliate_link",params)
865
+ end
866
+
867
+
868
+ def postEntityDescription( entity_id, headline, body)
869
+ params = Hash.new
870
+ params['entity_id'] = entity_id
871
+ params['headline'] = headline
872
+ params['body'] = body
873
+ return doCurl("post","/entity/description",params)
874
+ end
875
+
876
+
877
+ def deleteEntityDescription( entity_id, gen_id)
878
+ params = Hash.new
879
+ params['entity_id'] = entity_id
880
+ params['gen_id'] = gen_id
881
+ return doCurl("delete","/entity/description",params)
882
+ end
883
+
884
+
885
+ def postEntityList( entity_id, headline, body)
886
+ params = Hash.new
887
+ params['entity_id'] = entity_id
888
+ params['headline'] = headline
889
+ params['body'] = body
890
+ return doCurl("post","/entity/list",params)
891
+ end
892
+
893
+
894
+ def deleteEntityList( gen_id, entity_id)
895
+ params = Hash.new
896
+ params['gen_id'] = gen_id
897
+ params['entity_id'] = entity_id
898
+ return doCurl("delete","/entity/list",params)
899
+ end
900
+
901
+
902
+ def postEntityDocument( entity_id, name, filedata)
903
+ params = Hash.new
904
+ params['entity_id'] = entity_id
905
+ params['name'] = name
906
+ params['filedata'] = filedata
907
+ return doCurl("post","/entity/document",params)
908
+ end
909
+
910
+
911
+ def deleteEntityDocument( entity_id, gen_id)
912
+ params = Hash.new
913
+ params['entity_id'] = entity_id
914
+ params['gen_id'] = gen_id
915
+ return doCurl("delete","/entity/document",params)
916
+ end
917
+
918
+
919
+ def postEntityTestimonial( entity_id, title, text, date, testifier_name)
920
+ params = Hash.new
921
+ params['entity_id'] = entity_id
922
+ params['title'] = title
923
+ params['text'] = text
924
+ params['date'] = date
925
+ params['testifier_name'] = testifier_name
926
+ return doCurl("post","/entity/testimonial",params)
927
+ end
928
+
929
+
930
+ def deleteEntityTestimonial( entity_id, gen_id)
931
+ params = Hash.new
932
+ params['entity_id'] = entity_id
933
+ params['gen_id'] = gen_id
934
+ return doCurl("delete","/entity/testimonial",params)
935
+ end
936
+
937
+
938
+ def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)
939
+ params = Hash.new
940
+ params['entity_id'] = entity_id
941
+ params['monday'] = monday
942
+ params['tuesday'] = tuesday
943
+ params['wednesday'] = wednesday
944
+ params['thursday'] = thursday
945
+ params['friday'] = friday
946
+ params['saturday'] = saturday
947
+ params['sunday'] = sunday
948
+ params['closed'] = closed
949
+ params['closed_public_holidays'] = closed_public_holidays
950
+ return doCurl("post","/entity/opening_times",params)
951
+ end
952
+
953
+
954
+ def postEntitySpecial_offer( entity_id, title, description, terms, start_date, expiry_date, url, image_url)
955
+ params = Hash.new
956
+ params['entity_id'] = entity_id
957
+ params['title'] = title
958
+ params['description'] = description
959
+ params['terms'] = terms
960
+ params['start_date'] = start_date
961
+ params['expiry_date'] = expiry_date
962
+ params['url'] = url
963
+ params['image_url'] = image_url
964
+ return doCurl("post","/entity/special_offer",params)
965
+ end
966
+
967
+
968
+ def deleteEntitySpecial_offer( entity_id, gen_id)
969
+ params = Hash.new
970
+ params['entity_id'] = entity_id
971
+ params['gen_id'] = gen_id
972
+ return doCurl("delete","/entity/special_offer",params)
973
+ end
974
+
975
+
976
+ def postUser( email, first_name, last_name, active, trust, creation_date, user_type, social_network, social_network_id)
977
+ params = Hash.new
978
+ params['email'] = email
979
+ params['first_name'] = first_name
980
+ params['last_name'] = last_name
981
+ params['active'] = active
982
+ params['trust'] = trust
983
+ params['creation_date'] = creation_date
984
+ params['user_type'] = user_type
985
+ params['social_network'] = social_network
986
+ params['social_network_id'] = social_network_id
987
+ return doCurl("post","/user",params)
988
+ end
989
+
990
+
991
+ def getUserBy_email( email)
992
+ params = Hash.new
993
+ params['email'] = email
994
+ return doCurl("get","/user/by_email",params)
995
+ end
996
+
997
+
998
+ def getUser( user_id)
999
+ params = Hash.new
1000
+ params['user_id'] = user_id
1001
+ return doCurl("get","/user",params)
1002
+ end
1003
+
1004
+
1005
+ def getUserBy_social_media( name, id)
1006
+ params = Hash.new
1007
+ params['name'] = name
1008
+ params['id'] = id
1009
+ return doCurl("get","/user/by_social_media",params)
1010
+ end
1011
+
1012
+
1013
+ def getAutocompleteCategory( str, language)
1014
+ params = Hash.new
1015
+ params['str'] = str
1016
+ params['language'] = language
1017
+ return doCurl("get","/autocomplete/category",params)
1018
+ end
1019
+
1020
+
1021
+ def getAutocompleteLocation( str, country)
1022
+ params = Hash.new
1023
+ params['str'] = str
1024
+ params['country'] = country
1025
+ return doCurl("get","/autocomplete/location",params)
1026
+ end
1027
+
1028
+
1029
+ def putQueue( queue_name, data)
1030
+ params = Hash.new
1031
+ params['queue_name'] = queue_name
1032
+ params['data'] = data
1033
+ return doCurl("put","/queue",params)
1034
+ end
1035
+
1036
+
1037
+ def deleteQueue( queue_id)
1038
+ params = Hash.new
1039
+ params['queue_id'] = queue_id
1040
+ return doCurl("delete","/queue",params)
1041
+ end
1042
+
1043
+
1044
+ def getQueue( limit, queue_name)
1045
+ params = Hash.new
1046
+ params['limit'] = limit
1047
+ params['queue_name'] = queue_name
1048
+ return doCurl("get","/queue",params)
1049
+ end
1050
+
1051
+
1052
+ def postQueueUnlock( queue_name, seconds)
1053
+ params = Hash.new
1054
+ params['queue_name'] = queue_name
1055
+ params['seconds'] = seconds
1056
+ return doCurl("post","/queue/unlock",params)
1057
+ end
1058
+
1059
+
1060
+ def postQueueError( queue_id, error)
1061
+ params = Hash.new
1062
+ params['queue_id'] = queue_id
1063
+ params['error'] = error
1064
+ return doCurl("post","/queue/error",params)
1065
+ end
1066
+
1067
+
1068
+ def getQueueSearch( type, id)
1069
+ params = Hash.new
1070
+ params['type'] = type
1071
+ params['id'] = id
1072
+ return doCurl("get","/queue/search",params)
1073
+ end
1074
+
1075
+
1076
+ def putTransaction( entity_id, user_id, basket_total, basket, currency, notes)
1077
+ params = Hash.new
1078
+ params['entity_id'] = entity_id
1079
+ params['user_id'] = user_id
1080
+ params['basket_total'] = basket_total
1081
+ params['basket'] = basket
1082
+ params['currency'] = currency
1083
+ params['notes'] = notes
1084
+ return doCurl("put","/transaction",params)
1085
+ end
1086
+
1087
+
1088
+ def postTransactionInprogress( transaction_id, paypal_setexpresscheckout)
1089
+ params = Hash.new
1090
+ params['transaction_id'] = transaction_id
1091
+ params['paypal_setexpresscheckout'] = paypal_setexpresscheckout
1092
+ return doCurl("post","/transaction/inprogress",params)
1093
+ end
1094
+
1095
+
1096
+ def postTransactionAuthorised( transaction_id, paypal_getexpresscheckoutdetails)
1097
+ params = Hash.new
1098
+ params['transaction_id'] = transaction_id
1099
+ params['paypal_getexpresscheckoutdetails'] = paypal_getexpresscheckoutdetails
1100
+ return doCurl("post","/transaction/authorised",params)
1101
+ end
1102
+
1103
+
1104
+ def postTransactionComplete( transaction_id, paypal_doexpresscheckoutpayment, user_id, entity_id)
1105
+ params = Hash.new
1106
+ params['transaction_id'] = transaction_id
1107
+ params['paypal_doexpresscheckoutpayment'] = paypal_doexpresscheckoutpayment
1108
+ params['user_id'] = user_id
1109
+ params['entity_id'] = entity_id
1110
+ return doCurl("post","/transaction/complete",params)
1111
+ end
1112
+
1113
+
1114
+ def postTransactionCancelled( transaction_id)
1115
+ params = Hash.new
1116
+ params['transaction_id'] = transaction_id
1117
+ return doCurl("post","/transaction/cancelled",params)
1118
+ end
1119
+
1120
+
1121
+ def getTransaction( transaction_id)
1122
+ params = Hash.new
1123
+ params['transaction_id'] = transaction_id
1124
+ return doCurl("get","/transaction",params)
1125
+ end
1126
+
1127
+
1128
+ def getTransactionBy_paypal_transaction_id( paypal_transaction_id)
1129
+ params = Hash.new
1130
+ params['paypal_transaction_id'] = paypal_transaction_id
1131
+ return doCurl("get","/transaction/by_paypal_transaction_id",params)
1132
+ end
1133
+
1134
+
1135
+ def postEntityClaim( entity_id, claimed_user_id, claimed_date)
1136
+ params = Hash.new
1137
+ params['entity_id'] = entity_id
1138
+ params['claimed_user_id'] = claimed_user_id
1139
+ params['claimed_date'] = claimed_date
1140
+ return doCurl("post","/entity/claim",params)
1141
+ end
1142
+
1143
+
1144
+ end
1145
+
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: centralindex
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Glynn Bird
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-03-07 00:00:00 +00:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Allows easy integration with the Central Index API
22
+ email: developers@centralindex.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/CentralIndex.rb
31
+ has_rdoc: true
32
+ homepage: http://centralindex.com
33
+ licenses: []
34
+
35
+ post_install_message:
36
+ rdoc_options: []
37
+
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.3.6
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Ruby library for Central Index, the world's local data exchange
61
+ test_files: []
62
+