seat_geek 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -0
- data/lib/seat_geek/Taxonomies/concert.rb +24 -4
- data/lib/seat_geek/Taxonomies/sports.rb +74 -4
- data/lib/seat_geek/Taxonomies/theater.rb +24 -4
- data/lib/seat_geek/Taxonomies/tree.rb +6 -6
- data/lib/seat_geek/version.rb +1 -1
- metadata +1 -2
- data/.byebug_history +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce5c12eb1e98d94debc10b1fdb2ddd423af3cbe
|
4
|
+
data.tar.gz: f63d8b811f9dfa195ac031ac4d02d0f985f310a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b8f54466a4b1eecb150f28b66faa8219b3838d30a537a63a3234e7ffecdcefbaea0221a1707c1954b5c492896d1fbbcbdb734f122ee910042f2016572dcd88
|
7
|
+
data.tar.gz: 00d27260de5bfbe7fe845c3df013eab58fadc5348c5060928241b9f8e24ff48dd0be81d40c202f53fffbd1a8d105d81a0d6cce4db0e73a9cd948f79ebc6d7154
|
data/README.md
CHANGED
@@ -27,16 +27,40 @@ taxonomy.sports
|
|
27
27
|
#=> <SeatGeek::Taxonomies::Sports: @parent_object={ ... },
|
28
28
|
@sub_taxonomies= [{"parent_id"=>1000000, "id"=>1010100, "name"=>"mlb"} ..]
|
29
29
|
|
30
|
+
callable methods
|
31
|
+
taxonomy.sports.
|
32
|
+
- all
|
33
|
+
- baseball
|
34
|
+
- basketball
|
35
|
+
- hockey
|
36
|
+
- football
|
37
|
+
- auto_racing
|
38
|
+
- golf
|
39
|
+
- fighting
|
40
|
+
- tennis
|
41
|
+
- animal_sports
|
42
|
+
- extreme_sports
|
43
|
+
- olympic_sports
|
44
|
+
|
30
45
|
taxonomy.concert
|
31
46
|
# Events that contains parent_id of 2000000
|
32
47
|
#=> <SeatGeek::Taxonomies::Concert: @parent_object={ ... },
|
33
48
|
@sub_taxonomies= [{"parent_id"=>2000000, "id"=>2010000, "name"=>"music_festival"} ..]
|
34
49
|
|
50
|
+
callable methods
|
51
|
+
taxonomy.concert.
|
52
|
+
- all
|
53
|
+
- music_festival
|
54
|
+
|
35
55
|
taxonomy.theater
|
36
56
|
# Events that contains parent_id of 3000000
|
37
57
|
#=> <SeatGeek::Taxonomies::Theater: @parent_object={ ... },
|
38
58
|
@sub_taxonomies= [{"parent_id"=>3000000, "id"=>3020000, "name"=>"cirque_du_soleil"} ..]
|
39
59
|
|
60
|
+
taxonomy.theater.
|
61
|
+
- all
|
62
|
+
- classical
|
63
|
+
|
40
64
|
taxonomy
|
41
65
|
# => GET http://api.seatgeek.com/2/taxonomies
|
42
66
|
#=> contains all of the above
|
@@ -1,12 +1,32 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
3
|
class Concert
|
4
|
-
def initialize(
|
5
|
-
@
|
6
|
-
@sub_taxonomies = sub_taxonomies
|
4
|
+
def initialize(sub_taxonomies:)
|
5
|
+
@taxonomies = sub_taxonomies
|
7
6
|
end
|
8
7
|
|
9
|
-
|
8
|
+
def all
|
9
|
+
taxonomies
|
10
|
+
end
|
11
|
+
|
12
|
+
def music_festival
|
13
|
+
@parent_id = '2010000'
|
14
|
+
build_tree
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_accessor :taxonomies, :parent_id
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def build_child_tree
|
22
|
+
parent_object = taxonomies.detect { |taxonomy| taxonomy['id'] == parent_id }
|
23
|
+
|
24
|
+
child_taxonomies = [parent_object]
|
25
|
+
taxonomies.each do |taxonomy|
|
26
|
+
child_taxonomies << taxonomy if taxonomy['parent_id'] == parent_id
|
27
|
+
end
|
28
|
+
child_taxonomies
|
29
|
+
end
|
10
30
|
end
|
11
31
|
end
|
12
32
|
end
|
@@ -1,12 +1,82 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
3
|
class Sports
|
4
|
-
def initialize(
|
5
|
-
@
|
6
|
-
@sub_taxonomies = sub_taxonomies
|
4
|
+
def initialize(sub_taxonomies:)
|
5
|
+
@taxonomies = sub_taxonomies
|
7
6
|
end
|
8
7
|
|
9
|
-
|
8
|
+
def all
|
9
|
+
taxonomies
|
10
|
+
end
|
11
|
+
|
12
|
+
def baseball
|
13
|
+
@parent_id = 1010000
|
14
|
+
build_tree
|
15
|
+
end
|
16
|
+
|
17
|
+
def basketball
|
18
|
+
@parent_id = 1030000
|
19
|
+
build_tree
|
20
|
+
end
|
21
|
+
|
22
|
+
def hockey
|
23
|
+
@parent_id = 1040000
|
24
|
+
build_tree
|
25
|
+
end
|
26
|
+
|
27
|
+
def football
|
28
|
+
@parent_id = 1020000
|
29
|
+
build_tree
|
30
|
+
end
|
31
|
+
|
32
|
+
def auto_racing
|
33
|
+
@parent_id = 1060000
|
34
|
+
build_tree
|
35
|
+
end
|
36
|
+
|
37
|
+
def golf
|
38
|
+
@parent_id = 1070000
|
39
|
+
build_tree
|
40
|
+
end
|
41
|
+
|
42
|
+
def fighting
|
43
|
+
@parent_id = 1080000
|
44
|
+
build_tree
|
45
|
+
end
|
46
|
+
|
47
|
+
def tennis
|
48
|
+
@parent_id = 1090000
|
49
|
+
build_tree
|
50
|
+
end
|
51
|
+
|
52
|
+
def animal_sports
|
53
|
+
@parent_id = 1100000
|
54
|
+
build_tree
|
55
|
+
end
|
56
|
+
|
57
|
+
def extreme_sports
|
58
|
+
@parent_id = 1110000
|
59
|
+
build_tree
|
60
|
+
end
|
61
|
+
|
62
|
+
def olympic_sports
|
63
|
+
@parent_id = 1120000
|
64
|
+
build_tree
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
attr_accessor :parent_id, :taxonomies
|
70
|
+
|
71
|
+
def build_child_tree
|
72
|
+
parent_object = taxonomies.detect { |taxonomy| taxonomy['id'] == parent_id }
|
73
|
+
|
74
|
+
child_taxonomies = [parent_object]
|
75
|
+
taxonomies.each do |taxonomy|
|
76
|
+
child_taxonomies << taxonomy if taxonomy['parent_id'] == parent_id
|
77
|
+
end
|
78
|
+
child_taxonomies
|
79
|
+
end
|
10
80
|
end
|
11
81
|
end
|
12
82
|
end
|
@@ -1,12 +1,32 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
3
|
class Theater
|
4
|
-
def initialize(
|
5
|
-
@
|
6
|
-
@sub_taxonomies = sub_taxonomies
|
4
|
+
def initialize(sub_taxonomies:)
|
5
|
+
@taxonomies = sub_taxonomies
|
7
6
|
end
|
8
7
|
|
9
|
-
|
8
|
+
def all
|
9
|
+
taxonomies
|
10
|
+
end
|
11
|
+
|
12
|
+
def classical
|
13
|
+
@parent_id = 3010000
|
14
|
+
build_child_tree
|
15
|
+
end
|
16
|
+
|
17
|
+
attr_accessor :taxonomies, :parent_id
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def build_child_tree
|
22
|
+
parent_object = taxonomies.detect { |taxonomy| taxonomy['id'] == parent_id }
|
23
|
+
|
24
|
+
child_taxonomies = [parent_object]
|
25
|
+
taxonomies.each do |taxonomy|
|
26
|
+
child_taxonomies << taxonomy if taxonomy['parent_id'] == parent_id
|
27
|
+
end
|
28
|
+
child_taxonomies
|
29
|
+
end
|
10
30
|
end
|
11
31
|
end
|
12
32
|
end
|
@@ -23,20 +23,21 @@ module SeatGeek
|
|
23
23
|
finished_tree[:theater]
|
24
24
|
end
|
25
25
|
|
26
|
-
private
|
27
|
-
|
28
26
|
attr_accessor :parent_ids, :taxonomies
|
29
27
|
|
28
|
+
private
|
29
|
+
|
30
30
|
def build_tree
|
31
31
|
parent_ids.each do |parent_id|
|
32
32
|
parent_object = taxonomies.detect { |taxonomy| taxonomy['id'] == parent_id }
|
33
33
|
|
34
|
-
sub_taxonomies =
|
35
|
-
|
34
|
+
sub_taxonomies = [parent_object]
|
35
|
+
taxonomies.each do |taxonomy|
|
36
|
+
sub_taxonomies << taxonomy if taxonomy['parent_id'].to_s[0] == parent_id.to_s[0]
|
36
37
|
end
|
37
38
|
|
38
39
|
klass = { 'sports' => SeatGeek::Taxonomies::Sports, 'concert' => SeatGeek::Taxonomies::Concert, 'theater' => SeatGeek::Taxonomies::Theater }
|
39
|
-
finished_tree[parent_object['name'].to_sym] = klass[parent_object['name']].new(
|
40
|
+
finished_tree[parent_object['name'].to_sym] = klass[parent_object['name']].new(sub_taxonomies: sub_taxonomies)
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
@@ -46,4 +47,3 @@ module SeatGeek
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
end
|
49
|
-
|
data/lib/seat_geek/version.rb
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.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Moon
|
@@ -129,7 +129,6 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
- ".byebug_history"
|
133
132
|
- ".gitignore"
|
134
133
|
- ".travis.yml"
|
135
134
|
- CODE_OF_CONDUCT.md
|