yellow_api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.autotest ADDED
@@ -0,0 +1 @@
1
+ require 'autotest/bundler'
data/.gitignore ADDED
@@ -0,0 +1,42 @@
1
+ !.gitignore
2
+ *.gem
3
+ *.rbc
4
+ *.sw[a-p]
5
+ *.tmproj
6
+ *.tmproject
7
+ *.un~
8
+ *~
9
+ .DS_Store
10
+ .Spotlight-V100
11
+ .Trashes
12
+ ._*
13
+ .bundle
14
+ .config
15
+ .directory
16
+ .elc
17
+ .redcar
18
+ .yardoc
19
+ /.emacs.desktop
20
+ /.emacs.desktop.lock
21
+ Desktop.ini
22
+ Gemfile.lock
23
+ Icon?
24
+ InstalledFiles
25
+ Session.vim
26
+ Thumbs.db
27
+ \#*\#
28
+ _yardoc
29
+ auto-save-list
30
+ coverage
31
+ doc/
32
+ lib/bundler/man
33
+ pkg
34
+ pkg/*
35
+ rdoc
36
+ spec/reports
37
+ test/tmp
38
+ test/version_tmp
39
+ tmp
40
+ tags
41
+ tmtags
42
+ tramp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Ian Bishop
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Yellow API
2
+
3
+ Ruby wrapper for the YellowPages' Yellow API
4
+
5
+ ## Installation
6
+ gem install yellow-api
7
+
8
+ ## Documentation
9
+ [See here](http://rdoc.info/gems/yellow-api)
10
+
11
+ ## Examples
12
+
13
+ ## Inspiration
14
+ API style was largely stolen/inspired by [hacker_news_search](https://github.com/ryanatwork/hacker_news_search) and [twitter](https://github.com/jnunemaker/twitter).
15
+
16
+ ## Copyright
17
+ See [LICENSE](https://github.com/ianbishop/yellow_api/blob/master/LICENSE.md) for more details.
data/Rakefile ADDED
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require 'bundler'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ require 'rspec/core/rake_task'
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
10
+ task :test => :spec
11
+
12
+ require 'yard'
13
+ namespace :doc do
14
+ YARD::Rake::YardocTask.new do |task|
15
+ task.files = ['LICENSE.md', 'lib/**/*.rb']
16
+ task.options = ['--markup', 'markdown']
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ require 'faraday_middleware'
2
+
3
+ module YellowApi
4
+ class Client
5
+ module Connection
6
+ private
7
+
8
+ def connection(options={})
9
+ sandbox_enable = options.fetch(:sandbox_enabled, sandbox_enabled)
10
+ url = sandbox_enable ? options.fetch(:sandbox_endpoint, sandbox_endpoint) : options.fetch(:endpoint, endpoint)
11
+
12
+ @connection ||= Faraday.new(:url => url) do |builder|
13
+ builder.use Faraday::Request::UrlEncoded
14
+ builder.use Faraday::Response::RaiseError
15
+ builder.use Faraday::Response::Rashify
16
+ builder.use Faraday::Response::ParseJson
17
+ builder.adapter(Faraday.default_adapter)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ module YellowApi
2
+ class Client
3
+ module FindBusiness
4
+
5
+ # Returns a listing of businesses matching specified criteria
6
+ #
7
+ # @see http://www.yellowapi.com/docs/places/#findbusiness
8
+ # @note Max 5000 results returned
9
+ # @rate_limited Yes
10
+ # @requires_authentication Yes
11
+ # @param what [String] Keyword search term. Any text string.
12
+ # For example "restaurant". Non-ASCII characters should be escaped
13
+ # @param where [String] The location to search. May be a location name or coordinate in format cZ{longitude},{latitude}.
14
+ # @param options [Hash] A customizable set of options
15
+ # @option options [Integer] :pg The requested page. Default 1. Max 50.
16
+ # @option options [String] :lang en - English (default), fr - French
17
+ # @option options [Integer] :pgLen Number of results per page. Default 40. Max 100.
18
+ # @option options [String] :sflag Search flags.
19
+ # bn - {what} is a business name, fto - results have photos, vdo - results have videos
20
+ # @return {Hash}
21
+ # @example
22
+ # YellowApi.find_business("restaurant", "Toronto")
23
+ # YellowApi.find_business("h%C3%B4tels", "cZ-73.61995,45.49981")
24
+ def find_business(what, where, options={})
25
+ options[:what] = what
26
+ options[:where] = where
27
+
28
+ get('/FindBusiness/', options)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ module YellowApi
2
+ class Client
3
+ module FindDealer
4
+
5
+ # Returns a list of all dealers/franchises/branches for that business.
6
+ #
7
+ # @see http://www.yellowapi.com/docs/places/#finddealer
8
+ # @note A business with several locations may have a "parent" listing (primary) and one or more "children" listings.
9
+ # @rate_limited Yes
10
+ # @requires_authentication Yes
11
+ # @param parent_id [Integer] The listingId of a parent business.
12
+ # A parent business can be identified by the ‘isParent’ flag in the Listing object returned by FindBusinesses.
13
+ # @param options [Hash] A customizable set of options
14
+ # @option options [Integer] :pg The requested page. Default 1. Max 50.
15
+ # @option options [String] :lang en - English (default), fr - French
16
+ # @option options [Integer] :pgLen Number of results per page. Default 40. Max 100.
17
+ # @return {Hash}
18
+ # @example
19
+ # YellowApi.find_dealer(6418182)
20
+ # YellowApi.find_dealer(6418182, { :pgLen => 1 })
21
+ def find_dealer(parent_id, options={})
22
+ options[:pid] = parent_id
23
+
24
+ get('/FindDealer/', options)
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,32 @@
1
+ module YellowApi
2
+ class Client
3
+ module GetBusinessDetails
4
+
5
+ # Gets business details.
6
+ #
7
+ # @see http://www.yellowapi.com/docs/places/#getbusinessdetails
8
+ # @note Requires a FindBusiness call first.
9
+ # Information returned on this first call provides the necessary information for the GetBusinessDetails call.
10
+ # @rate_limited Yes
11
+ # @requires_authentication Yes
12
+ # @param province [String] Normalized formatted name of province where the business is located.
13
+ # If not available, use "Canada"
14
+ # @param business_name [String] Business name
15
+ # @param listing_id [Integer] The unique listing id identifying the business
16
+ # @param options [Hash] A customizable set of options
17
+ # @option options [String] :city The city location of the business
18
+ # @option options [String] :lang en - English (default), fr - French
19
+ # @return {Hash}
20
+ # @example
21
+ # YellowApi.get_business_details("Ile-du-Prince-Edouard", "Co-operators-The", 6418182)
22
+ def get_business_details(province, business_name, listing_id, options={})
23
+ options[:prov] = province
24
+ options["bus-name"] = business_name
25
+ options[:listingId] = listing_id
26
+
27
+ get('/GetBusinessDetails/', options)
28
+ end
29
+
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ module YellowApi
2
+ class Client
3
+ module GetTypeAhead
4
+
5
+ # The type ahead call returns search suggestions based on the characters a user has entered.
6
+ # The user can select the suggested term, saving them from having to enter all the characters for their search term.
7
+ #
8
+ # @see http://www.yellowapi.com/docs/places/#gettypeahead
9
+ # @rate_limited Yes
10
+ # @reqires_authentication Yes
11
+ #
12
+ # @param text [String] Characters typed by user
13
+ # @param field [Symbol] Which field to suggest, :what or :where
14
+ # @param lang [String] Suggestion languages (en - English [default], fr - French)
15
+ # @return {Hash}
16
+ # @example
17
+ # YellowApi.get_type_ahead("au", :what)
18
+ # YellowApi.get_type_ahead("monc", :where, "fr")
19
+ def get_type_ahead(text, field, lang="en")
20
+ options = {
21
+ :text => text,
22
+ :lang => lang,
23
+ :field => field.to_s.upcase
24
+ }
25
+ get('/GetTypeAhead/', options)
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ require 'uuid'
2
+
3
+ module YellowApi
4
+ class Client
5
+ module Request
6
+
7
+ # generates a UUID for a given instance
8
+ # @see https://github.com/assaf/uuid
9
+ def uid
10
+ @uid ||= UUID.new.generate(:compact)
11
+ end
12
+
13
+ def get(path, options={})
14
+ # stuff that's sent with every request
15
+ # but define by api initialization
16
+ options[:apikey] = apikey
17
+ options[:fmt] = fmt
18
+ options[:UID] = uid
19
+
20
+ request(:get, path, options)
21
+ end
22
+
23
+ def request(method, path, options)
24
+ response = connection.send(method) do |request|
25
+ request.url(path, options)
26
+ end
27
+ response.body
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,33 @@
1
+ require 'yellow_api/config'
2
+ require 'yellow_api/client/connection'
3
+ require 'yellow_api/client/request'
4
+ require 'yellow_api/client/find_business'
5
+ require 'yellow_api/client/get_business_details'
6
+ require 'yellow_api/client/find_dealer'
7
+ require 'yellow_api/client/get_type_ahead'
8
+
9
+ module YellowApi
10
+ class Client
11
+ include YellowApi::Client::Connection
12
+ include YellowApi::Client::Request
13
+
14
+ include YellowApi::Client::FindBusiness
15
+ include YellowApi::Client::GetBusinessDetails
16
+ include YellowApi::Client::FindDealer
17
+ include YellowApi::Client::GetTypeAhead
18
+
19
+ attr_accessor *Config::VALID_OPTIONS_KEYS
20
+
21
+ # Initializes a new API object
22
+ #
23
+ # @param attrs [Hash]
24
+ # @return [YellowApi::Client]
25
+ def initialize(attrs={})
26
+ YellowApi.reset #TODO: this shouldn't be required since I'm extending config?
27
+ attrs = YellowApi.options.merge(attrs)
28
+ Config::VALID_OPTIONS_KEYS.each do |k|
29
+ instance_variable_set("@#{k}".to_sym, attrs[k])
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,71 @@
1
+ require 'yellow_api/version'
2
+
3
+ module YellowApi
4
+
5
+ # Defines constants for default configuration
6
+ module Config
7
+
8
+ DEFAULT_APIKEY = nil
9
+
10
+ # The endpoint that will be used to connect if none is set and
11
+ # mode is not set to sandbox
12
+ #
13
+ # @see http://www.yellowapi.com/docs/places/#doc_char
14
+ DEFAULT_ENDPOINT = "http://api.yellowapi.com"
15
+
16
+ # The endpoint that will be used to connect if none is set and
17
+ # mode is set to sandbox
18
+ #
19
+ # @see http://www.yellowapi.com/docs/places/#doc_char
20
+ DEFAULT_SANDBOX_ENDPOINT = "http://api.sandbox.yellowapi.com"
21
+
22
+ # Sets the configuration for which type of API key is being used
23
+ # @note Changing this to be enabled will automatically switch to using the DEFAULT_SANDBOX_ENDPOINT
24
+ # @see http://www.yellowapi.com/docs/places/#doc_char
25
+ DEFAULT_SANDBOX_ENABLED = false
26
+
27
+ # Content type of response to be consumed
28
+ # @note This is currently fixed at JSON, as there is no XML support at this time
29
+ DEFAULT_FMT="JSON"
30
+
31
+ # Keys which can be configured
32
+ VALID_OPTIONS_KEYS = [
33
+ :apikey,
34
+ :endpoint,
35
+ :sandbox_endpoint,
36
+ :sandbox_enabled,
37
+ :fmt
38
+ ]
39
+
40
+ attr_accessor *VALID_OPTIONS_KEYS
41
+
42
+ # When this module is extended, set all configurations back to defaults
43
+ def self.extend(base)
44
+ base.reset
45
+ end
46
+
47
+ # Allows configuration options to be set in a block
48
+ def configure
49
+ yield self
50
+ self
51
+ end
52
+
53
+ # Create a hash of options and their values
54
+ def options
55
+ options = {}
56
+ VALID_OPTIONS_KEYS.each do |k|
57
+ options[k] = send(k)
58
+ end
59
+ options
60
+ end
61
+
62
+ # Reset all configurations back to defaults
63
+ def reset
64
+ self.apikey = DEFAULT_APIKEY
65
+ self.endpoint = DEFAULT_ENDPOINT
66
+ self.sandbox_endpoint = DEFAULT_SANDBOX_ENDPOINT
67
+ self.sandbox_enabled = DEFAULT_SANDBOX_ENABLED
68
+ self.fmt = DEFAULT_FMT
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,3 @@
1
+ module YellowApi
2
+ VERSION = "0.0.1"
3
+ end
data/lib/yellow_api.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'yellow_api/client'
2
+ require 'yellow_api/config'
3
+
4
+ module YellowApi
5
+ extend Config
6
+
7
+ class << self
8
+
9
+ # Alias for YellowApi::Client.new
10
+ #
11
+ # @return [YellowApi::Client]
12
+ def new(options={})
13
+ YellowApi::Client.new(options)
14
+ end
15
+
16
+ # Delegate to YellowApi::Client
17
+ def method_missing(method, *args, &block)
18
+ return super unless new.respond_to?(method)
19
+ new.send(method, *args, &block)
20
+ end
21
+
22
+ def respond_to?(method, include_private=false)
23
+ new.respond_to?(method, include_private) || super(method, include_private)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1 @@
1
+ {"summary":{"what":"barber","where":"Canada","latitude":"","longitude":"","firstListing":1,"lastListing":10,"totalListings":9259,"pageCount":926,"currentPage":1,"listingsPerPage":10,"Prov":"CA","Categories":["21"],"BusCategories":[{"id":"21","type":"mbf","name":null}]},"listings":[{"type":"REGULAR","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":true,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":true,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"346760","name":"Chantal coiffure pour hommes","address":{"street":"4240, boul D\u00e9carie","city":"Montr\u00e9al","prov":"QC","pcode":"H4A3K3"},"geoCode":{"latitude":"45.4792448904","longitude":"-73.619658421"}},{"type":"REGULAR","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":true,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":true,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"5947330","name":"Personal Touch Hairstyling By Rosa & Company","address":{"street":"425 West St N","city":"Orillia","prov":"ON","pcode":"L3V7R2"},"geoCode":{"latitude":"44.622871","longitude":"-79.431773"}},{"type":"GSP","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":true,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":true,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":true,"inMkt":false},"Logo":{"avail":true,"inMkt":false}},"Deal":null,"id":"3753030","name":"Bayshore Hairstylists","address":{"street":"100 Bayshore Dr","city":"Nepean","prov":"ON","pcode":"K2B8C1"},"geoCode":{"latitude":"45.3476665","longitude":"-75.8063936"}},{"type":"REGULAR","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"2355027","name":"Kings Court Barber Shop","address":{"street":"101-9914 Morrison St","city":"Fort Mcmurray","prov":"AB","pcode":"T9H4A4"},"geoCode":{"latitude":"56.728199","longitude":"-111.385077"}},{"type":"REGULAR","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"2112636","name":"Barber Shoppe The","address":{"street":"208 Steele St","city":"Whitehorse","prov":"YT","pcode":"Y1A2C4"},"geoCode":{"latitude":"60.7202","longitude":"-135.054335"}},{"type":"L2","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":true,"inMkt":false}},"Deal":null,"id":"7238548","name":"Cindy's Beauty & Barber Shop","address":{"street":"220 Prescott","city":"Kemptville","prov":"ON","pcode":"K0G1J0"},"geoCode":{"latitude":"45.015029","longitude":"-75.643939"}},{"type":"REGULAR","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7688335","name":"Coiffure Hom\u00e9gars","address":{"street":"1324 Bd Talbot","city":"Chicoutimi","prov":"QC","pcode":""},"geoCode":{"latitude":"48.405119","longitude":"-71.057847"}},{"type":"REGULAR","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"39102","name":"Adam & Eve Unisex Centre Barbers & Hairstylists","address":{"street":"Red Deer Centre","city":"Red Deer","prov":"AB","pcode":"T4N4C7"},"geoCode":null},{"type":"REGULAR","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":true,"inMkt":false},"Logo":{"avail":true,"inMkt":false}},"Deal":null,"id":"4072485","name":"Alberta Barbers","address":{"street":"103-4929 50 St","city":"Red Deer","prov":"AB","pcode":"T4N1X9"},"geoCode":{"latitude":"52.269025","longitude":"-113.812767"}},{"type":"L2","parentId":"","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":true,"inMkt":false},"DspAd":{"avail":true,"inMkt":false},"Url":{"avail":true,"inMkt":false},"Logo":{"avail":true,"inMkt":false}},"Deal":null,"id":"812045","name":"Impressions Hair And Aesthetic","address":{"street":"2163 Sixth Line","city":"Oakville","prov":"ON","pcode":"L6H3N7"},"geoCode":{"latitude":"43.468481595","longitude":"-79.7181089355"}}]}
@@ -0,0 +1 @@
1
+ ry":{"what":"","where":"","latitude":"","longitude":"","firstListing":1,"lastListing":40,"totalListings":553,"pageCount":14,"currentPage":1,"listingsPerPage":40,"Prov":null,"Categories":["999"],"BusCategories":[{"id":"999","type":"mbf","name":null}]},"listings":[{"type":"NPP","parentId":"6418182","isParent":true,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":true,"inMkt":false},"Logo":{"avail":true,"inMkt":false}},"Deal":null,"id":"6418182","name":"Co-Operators The","address":{"street":"","city":"","prov":"","pcode":""},"geoCode":null},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763253","name":"Aaron E Cronk","address":{"street":"591 Argus Rd","city":"Oakville","prov":"ON","pcode":"L6J3J4"},"geoCode":{"latitude":"43.458028","longitude":"-79.684687"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763254","name":"Aaron Mones","address":{"street":"2158 2nd Ave","city":"Whitehorse","prov":"YT","pcode":"Y1A5N9"},"geoCode":{"latitude":"60.72325","longitude":"-135.055013"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7916729","name":"Adam Funnell","address":{"street":"45 Charles St W","city":"Ingersoll","prov":"ON","pcode":"N5C2L5"},"geoCode":{"latitude":"43.038522","longitude":"-80.885064"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763275","name":"Adam Hambrook","address":{"street":"136 Ellen St","city":"Nelson-Miramichi","prov":"NB","pcode":"E1V3M4"},"geoCode":{"latitude":"47.001609","longitude":"-65.56543"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7563250","name":"Adams Gail","address":{"street":"5-3111 Kempt Rd","city":"Halifax","prov":"NS","pcode":"B3K5N6"},"geoCode":{"latitude":"44.659346","longitude":"-63.603462"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7759574","name":"Adele F. Read CFP, CLU, CHFC","address":{"street":"3473 Kingston Rd","city":"Scarborough","prov":"ON","pcode":"M1M1R4"},"geoCode":{"latitude":"43.737909","longitude":"-79.217971"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763278","name":"Adnan Bihnan","address":{"street":"203 Main St N","city":"Brampton","prov":"ON","pcode":"L6X1N2"},"geoCode":{"latitude":"43.689523","longitude":"-79.764802"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7089654","name":"Alan Pereira","address":{"street":"5-1834 Lakeshore Rd W","city":"Mississauga","prov":"ON","pcode":"L5J1J7"},"geoCode":{"latitude":"43.515102","longitude":"-79.625493"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763302","name":"Alex Byrne","address":{"street":"1250 Stittsville Main St.","city":"Stittsville","prov":"ON","pcode":"K2S1S9"},"geoCode":{"latitude":"45.270452","longitude":"-75.929931"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763308","name":"Alicia LeBlanc","address":{"street":"1-179 Irving Blvd","city":"Bouctouche","prov":"NB","pcode":"E4S3K3"},"geoCode":{"latitude":"46.464587","longitude":"-64.733262"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763316","name":"Allen Bouvier","address":{"street":"1055 N Devonshire Dr","city":"Regina","prov":"SK","pcode":"S4X2X4"},"geoCode":{"latitude":"50.49475","longitude":"-104.672052"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763317","name":"Allen Morrison","address":{"street":"25 Industrial Dr","city":"Elmira","prov":"ON","pcode":"N3B3K3"},"geoCode":{"latitude":"43.589525","longitude":"-80.561153"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7948834","name":"Alok Singh Tomar","address":{"street":"1820 Bayview Ave","city":"Toronto","prov":"ON","pcode":"M4G4G7"},"geoCode":{"latitude":"43.712659","longitude":"-79.377391"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7090047","name":"Alpna Chopra","address":{"street":"2-370 Eastbridge Blvd","city":"Waterloo","prov":"ON","pcode":"N2K4P1"},"geoCode":{"latitude":"43.503933","longitude":"-80.509083"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7759266","name":"Amy Wang","address":{"street":"1462 Midland Ave","city":"Scarborough","prov":"ON","pcode":"M1P3B9"},"geoCode":{"latitude":"43.752926","longitude":"-79.265522"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7368487","name":"Andrea Piquette","address":{"street":"10116 101 Ave","city":"Lac La Biche","prov":"AB","pcode":""},"geoCode":{"latitude":"54.769825","longitude":"-111.977962"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7878134","name":"Andrew Allison","address":{"street":"7B-1633 Mountain Rd","city":"Moncton","prov":"NB","pcode":"E1G1A5"},"geoCode":{"latitude":"46.1177992759","longitude":"-64.841157791"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7878074","name":"Andrew Smith","address":{"street":"534 Montreal Rd","city":"Ottawa","prov":"ON","pcode":"K1K0T9"},"geoCode":{"latitude":"45.441594","longitude":"-75.645372"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7089784","name":"Andrew Winsor","address":{"street":"1062 Topsail Rd. PO Box 760","city":"Mount Pearl","prov":"NL","pcode":"A1N5E6"},"geoCode":{"latitude":"47.525927","longitude":"-52.81376"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763334","name":"Andrew Winsor","address":{"street":"82 Main St","city":"Grand Bank","prov":"NL","pcode":"A0E1W0"},"geoCode":{"latitude":"47.0959950632","longitude":"-55.7669816863"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7759209","name":"Andy Chow","address":{"street":"359-4168 Finch Ave E","city":"Scarborough","prov":"ON","pcode":"M1S5H6"},"geoCode":{"latitude":"43.803354","longitude":"-79.288102"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7845080","name":"Angie Ciotti","address":{"street":"1359 Main St E","city":"Hamilton","prov":"ON","pcode":"L8K1B6"},"geoCode":{"latitude":"43.240966","longitude":"-79.812553"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763338","name":"Anthony C. Traversa","address":{"street":"1253 Silvan Forest Dr","city":"Burlington","prov":"ON","pcode":"L7M0B7"},"geoCode":{"latitude":"43.376077","longitude":"-79.794231"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763339","name":"Anthony Yu","address":{"street":"308-500 Sheppard Ave E","city":"North York","prov":"ON","pcode":"M2N6H7"},"geoCode":{"latitude":"43.766553","longitude":"-79.388312"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7759789","name":"Arfan Devji","address":{"street":"622-1000 Hamptons Dr NW","city":"Calgary","prov":"AB","pcode":"T3A6A7"},"geoCode":{"latitude":"51.142725","longitude":"-114.131196"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763352","name":"Arne Bratland","address":{"street":"5132-50 St Bay 1 PO Box 6365 Stn Main","city":"Drayton Valley","prov":"AB","pcode":"T7A1R8"},"geoCode":{"latitude":"53.2244642582","longitude":"-114.97914494"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763358","name":"Arun Mehra","address":{"street":"103-276 Bedford Hwy","city":"Halifax","prov":"NS","pcode":"B3M2K6"},"geoCode":{"latitude":"44.678118","longitude":"-63.649891"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7845335","name":"Ashleigh Mingo","address":{"street":"2345 Rabbit Hill Rd NW","city":"Edmonton","prov":"AB","pcode":"T6R3L6"},"geoCode":{"latitude":"53.454843","longitude":"-113.565582"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763398","name":"Baani Kahai","address":{"street":"102-333 Wilson Ave","city":"North York","prov":"ON","pcode":"M3H1T2"},"geoCode":{"latitude":"43.737091","longitude":"-79.435489"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763406","name":"Barbara Jones","address":{"street":"248 First St","city":"Midland","prov":"ON","pcode":"L4R0A8"},"geoCode":{"latitude":"44.749773","longitude":"-79.887074"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7975229","name":"Ben Anders","address":{"street":"9708 153 Ave NW","city":"Edmonton","prov":"AB","pcode":"T5X5V2"},"geoCode":{"latitude":"53.614127","longitude":"-113.493188"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763447","name":"Beth Hackett","address":{"street":"4247 Oil Heritage Rd SE PO Box 910","city":"Petrolia","prov":"ON","pcode":"N0N1R0"},"geoCode":{"latitude":"42.884169","longitude":"-82.123769"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763449","name":"Beverly M Barker","address":{"street":"1082 Cole Harbour Rd","city":"Cole Harbour","prov":"NS","pcode":"B2V1E7"},"geoCode":{"latitude":"44.671944","longitude":"-63.487731"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763452","name":"Bill Bachra","address":{"street":"112-18 Crown Steel Dr","city":"Markham","prov":"ON","pcode":"L3R9X8"},"geoCode":{"latitude":"43.839288","longitude":"-79.325171"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763453","name":"Bill McGimpsey, CFP","address":{"street":"13-720 Fourteenth St W","city":"Cornwall","prov":"ON","pcode":"K6J5T9"},"geoCode":{"latitude":"45.030189","longitude":"-74.755345"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7090088","name":"Bingbing Cai","address":{"street":"20-4 Lorry Greenberg Dr","city":"Ottawa","prov":"ON","pcode":"K1G5H6"},"geoCode":{"latitude":"45.369657","longitude":"-75.621732"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"7878382","name":"Bonnie Chan","address":{"street":"30-2677 Kennedy Rd","city":"Scarborough","prov":"ON","pcode":"M1T3H8"},"geoCode":{"latitude":"43.795472","longitude":"-79.293574"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763481","name":"Boris Schaffer","address":{"street":"7023 Nesters Rd RR 7","city":"Whistler","prov":"BC","pcode":"V0N1B7"},"geoCode":{"latitude":"50.128633","longitude":"-122.954562"}},{"type":"REGULAR","parentId":"6418182","isParent":false,"distance":"","content":{"Video":{"avail":false,"inMkt":false},"Photo":{"avail":false,"inMkt":false},"Profile":{"avail":false,"inMkt":false},"DspAd":{"avail":false,"inMkt":false},"Url":{"avail":false,"inMkt":false},"Logo":{"avail":false,"inMkt":false}},"Deal":null,"id":"6763480","name":"Boris Schaffer","address":{"street":"806 6th Ave W","city":"Vancouver","prov":"BC","pcode":"V5Z1A6"},"geoCode":{"latitude":"49.26593","longitude":"-123.123386"}}]}
@@ -0,0 +1 @@
1
+ {"phones":[],"categories":[{"name":"General Insurance","isSensitive":false}],"products":{"webUrl":["http:\/\/www.cooperators.ca","http:\/\/www.cooperators.ca","http:\/\/www.cooperators.ca"],"dispAd":[],"videos":[],"photos":[],"profiles":[],"listPres":[{"lang":"en","extLines":{"1":"Individuals are unique. Our insurance plans are tailored to fit your needs. In over 600 communities, we`re there to provide the insurance coverage you need at affordable rates. Please call for hours."}},{"lang":"fr","extLines":{"1":"Individuals are unique. Our insurance plans are tailored to fit your needs. In over 600 communities, we`re there to provide the insurance coverage you need at affordable rates. Please call for hours."}},{"lang":"en","extLines":{"1":"Individuals Are Unique. Our Insurance Plans Are Tailored To Fit Your Needs. In Over 600 Communities, We`re There To Provide The Insurance Coverage You Need At Affordable Rates. Please Call For Hours."}},{"lang":"fr","extLines":{"1":"Individuals Are Unique. Our Insurance Plans Are Tailored To Fit Your Needs. In Over 600 Communities, We`re There To Provide The Insurance Coverage You Need At Affordable Rates. Please Call For Hours."}}],"listPresEx":[{"type":"","lang":"en","extLines":{"1":"Individuals are unique. Our insurance plans are tailored to fit your needs. In over 600 communities, we`re there to provide the insurance coverage you need at affordable rates. Please call for hours."}},{"type":"","lang":"fr","extLines":{"1":"Individuals are unique. Our insurance plans are tailored to fit your needs. In over 600 communities, we`re there to provide the insurance coverage you need at affordable rates. Please call for hours."}},{"type":"GSP","lang":"en","extLines":{"1":"Individuals are unique. Our insurance plans are tailored to fit your needs. In over 600 communities, we`re there to provide the insurance coverage you need at affordable rates. Please call for hours."}},{"type":"GSP","lang":"fr","extLines":{"1":"Individuals are unique. Our insurance plans are tailored to fit your needs. In over 600 communities, we`re there to provide the insurance coverage you need at affordable rates. Please call for hours."}},{"type":"GSP","lang":"en","extLines":{"1":"Individuals Are Unique. Our Insurance Plans Are Tailored To Fit Your Needs. In Over 600 Communities, We`re There To Provide The Insurance Coverage You Need At Affordable Rates. Please Call For Hours."}},{"type":"GSP","lang":"fr","extLines":{"1":"Individuals Are Unique. Our Insurance Plans Are Tailored To Fit Your Needs. In Over 600 Communities, We`re There To Provide The Insurance Coverage You Need At Affordable Rates. Please Call For Hours."}}]},"logos":{"EN":"http:\/\/cdn.ci9.yp.ca\/14884561aa_t.gif","FR":"http:\/\/cdn.ci9.yp.ca\/14884561aa_t.gif"},"logosEx":[{"logo":"http:\/\/cdn.ci9.yp.ca\/14884561aa_t.gif","type":"TPP","lang":"EN"},{"logo":"http:\/\/cdn.ci9.yp.ca\/14884561aa_t.gif","type":"TPP","lang":"FR"}],"id":"6418182","name":"Co-Operators The","address":{"street":"","city":"","prov":"","pcode":""},"geoCode":null,"merchantUrl":"http:\/\/www.yellowpages.ca\/bus\/Prince-Edward-Island\/Calgary\/Co-operators-The\/6418182.html?ypid="}
data/spec/helper.rb ADDED
@@ -0,0 +1,54 @@
1
+ $:.unshift File.expand_path('..', __FILE__)
2
+ $:.unshift File.expand_path('../../lib', __FILE__)
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'yellow_api'
6
+ require 'rspec'
7
+ require 'webmock/rspec'
8
+
9
+ # make sure that tests don't fail because of rate limits
10
+ # @see http://www.programmersparadox.com/2012/03/05/testing-api-integrations-in-rspec/
11
+ def wait(time, &block)
12
+ sleep time
13
+ yield
14
+ end
15
+
16
+ def a_delete(path)
17
+ a_request(:delete, 'http://api.yellowapi.com/' + path)
18
+ end
19
+
20
+ def a_get(path)
21
+ a_request(:get, 'http://api.yellowapi.com/' + path)
22
+ end
23
+
24
+ def a_post(path)
25
+ a_request(:post, 'http://api.yellowapi.com/' + path)
26
+ end
27
+
28
+ def a_put(path)
29
+ a_request(:put, 'http://api.yellowapi.com/' + path)
30
+ end
31
+
32
+ def stub_delete(path)
33
+ stub_request(:delete, 'http://api.yellowapi.com/' + path)
34
+ end
35
+
36
+ def stub_get(path)
37
+ stub_request(:get, 'http://api.yellowapi.com/' + path)
38
+ end
39
+
40
+ def stub_post(path)
41
+ stub_request(:post, 'http://api.yellowapi.com/' + path)
42
+ end
43
+
44
+ def stub_put(path)
45
+ stub_request(:put, 'http://api.yellowapi.com/' + path)
46
+ end
47
+
48
+ def fixture_path
49
+ File.expand_path('../fixtures', __FILE__)
50
+ end
51
+
52
+ def fixture(file)
53
+ File.new(fixture_path + '/' + file)
54
+ end
@@ -0,0 +1,5 @@
1
+ require 'helper'
2
+
3
+ describe YellowApi::Client do
4
+
5
+ end
@@ -0,0 +1,26 @@
1
+ require 'helper'
2
+
3
+ describe YellowApi::Client::FindBusiness do
4
+
5
+ before do
6
+ @client = YellowApi::Client.new(:apikey => "a1s2d3f4g5h6j7k8l9k6j5j4")
7
+ end
8
+
9
+ describe ".find_business" do
10
+ before do
11
+ WebMock.allow_net_connect!
12
+
13
+ stub_get("FindBusiness/?what=barber&where=Canada&fmt=JSON&pgLen=10&apikey=a1s2d3f4g5h6j7k8l9k6j5j4&UID=127.0.0.1").
14
+ to_return(:status => 200, :body => fixture("find_business.json"))
15
+ end
16
+
17
+ it "should return the correct number of businesses" do
18
+ wait 2 do
19
+ business = @client.find_business("barber", "Canada", { :pgLen => 1 })
20
+ a_get("FindBusiness/?what=barber&where=Canada&fmt=JSON&pgLen=1&apikey=a1s2d3f4g5h6j7k8l9k6j5j4&UID=#{@client.uid}").
21
+ should have_been_made
22
+ business.summary.listingsPerPage == 1
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,27 @@
1
+ require 'helper'
2
+
3
+ describe YellowApi::Client::FindDealer do
4
+
5
+ before do
6
+ @client = YellowApi::Client.new(:apikey => "a1s2d3f4g5h6j7k8l9k6j5j4")
7
+ end
8
+
9
+ describe ".find_dealer" do
10
+ before do
11
+ WebMock.allow_net_connect!
12
+
13
+ stub_get("http://api.yellowapi.com/FindDealer/?pid=6418182&fmt=JSON&apikey=a1s2d3f4g5h6j7k8l9k6j5j4&UID=1").
14
+ to_return(:status => 200, :body => fixture("find_dealer.json"))
15
+ end
16
+
17
+ it "should return the correct parent business" do
18
+ wait 2 do
19
+ business = @client.find_dealer(6418182, {:pgLen => 1})
20
+ a_get("FindDealer/?pid=6418182&apikey=a1s2d3f4g5h6j7k8l9k6j5j4&fmt=JSON&pgLen=1&UID=#{@client.uid}").
21
+ should have_been_made
22
+ business.listings.first.parentId == "6418182"
23
+ end
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,27 @@
1
+ require 'helper'
2
+
3
+ describe YellowApi::Client::GetBusinessDetails do
4
+
5
+ before do
6
+ @client = YellowApi::Client.new(:apikey => "a1s2d3f4g5h6j7k8l9k6j5j4")
7
+ end
8
+
9
+ describe ".get_business_details" do
10
+ before do
11
+ WebMock.allow_net_connect!
12
+
13
+ stub_get("GetBusinessDetails/?prov=Ile-du-Prince-Edouard&city=Calgary&bus-name=Co-operators-The&listingId=6418182&fmt=JSON&apikey=a1s2d3f4g5h6j7k8l9k6j5j4&UID=1").
14
+ to_return(:status => 200, :body => fixture("get_business_details.json"))
15
+ end
16
+
17
+ it "should return the correct business" do
18
+ wait 2 do
19
+ business = @client.get_business_details("Ile-du-Prince-Edouard", "Co-operators-The", 6418182, {:city => "Calgary"})
20
+
21
+ a_get("GetBusinessDetails/?prov=Ile-du-Prince-Edouard&city=Calgary&bus-name=Co-operators-The&listingId=6418182&fmt=JSON&apikey=a1s2d3f4g5h6j7k8l9k6j5j4&UID=#{@client.uid}").should have_been_made
22
+
23
+ business.id.should == "6418182"
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ require 'helper'
2
+
3
+ describe YellowApi do
4
+ describe ".new" do
5
+ it "should return a YellowApi::Client" do
6
+ YellowApi.new.should be_a YellowApi::Client
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ require File.expand_path('../lib/yellow_api/version', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'yellow_api'
5
+ gem.version = YellowApi::VERSION
6
+ gem.author = 'Ian Bishop'
7
+ gem.email = 'ian.bishop@unb.ca'
8
+ gem.homepage = 'https://github.com/ianbishop/yellow_api'
9
+ gem.summary = %q{Wrapper for the YellowPages' Yellow API}
10
+ gem.description = %q{Simple ruby wrapper for the YellowPages' Yellow API}
11
+
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
15
+ gem.require_paths = ['lib']
16
+
17
+ gem.add_development_dependency 'maruku', '~> 0.6'
18
+ gem.add_development_dependency 'rake', '~> 0.9'
19
+ gem.add_development_dependency 'rspec', '~> 2.6'
20
+ gem.add_development_dependency 'simplecov', '~> 0.5.3'
21
+ gem.add_development_dependency 'webmock', '~> 1.7.6'
22
+ gem.add_development_dependency 'yard', '~> 0.7'
23
+ gem.add_runtime_dependency 'faraday', '~> 0.7.4'
24
+ gem.add_runtime_dependency 'faraday_middleware', '~> 0.7.0'
25
+ gem.add_runtime_dependency 'hashie', '~> 1.2.0'
26
+ gem.add_runtime_dependency 'multi_json', '~> 1.0.2'
27
+ gem.add_runtime_dependency 'rash', '~> 0.3.0'
28
+ gem.add_runtime_dependency 'uuid', '~> 2.3.5'
29
+ end
metadata ADDED
@@ -0,0 +1,212 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yellow_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ian Bishop
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-06 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: maruku
16
+ requirement: &77299160 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.6'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *77299160
25
+ - !ruby/object:Gem::Dependency
26
+ name: rake
27
+ requirement: &77297970 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.9'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *77297970
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &77296910 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '2.6'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *77296910
47
+ - !ruby/object:Gem::Dependency
48
+ name: simplecov
49
+ requirement: &77296180 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.5.3
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *77296180
58
+ - !ruby/object:Gem::Dependency
59
+ name: webmock
60
+ requirement: &77295100 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.7.6
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *77295100
69
+ - !ruby/object:Gem::Dependency
70
+ name: yard
71
+ requirement: &77294490 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '0.7'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *77294490
80
+ - !ruby/object:Gem::Dependency
81
+ name: faraday
82
+ requirement: &77328080 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 0.7.4
88
+ type: :runtime
89
+ prerelease: false
90
+ version_requirements: *77328080
91
+ - !ruby/object:Gem::Dependency
92
+ name: faraday_middleware
93
+ requirement: &77327400 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: 0.7.0
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *77327400
102
+ - !ruby/object:Gem::Dependency
103
+ name: hashie
104
+ requirement: &77326570 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 1.2.0
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: *77326570
113
+ - !ruby/object:Gem::Dependency
114
+ name: multi_json
115
+ requirement: &77326220 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: 1.0.2
121
+ type: :runtime
122
+ prerelease: false
123
+ version_requirements: *77326220
124
+ - !ruby/object:Gem::Dependency
125
+ name: rash
126
+ requirement: &77325580 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 0.3.0
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: *77325580
135
+ - !ruby/object:Gem::Dependency
136
+ name: uuid
137
+ requirement: &77324320 !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ~>
141
+ - !ruby/object:Gem::Version
142
+ version: 2.3.5
143
+ type: :runtime
144
+ prerelease: false
145
+ version_requirements: *77324320
146
+ description: Simple ruby wrapper for the YellowPages' Yellow API
147
+ email: ian.bishop@unb.ca
148
+ executables: []
149
+ extensions: []
150
+ extra_rdoc_files: []
151
+ files:
152
+ - .autotest
153
+ - .gitignore
154
+ - Gemfile
155
+ - LICENSE.md
156
+ - README.md
157
+ - Rakefile
158
+ - lib/yellow_api.rb
159
+ - lib/yellow_api/client.rb
160
+ - lib/yellow_api/client/connection.rb
161
+ - lib/yellow_api/client/find_business.rb
162
+ - lib/yellow_api/client/find_dealer.rb
163
+ - lib/yellow_api/client/get_business_details.rb
164
+ - lib/yellow_api/client/get_type_ahead.rb
165
+ - lib/yellow_api/client/request.rb
166
+ - lib/yellow_api/config.rb
167
+ - lib/yellow_api/version.rb
168
+ - spec/fixtures/find_business.json
169
+ - spec/fixtures/find_dealer.json
170
+ - spec/fixtures/get_business_details.json
171
+ - spec/helper.rb
172
+ - spec/yellow_api/client_spec.rb
173
+ - spec/yellow_api/find_business_spec.rb
174
+ - spec/yellow_api/find_dealer_spec.rb
175
+ - spec/yellow_api/get_business_details_spec.rb
176
+ - spec/yellow_api_spec.rb
177
+ - yellow_api.gemspec
178
+ homepage: https://github.com/ianbishop/yellow_api
179
+ licenses: []
180
+ post_install_message:
181
+ rdoc_options: []
182
+ require_paths:
183
+ - lib
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ required_rubygems_version: !ruby/object:Gem::Requirement
191
+ none: false
192
+ requirements:
193
+ - - ! '>='
194
+ - !ruby/object:Gem::Version
195
+ version: '0'
196
+ requirements: []
197
+ rubyforge_project:
198
+ rubygems_version: 1.8.17
199
+ signing_key:
200
+ specification_version: 3
201
+ summary: Wrapper for the YellowPages' Yellow API
202
+ test_files:
203
+ - spec/fixtures/find_business.json
204
+ - spec/fixtures/find_dealer.json
205
+ - spec/fixtures/get_business_details.json
206
+ - spec/helper.rb
207
+ - spec/yellow_api/client_spec.rb
208
+ - spec/yellow_api/find_business_spec.rb
209
+ - spec/yellow_api/find_dealer_spec.rb
210
+ - spec/yellow_api/get_business_details_spec.rb
211
+ - spec/yellow_api_spec.rb
212
+ has_rdoc: