centralindex 0.0.2 → 0.0.3
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.
- data/lib/CentralIndex.rb +30 -18
- metadata +17 -4
data/lib/CentralIndex.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'net/http'
|
2
|
+
require "rubygems"
|
3
|
+
require "json"
|
2
4
|
|
3
5
|
# global to hold the api key
|
4
6
|
$apiKey = ""
|
@@ -48,7 +50,12 @@ class CentralIndex
|
|
48
50
|
request.set_form_data(params)
|
49
51
|
retval = http.request(request)
|
50
52
|
end
|
51
|
-
|
53
|
+
parsed = JSON.parse(retval.body)
|
54
|
+
if(parsed)
|
55
|
+
return parsed
|
56
|
+
else
|
57
|
+
return retval.body
|
58
|
+
end
|
52
59
|
end
|
53
60
|
|
54
61
|
|
@@ -566,14 +573,13 @@ class CentralIndex
|
|
566
573
|
# @param longitude
|
567
574
|
# @param timezone
|
568
575
|
# @param telephone_number
|
569
|
-
# @param telephone_type
|
570
576
|
# @param email
|
571
577
|
# @param website
|
572
578
|
# @param category_id
|
573
579
|
# @param category_name
|
574
580
|
# @return - the data from the api
|
575
581
|
#
|
576
|
-
def putBusiness( name, address1, address2, address3, district, town, county, postcode, country, latitude, longitude, timezone, telephone_number,
|
582
|
+
def putBusiness( name, address1, address2, address3, district, town, county, postcode, country, latitude, longitude, timezone, telephone_number, email, website, category_id, category_name)
|
577
583
|
params = Hash.new
|
578
584
|
params['name'] = name
|
579
585
|
params['address1'] = address1
|
@@ -588,7 +594,6 @@ class CentralIndex
|
|
588
594
|
params['longitude'] = longitude
|
589
595
|
params['timezone'] = timezone
|
590
596
|
params['telephone_number'] = telephone_number
|
591
|
-
params['telephone_type'] = telephone_type
|
592
597
|
params['email'] = email
|
593
598
|
params['website'] = website
|
594
599
|
params['category_id'] = category_id
|
@@ -600,12 +605,14 @@ class CentralIndex
|
|
600
605
|
#
|
601
606
|
# Provides a personalised URL to redirect a user to add an entity to Central Index
|
602
607
|
#
|
603
|
-
# @param language - The language to use to render the add path
|
608
|
+
# @param language - The language to use to render the add path e.g. en
|
609
|
+
# @param portal_name - The name of the website that data is to be added on e.g. YourLocal
|
604
610
|
# @return - the data from the api
|
605
611
|
#
|
606
|
-
def getEntityAdd( language)
|
612
|
+
def getEntityAdd( language, portal_name)
|
607
613
|
params = Hash.new
|
608
614
|
params['language'] = language
|
615
|
+
params['portal_name'] = portal_name
|
609
616
|
return doCurl("get","/entity/add",params)
|
610
617
|
end
|
611
618
|
|
@@ -745,21 +752,13 @@ class CentralIndex
|
|
745
752
|
# @param entity_id
|
746
753
|
# @param number
|
747
754
|
# @param description
|
748
|
-
# @param premium_rate
|
749
|
-
# @param telephone_type
|
750
|
-
# @param tps
|
751
|
-
# @param ctps
|
752
755
|
# @return - the data from the api
|
753
756
|
#
|
754
|
-
def postEntityPhone( entity_id, number, description
|
757
|
+
def postEntityPhone( entity_id, number, description)
|
755
758
|
params = Hash.new
|
756
759
|
params['entity_id'] = entity_id
|
757
760
|
params['number'] = number
|
758
761
|
params['description'] = description
|
759
|
-
params['premium_rate'] = premium_rate
|
760
|
-
params['telephone_type'] = telephone_type
|
761
|
-
params['tps'] = tps
|
762
|
-
params['ctps'] = ctps
|
763
762
|
return doCurl("post","/entity/phone",params)
|
764
763
|
end
|
765
764
|
|
@@ -785,15 +784,13 @@ class CentralIndex
|
|
785
784
|
# @param entity_id
|
786
785
|
# @param number
|
787
786
|
# @param description
|
788
|
-
# @param premium_rate
|
789
787
|
# @return - the data from the api
|
790
788
|
#
|
791
|
-
def postEntityFax( entity_id, number, description
|
789
|
+
def postEntityFax( entity_id, number, description)
|
792
790
|
params = Hash.new
|
793
791
|
params['entity_id'] = entity_id
|
794
792
|
params['number'] = number
|
795
793
|
params['description'] = description
|
796
|
-
params['premium_rate'] = premium_rate
|
797
794
|
return doCurl("post","/entity/fax",params)
|
798
795
|
end
|
799
796
|
|
@@ -1133,6 +1130,21 @@ class CentralIndex
|
|
1133
1130
|
end
|
1134
1131
|
|
1135
1132
|
|
1133
|
+
#
|
1134
|
+
# Format an address according to the rules of the country supplied
|
1135
|
+
#
|
1136
|
+
# @param address - The address to format
|
1137
|
+
# @param country - The country where the address is based
|
1138
|
+
# @return - the data from the api
|
1139
|
+
#
|
1140
|
+
def getToolsFormatAddress( address, country)
|
1141
|
+
params = Hash.new
|
1142
|
+
params['address'] = address
|
1143
|
+
params['country'] = country
|
1144
|
+
return doCurl("get","/tools/format/address",params)
|
1145
|
+
end
|
1146
|
+
|
1147
|
+
|
1136
1148
|
#
|
1137
1149
|
# With a known entity id, an invoice_address object can be updated.
|
1138
1150
|
#
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Glynn Bird
|
@@ -16,8 +16,21 @@ cert_chain: []
|
|
16
16
|
|
17
17
|
date: 2013-03-07 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: json
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 7
|
30
|
+
- 7
|
31
|
+
version: 1.7.7
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
21
34
|
description: Allows easy integration with the Central Index API
|
22
35
|
email: developers@centralindex.com
|
23
36
|
executables: []
|