parkwhiz 0.2.0 → 0.3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e33174d41e41a7920e8f18a98ab4ffb56f6b926f
4
- data.tar.gz: 50539c343492b60794011ae3ac1bfdcf9584e0c6
3
+ metadata.gz: ad04539e6b9c501d54351b36a6678d802fddd3c4
4
+ data.tar.gz: 03f66d662559c772942bb49e087514b20506e885
5
5
  SHA512:
6
- metadata.gz: 306115dda84ad8a5b088f84920a8ce0a53e0d581510fd63061ebb0e44dec0e4f1d15151e554441ebaa8e84b6fc846d2f83a15e3eeb66039ad008f359c270b139
7
- data.tar.gz: 32f41f062d94d963188b5c9873707b60ccb610878b649682fbbb74fae6ef928a6cec2b9ac18ab3b570ae4eeb887c4ea1e6523029647a0547d246b89e46b60077
6
+ metadata.gz: e10e4d597994d658fa3cf30b19f57c1b052ef58de721c857ecb47200ccc6b5446021a96742d69226be2c24297ea1e9c3648f6934ed7286650179702a58d6b633
7
+ data.tar.gz: 98d0a638e2e98236a917d556b410d7513bd0954dd2f3e958f1b177a87b2abb022f11a508e6b84873d3208b252de403887b3feac3f2f5eeff56686da467c2ba20
@@ -1,3 +1,6 @@
1
+ === 0.3.0
2
+ - Adding Event endpoint. Thanks Eric Kuecks (ekuecks)
3
+
1
4
  === 0.2.0
2
5
  - Venue search endpoint
3
6
 
@@ -8,7 +8,8 @@ require 'parkwhiz/connection'
8
8
  require 'parkwhiz/location'
9
9
  require 'parkwhiz/search'
10
10
  require 'parkwhiz/venue'
11
+ require 'parkwhiz/event'
11
12
 
12
13
  module Parkwhiz
13
14
 
14
- end
15
+ end
@@ -0,0 +1,31 @@
1
+ module Parkwhiz
2
+ class Event
3
+ include Virtus.model
4
+
5
+ attribute :event_name, String
6
+ attribute :start, Integer
7
+ attribute :end, Integer
8
+ attribute :parkwhiz_url, String
9
+ attribute :venue_name, String
10
+ attribute :lat, Float
11
+ attribute :lng, Float
12
+ attribute :min_price, Float
13
+ attribute :max_price, Float
14
+ attribute :min_distance, Integer
15
+ attribute :max_distance, Integer
16
+ attribute :amenities, Hash
17
+ attribute :parking_listings, Array[Location]
18
+
19
+ def self.search(search_parameters)
20
+ response = Parkwhiz.connection.get do |request|
21
+ request.url SEARCH_PATH
22
+ request.params['key'] = Parkwhiz.api_key
23
+ request.params.merge!(search_parameters)
24
+ end
25
+
26
+ raise SearchError.new(response.body['error']) if response.body.kind_of?(Hash) && response.body['error']
27
+
28
+ response.body.collect{|event_json| self.new(event_json)}
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Parkwhiz
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,31 @@
1
+ describe "Event" do
2
+ let :connection do
3
+ double(:connection, get: nil)
4
+ end
5
+
6
+ let :event_search_response do
7
+ File.read(File.expand_path("spec/responses/venue_search_response.json"))
8
+ end
9
+
10
+ let :invalid_search_response do
11
+ File.read(File.expand_path("spec/responses/invalid_key_response.json"))
12
+ end
13
+
14
+ describe "search" do
15
+ it "should return an Array of Parkwhiz::Events" do
16
+ Parkwhiz.connection = connection
17
+ expect(connection).to receive(:get) { double( body: JSON.parse(event_search_response) ) }
18
+ events = Parkwhiz::Event.search({})
19
+ expect(events).to be_kind_of(Array)
20
+ expect(events.first).to be_kind_of(Parkwhiz::Event)
21
+ end
22
+
23
+ it "should raise a search error if bad search response" do
24
+ expect(connection).to receive(:get) { double( body: JSON.parse(invalid_search_response) ) }
25
+ Parkwhiz.connection = connection
26
+ expect do
27
+ Parkwhiz.search({})
28
+ end.to raise_error(Parkwhiz::SearchError)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1 @@
1
+ {"event_name":"Brothers of the Sun Tour with Kenny Chesney and Tim McGraw","parkwhiz_url":"http:\/\/http://www.parkwhiz.com\/cowboys-stadium-parking\/brothers-of-the-sun-tour-with-kenny-chesney-and-tim-mcgraw-47906\/","start": 1297029600,"end": 1297045800,"venue_name": "Cowboys Stadium","lat": 41.8857256,"lng": -87.6369590,"min_price": 27.50,"min_distance": 111,"parking_listings": [{"location_name": "Cowboys Gameday Parking","location_id": 2429,"listing_id": 5412,"parkwhiz_url": "http:\/\/www.parkwhiz.com\/p\/arlington-parking\/601-stadium-dr\/?start=1297027800&end=1297047600","api_url": "http:\/\/api.parkwhiz.com\/p\/arlington-parking\/601-stadium-dr\/?start=1297027800&end=1297047600","address": "601 Stadium Dr","city": "Arlington","state": "TX","zip": "76011","lat": 32.7427399,"lng": -97.083716,"eticket": 1,"distance": 2443,"recommendations": 63,"available_spots": 10,"price": 110.00,"www_reserve_url": "http:\/\/www.parkwhiz.com\/reserve\/?id=5412"},{"location_name": "Half Mile Randol Mill Parking","location_id": 2442,"listing_id": 5605,"parkwhiz_url": "http:\/\/www.parkwhiz.com\/p\/arlington-parking\/101-west-randol-mill\/?start=1297027800&end=1297047600","api_url": "http:\/\/api.parkwhiz.com\/p\/arlington-parking\/101-west-randol-mill\/?start=1297027800&end=1297047600","address": "101 West Randol Mill","city": "Arlington","state": "TX","zip": "76011","lat": 32.7502910261246,"lng": -97.1071028709412,"eticket": 0,"distance": 3592,"recommendations": 32,"available_spots": 10,"price": 44.00,"www_reserve_url": "http:\/\/www.parkwhiz.com\/reserve\/?id=5605"}]}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parkwhiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Fonacier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,12 +128,15 @@ files:
128
128
  - lib/parkwhiz/configuration.rb
129
129
  - lib/parkwhiz/connection.rb
130
130
  - lib/parkwhiz/errors.rb
131
+ - lib/parkwhiz/event.rb
131
132
  - lib/parkwhiz/location.rb
132
133
  - lib/parkwhiz/search.rb
133
134
  - lib/parkwhiz/venue.rb
134
135
  - lib/parkwhiz/version.rb
135
136
  - parkwhiz.gemspec
137
+ - spec/event_spec.rb
136
138
  - spec/location_spec.rb
139
+ - spec/responses/event_search_response.json
137
140
  - spec/responses/invalid_key_response.json
138
141
  - spec/responses/la_search_response.json
139
142
  - spec/responses/venue_search_response.json
@@ -165,7 +168,9 @@ signing_key:
165
168
  specification_version: 4
166
169
  summary: A Ruby gem wrapper to Parkwhiz.com's API
167
170
  test_files:
171
+ - spec/event_spec.rb
168
172
  - spec/location_spec.rb
173
+ - spec/responses/event_search_response.json
169
174
  - spec/responses/invalid_key_response.json
170
175
  - spec/responses/la_search_response.json
171
176
  - spec/responses/venue_search_response.json