seat_geek 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/seat_geek/version.rb +1 -1
- data/lib/seat_geek.rb +63 -2
- data/seat_geek-0.0.1.gem +0 -0
- data/seat_geek.gemspec +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d76892bc09518351d859849e4ef7599d9a0f8858
|
4
|
+
data.tar.gz: 25f4bef33883fbcdbf7449db326cfd50a8f36968
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 943565f885958bba1f1fe069e4829516b528caeaa57ca7b832fe94bcb1cddd54ec6d3fc525f67ca389a2fd3911c9306da7cb5224320a29832f92afca08d3d141
|
7
|
+
data.tar.gz: 4a133b1817f13a7a463dabe20d6983f8a0d2b2ea80045c4fa2477db9f2070d583ec613636e2001a2cae52dee557ebddd666c21b0b383d8a9e8b0459c72215443
|
data/lib/seat_geek/version.rb
CHANGED
data/lib/seat_geek.rb
CHANGED
@@ -1,7 +1,68 @@
|
|
1
1
|
require "seat_geek/version"
|
2
2
|
|
3
3
|
module SeatGeek
|
4
|
-
|
5
|
-
|
4
|
+
SEATGEEK_BASE_URL = 'http://api.seatgeek.com/2/events'
|
5
|
+
def self.find_events(base_url: nil, month_of_the_year: nil, state: nil, attendee_count: nil, event_type: nil)
|
6
|
+
@base_url = base_url || SEATGEEK_BASE_URL
|
7
|
+
@month_of_the_year = month_of_the_year
|
8
|
+
@state = state
|
9
|
+
@attendee_count = attendee_count
|
10
|
+
@event_type = event_type
|
11
|
+
|
12
|
+
url = base_url + build_query
|
13
|
+
request = Typhoeus::Request.new(url,
|
14
|
+
method: :get,
|
15
|
+
headers: { Accept: "json" }
|
16
|
+
).run
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
attr_accessor :month_of_the_year, :state, :attendee_count, :event_type, :base_url
|
22
|
+
|
23
|
+
def build_query
|
24
|
+
query = ""
|
25
|
+
if month_of_the_year
|
26
|
+
query = month_query(month_of_the_year)
|
27
|
+
end
|
28
|
+
if state
|
29
|
+
query = query + location_query(state)
|
30
|
+
end
|
31
|
+
if attendee_count
|
32
|
+
query = query + attendee_count_query(attendee_count)
|
33
|
+
end
|
34
|
+
if event_type
|
35
|
+
query = query + event_type_query(event_type)
|
36
|
+
end
|
37
|
+
query
|
38
|
+
end
|
39
|
+
|
40
|
+
# Events in April 2012
|
41
|
+
# $ curl 'http://api.seatgeek.com/2/events?datetime_utc.gte=2012-04-01&datetime_utc.lte=2012-04-30'
|
42
|
+
def month_query(year_month)
|
43
|
+
year, month = year_month.split('-')
|
44
|
+
year = year.to_i
|
45
|
+
month = month.to_i
|
46
|
+
first_day_of_month = Date.civil(year, month, 1).strftime('%F')
|
47
|
+
last_day_of_month = Date.civil(year, month, -1).strftime('%F')
|
48
|
+
|
49
|
+
"?datetime_utc.gte=#{first_day_of_month}&datetime_utc.lte=#{last_day_of_month}"
|
50
|
+
end
|
51
|
+
|
52
|
+
# Events in NY state
|
53
|
+
# $ curl 'http://api.seatgeek.com/2/events?venue.state=NY'
|
54
|
+
def location_query(location)
|
55
|
+
"&venue.state=#{location}"
|
56
|
+
end
|
57
|
+
|
58
|
+
# GET http://api.seatgeek.com/2/events?listing_count.gt=0
|
59
|
+
def attendee_count_query(count)
|
60
|
+
"&listing_count.gt=#{count}"
|
61
|
+
end
|
62
|
+
|
63
|
+
# Sporting Events
|
64
|
+
# $ curl 'http://api.seatgeek.com/2/events?taxonomies.name=sports'
|
65
|
+
def event_type_query(type)
|
66
|
+
"&taxonomies.name=#{type}"
|
6
67
|
end
|
7
68
|
end
|
data/seat_geek-0.0.1.gem
ADDED
Binary file
|
data/seat_geek.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seat_geek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Moon
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: typhoeus
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description: 'Uses the SeatGeek Platform API to data around tickets in the USA. '
|
84
98
|
email:
|
85
99
|
- johnmoonyy@gmail.com
|
@@ -99,6 +113,7 @@ files:
|
|
99
113
|
- lib/seat_geek.rb
|
100
114
|
- lib/seat_geek/version.rb
|
101
115
|
- seat_geek-0.0.0.gem
|
116
|
+
- seat_geek-0.0.1.gem
|
102
117
|
- seat_geek.gemspec
|
103
118
|
homepage: https://github.com/jmoon90/seat_geek
|
104
119
|
licenses:
|