listingcheck_api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -2
- data/lib/listingcheck_api.rb +20 -2
- data/lib/listingcheck_api/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -24,7 +24,9 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
api = ListingcheckApi::Client.new(:auth_token => 'your_ubersecret_token')
|
26
26
|
|
27
|
-
|
27
|
+
### Scan
|
28
|
+
|
29
|
+
Locally setup a new Scan to perform:
|
28
30
|
|
29
31
|
place = ListingcheckApi::Place.new(:name => 'Tam Tam', :phone => '015-7502000', :address => 'Patrijsweg 80', :city => 'Rijswijk')
|
30
32
|
scan = ListingcheckApi::Scan.new(:scan_group => 'restaurants', :place_attributes => place)
|
@@ -32,10 +34,25 @@ Locally setup a new Scan to peform:
|
|
32
34
|
Send API call to create the scan and next perform it.
|
33
35
|
|
34
36
|
api.create_scan(scan)
|
35
|
-
api.perform_scan
|
37
|
+
api.perform_scan(scan.access_token)
|
36
38
|
|
37
39
|
You will receive the Scan with a unique access_token and all matched listings.
|
38
40
|
|
41
|
+
### Listings
|
42
|
+
|
43
|
+
To directly retreive a certain Listing of which you know the uid and type.
|
44
|
+
With this request the Listing should exist at ListingCheck (eg. from a previous Scan)!
|
45
|
+
|
46
|
+
api.listing('facebook_places_listing', 142709532406955)
|
47
|
+
|
48
|
+
To refresh a certain Listing from the original source:
|
49
|
+
|
50
|
+
api.refresh_listing('facebook_places_listing', 142709532406955)
|
51
|
+
|
52
|
+
To create a new Listing (independent of a Scan):
|
53
|
+
|
54
|
+
api.create_listing('facebook_places_listing', 142709532406955)
|
55
|
+
|
39
56
|
## Supported Listings
|
40
57
|
|
41
58
|
We currently support (among others) listings from:
|
data/lib/listingcheck_api.rb
CHANGED
@@ -9,7 +9,8 @@ require 'api_smith'
|
|
9
9
|
# api.post('listings_scans.json', {:extra_query => {:listings_scan => scan}})
|
10
10
|
# api.perform_scan
|
11
11
|
# api.listing('facebook_places_listing', 142709532406955)
|
12
|
-
# api.
|
12
|
+
# api.refresh_listing('facebook_places_listing', 142709532406955)
|
13
|
+
# api.create_listing('facebook_places_listing', 142709532406955)
|
13
14
|
module ListingcheckApi
|
14
15
|
|
15
16
|
class Listing < APISmith::Smash
|
@@ -17,11 +18,23 @@ module ListingcheckApi
|
|
17
18
|
property :uid
|
18
19
|
property :url
|
19
20
|
property :name
|
20
|
-
property :phone
|
21
21
|
property :full_address
|
22
22
|
property :country_code
|
23
|
+
|
24
|
+
property :phone
|
25
|
+
property :fax
|
26
|
+
property :website
|
27
|
+
property :email
|
28
|
+
|
23
29
|
property :lat
|
24
30
|
property :lng
|
31
|
+
|
32
|
+
property :rating
|
33
|
+
property :reviews_count
|
34
|
+
property :checkins.count
|
35
|
+
property :likes_count
|
36
|
+
property :talking_about_count
|
37
|
+
property :were_here_count
|
25
38
|
end
|
26
39
|
|
27
40
|
class Place < APISmith::Smash
|
@@ -104,6 +117,11 @@ module ListingcheckApi
|
|
104
117
|
self.put("listing_types/#{type}/listings/#{uid}.json", :transform => Listing)
|
105
118
|
end
|
106
119
|
|
120
|
+
# Updates an existing Listing of a particular type with the latest info from the API.
|
121
|
+
def refresh_listing(type, uid)
|
122
|
+
self.put("listing_types/#{type}/listings/#{uid}/refresh.json", :transform => Listing)
|
123
|
+
end
|
124
|
+
|
107
125
|
def check_response_errors(response)
|
108
126
|
# In 2XX range is success otherwise it's probably error (3XX redirects range is handled by HTTParty).
|
109
127
|
# In case of error we lookup error class or default to ApiError.
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 2
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joost Hietbrink
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-10-
|
17
|
+
date: 2012-10-12 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|