seat_geek 0.6.2 → 0.7.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 +4 -4
- data/README.md +24 -34
- data/lib/seat_geek/Taxonomies/concert.rb +16 -0
- data/lib/seat_geek/Taxonomies/sports.rb +16 -0
- data/lib/seat_geek/Taxonomies/theater.rb +16 -0
- data/lib/seat_geek/Taxonomies/tree.rb +51 -0
- data/lib/seat_geek/taxonomy.rb +23 -20
- data/lib/seat_geek/version.rb +1 -1
- data/lib/seat_geek.rb +10 -4
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf1e8a3542fb54082ff4b52f850bab8463cc358d
|
4
|
+
data.tar.gz: d06de55d40b8dc790931209f5e1d5ad240eba08e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95b721a373f73dfb13641c378c25d3060180239c541379eb21c5cc25e3dcc442d00ee8e14d3180046294094f452379c38e99a6b8856768a8d3872193d78e1fc8
|
7
|
+
data.tar.gz: 695bf82730ce8cbe0ea90dea2e21595ededf37c5e6ecac8de2bff0983e68ee822489408e7e76c0d28780cac30a19b86a5246ee2938e6a32be205c50823c00c18
|
data/README.md
CHANGED
@@ -10,10 +10,6 @@ Add this line to your application's Gemfile:
|
|
10
10
|
gem 'seat_geek'
|
11
11
|
```
|
12
12
|
|
13
|
-
And then execute:
|
14
|
-
|
15
|
-
$ bundle
|
16
|
-
|
17
13
|
Or install it yourself as:
|
18
14
|
|
19
15
|
$ gem install seat_geek
|
@@ -26,40 +22,31 @@ Taxonomy
|
|
26
22
|
```ruby
|
27
23
|
taxonomy = SeatGeek::Taxonomy.new()
|
28
24
|
|
29
|
-
taxonomy.
|
25
|
+
taxonomy.sports
|
26
|
+
# Events that contains parent_id of 1000000
|
27
|
+
#=> <SeatGeek::Taxonomies::Sports: @parent_object={ ... },
|
28
|
+
@sub_taxonomies= [{"parent_id"=>1000000, "id"=>1010100, "name"=>"mlb"} ..]
|
29
|
+
|
30
|
+
taxonomy.concert
|
31
|
+
# Events that contains parent_id of 2000000
|
32
|
+
#=> <SeatGeek::Taxonomies::Concert: @parent_object={ ... },
|
33
|
+
@sub_taxonomies= [{"parent_id"=>2000000, "id"=>2010000, "name"=>"music_festival"} ..]
|
34
|
+
|
35
|
+
taxonomy.theater
|
36
|
+
# Events that contains parent_id of 3000000
|
37
|
+
#=> <SeatGeek::Taxonomies::Concert: @parent_object={ ... },
|
38
|
+
@sub_taxonomies= [{"parent_id"=>3000000, "id"=>3020000, "name"=>"cirque_du_soleil"} ..]
|
39
|
+
|
40
|
+
all = taxonomy.all
|
30
41
|
# => GET http://api.seatgeek.com/2/taxonomies
|
42
|
+
#=> contains all of the above
|
31
43
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# nba
|
36
|
-
# nfl
|
37
|
-
# nhl
|
38
|
-
# mls
|
39
|
-
# pga
|
40
|
-
# mma
|
41
|
-
|
42
|
-
#=> [{"parent_id"=>1010000, "id"=>1010100, "name"=>"mlb"}, ... ]
|
43
|
-
|
44
|
-
taxonomy.concerts
|
45
|
-
# 7 conerts related events
|
46
|
-
# classical
|
47
|
-
# theater
|
48
|
-
# concert
|
49
|
-
# music_festival
|
50
|
-
# comedy
|
51
|
-
# dance_performance_tour
|
52
|
-
# broadway_tickets_national
|
53
|
-
|
54
|
-
#=> [{"parent_id"=>1010000, "id"=>1010100, "name"=>"mlb"}, ... ]
|
55
|
-
|
56
|
-
taxonomy.minor_league_sports
|
57
|
-
# NBA d league
|
58
|
-
# minor league baseball
|
59
|
-
# minor league hockey
|
60
|
-
#=> [{"parent_id"=>1010000, "id"=>1010100, "name"=>"mlb"}, ... ]
|
44
|
+
all[:sports] or
|
45
|
+
all[:concert] or
|
46
|
+
all[:theater]
|
61
47
|
```
|
62
48
|
|
49
|
+
Events
|
63
50
|
```ruby
|
64
51
|
SeatGeek.get_events()
|
65
52
|
# => GET http://api.seatgeek.com/2/events
|
@@ -75,6 +62,9 @@ params = { month_of_the_year: '2016-03',
|
|
75
62
|
SeatGeek.get_events(params)
|
76
63
|
```
|
77
64
|
|
65
|
+
## TODO Implementation
|
66
|
+
|
67
|
+
|
78
68
|
## Contributing
|
79
69
|
|
80
70
|
Bug reports and pull requests are welcome on GitHub at https://github.com/jmoon/seat_geek.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SeatGeek
|
2
|
+
module Taxonomies
|
3
|
+
class Concert
|
4
|
+
def initialize(parent_object:, sub_taxonomies:)
|
5
|
+
@parent_object = parent_object
|
6
|
+
@sub_taxonomies = sub_taxonomies
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
parent_object['name']
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :sub_taxonomies, :parent_object
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SeatGeek
|
2
|
+
module Taxonomies
|
3
|
+
class Sports
|
4
|
+
def initialize(parent_object:, sub_taxonomies:)
|
5
|
+
@parent_object = parent_object
|
6
|
+
@sub_taxonomies = sub_taxonomies
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
parent_object['name']
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :sub_taxonomies, :parent_object
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SeatGeek
|
2
|
+
module Taxonomies
|
3
|
+
class Theater
|
4
|
+
def initialize(parent_object:, sub_taxonomies:)
|
5
|
+
@parent_object = parent_object
|
6
|
+
@sub_taxonomies = sub_taxonomies
|
7
|
+
end
|
8
|
+
|
9
|
+
def name
|
10
|
+
parent_object['name']
|
11
|
+
end
|
12
|
+
|
13
|
+
attr_accessor :sub_taxonomies, :parent_object
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module SeatGeek
|
2
|
+
module Taxonomies
|
3
|
+
class Tree
|
4
|
+
def initialize(parent_ids, taxonomies)
|
5
|
+
@parent_ids = parent_ids
|
6
|
+
@taxonomies = taxonomies
|
7
|
+
build_tree
|
8
|
+
end
|
9
|
+
|
10
|
+
def sports
|
11
|
+
finished_tree[:sports]
|
12
|
+
end
|
13
|
+
|
14
|
+
def concert
|
15
|
+
finished_tree[:concert]
|
16
|
+
end
|
17
|
+
|
18
|
+
def theater
|
19
|
+
finished_tree[:theater]
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_accessor :parent_ids, :taxonomies
|
25
|
+
|
26
|
+
def build_tree
|
27
|
+
parent_ids.each do |parent_id|
|
28
|
+
parent_object = taxonomies.detect { |taxonomy| taxonomy['id'] == parent_id }
|
29
|
+
|
30
|
+
sub_taxonomies = taxonomies.each do |taxonomy|
|
31
|
+
taxonomy['parent_id'] == parent_id
|
32
|
+
end
|
33
|
+
|
34
|
+
if parent_object.fetch('name') == 'sports'
|
35
|
+
klass = SeatGeek::Taxonomies::Sports
|
36
|
+
elsif parent_object.fetch('name') == 'concert'
|
37
|
+
klass = SeatGeek::Taxonomies::Concert
|
38
|
+
elsif parent_object.fetch('name') == 'theater'
|
39
|
+
klass = SeatGeek::Taxonomies::Theater
|
40
|
+
end
|
41
|
+
finished_tree[parent_object['name'].to_sym] = klass.new(parent_object: parent_object, sub_taxonomies: sub_taxonomies)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def finished_tree
|
46
|
+
@finished_tree ||= { sports: nil, concert: nil, theater: nil }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
data/lib/seat_geek/taxonomy.rb
CHANGED
@@ -1,42 +1,45 @@
|
|
1
|
-
# require "seat_geek/build_query"
|
2
|
-
# require 'typhoeus'
|
3
|
-
# require 'oj'
|
4
|
-
|
5
1
|
module SeatGeek
|
6
2
|
class Taxonomy
|
7
|
-
PUBLIC_API_URL = '
|
3
|
+
PUBLIC_API_URL = 'https://api.seatgeek.com/2/taxonomies'
|
4
|
+
SPORTS_ID = 1000000
|
5
|
+
CONCERT_ID = 2000000
|
6
|
+
THEATRE_ID = 3000000
|
8
7
|
|
9
|
-
def
|
8
|
+
def initialize
|
10
9
|
@base_url = PUBLIC_API_URL
|
11
|
-
parse_response(typhoeus_request.body)
|
10
|
+
@taxonomies = parse_response(typhoeus_request.body)
|
11
|
+
end
|
12
|
+
|
13
|
+
def all
|
14
|
+
taxonomies
|
12
15
|
end
|
13
16
|
|
14
|
-
def
|
15
|
-
|
16
|
-
get_events(professional_sport_ids)
|
17
|
+
def sports
|
18
|
+
taxonomies_tree.sports
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
20
|
-
|
21
|
-
get_events(concert_ids)
|
21
|
+
def concert
|
22
|
+
taxonomies_tree.concert
|
22
23
|
end
|
23
24
|
|
24
|
-
def
|
25
|
-
|
26
|
-
get_events(minor_sport_ids)
|
25
|
+
def theater
|
26
|
+
taxonomies_tree.theater
|
27
27
|
end
|
28
28
|
|
29
29
|
private
|
30
30
|
|
31
|
-
attr_accessor :base_url
|
31
|
+
attr_accessor :base_url, :taxonomies
|
32
|
+
|
33
|
+
def taxonomies_tree
|
34
|
+
@taxonomies_tree ||= SeatGeek::Taxonomies::Tree.new([SPORTS_ID, CONCERT_ID, THEATRE_ID], taxonomies['taxonomies'])
|
35
|
+
end
|
32
36
|
|
33
37
|
def get_events(event_ids)
|
34
38
|
events = []
|
35
|
-
|
36
|
-
result = SeatGeek::Taxonomy.new.all['taxonomies']
|
39
|
+
taxonomies = SeatGeek::Taxonomy.new.all['taxonomies']
|
37
40
|
|
38
41
|
event_ids.each do |x|
|
39
|
-
events <<
|
42
|
+
events << taxonomies[x]
|
40
43
|
end
|
41
44
|
events
|
42
45
|
end
|
data/lib/seat_geek/version.rb
CHANGED
data/lib/seat_geek.rb
CHANGED
@@ -1,16 +1,22 @@
|
|
1
|
+
require 'typhoeus'
|
2
|
+
require 'oj'
|
3
|
+
|
1
4
|
require "seat_geek/version"
|
2
5
|
require "seat_geek/build_query"
|
3
6
|
require "seat_geek/taxonomy"
|
4
|
-
require
|
5
|
-
require
|
7
|
+
require "seat_geek/taxonomies/tree"
|
8
|
+
require "seat_geek/taxonomies/sports"
|
9
|
+
require "seat_geek/taxonomies/concert"
|
10
|
+
require "seat_geek/taxonomies/theater"
|
11
|
+
|
6
12
|
|
7
13
|
module SeatGeek
|
8
14
|
extend self
|
9
|
-
PUBLIC_API_URL = '
|
15
|
+
PUBLIC_API_URL = 'https://api.seatgeek.com/2/'
|
10
16
|
|
11
17
|
def self.get_events(options)
|
12
18
|
@options = options
|
13
|
-
@base_url = PUBLIC_API_URL
|
19
|
+
@base_url = PUBLIC_API_URL + 'events?'
|
14
20
|
if options[:seat_geek_partner_id]
|
15
21
|
@base_url =+ "aid=#{options[:seat_geek_partner_id]}"
|
16
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seat_geek
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Moon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,6 +139,10 @@ files:
|
|
139
139
|
- bin/console
|
140
140
|
- bin/setup
|
141
141
|
- lib/seat_geek.rb
|
142
|
+
- lib/seat_geek/Taxonomies/concert.rb
|
143
|
+
- lib/seat_geek/Taxonomies/sports.rb
|
144
|
+
- lib/seat_geek/Taxonomies/theater.rb
|
145
|
+
- lib/seat_geek/Taxonomies/tree.rb
|
142
146
|
- lib/seat_geek/build_query.rb
|
143
147
|
- lib/seat_geek/taxonomy.rb
|
144
148
|
- lib/seat_geek/version.rb
|