seat_geek 0.7.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.byebug_history +9 -0
- data/README.md +3 -7
- data/lib/seat_geek/Taxonomies/concert.rb +0 -4
- data/lib/seat_geek/Taxonomies/sports.rb +0 -4
- data/lib/seat_geek/Taxonomies/theater.rb +0 -4
- data/lib/seat_geek/Taxonomies/tree.rb +7 -9
- data/lib/seat_geek/build_query.rb +3 -0
- data/lib/seat_geek/taxonomy.rb +0 -62
- data/lib/seat_geek/version.rb +1 -1
- data/lib/seat_geek.rb +12 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6de3a9e2781e940114bf3bbdb7088450e7e9e7f
|
4
|
+
data.tar.gz: 65020b1a8224143e1d9250981f2b6432be6b56ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe9843f0edaa856fee3e063b505128074bc28da662c86c46bfda6fbf257772e125aaa05199d8791555bab2f9cc27b8fa34c27d8dac6330c80cc784d62308fb63
|
7
|
+
data.tar.gz: 2e8edc504a62268396bd7527fb7d3c64a01ca51f40e64057523ddb21ed1072389045be5100c8c66f7f06123a30428b08e734b8b265165432de276e2fefa145d6
|
data/.byebug_history
ADDED
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
Taxonomy
|
21
21
|
|
22
22
|
```ruby
|
23
|
-
taxonomy = SeatGeek
|
23
|
+
taxonomy = SeatGeek.get_taxonomies
|
24
24
|
|
25
25
|
taxonomy.sports
|
26
26
|
# Events that contains parent_id of 1000000
|
@@ -34,16 +34,12 @@ taxonomy.concert
|
|
34
34
|
|
35
35
|
taxonomy.theater
|
36
36
|
# Events that contains parent_id of 3000000
|
37
|
-
#=> <SeatGeek::Taxonomies::
|
37
|
+
#=> <SeatGeek::Taxonomies::Theater: @parent_object={ ... },
|
38
38
|
@sub_taxonomies= [{"parent_id"=>3000000, "id"=>3020000, "name"=>"cirque_du_soleil"} ..]
|
39
39
|
|
40
|
-
|
40
|
+
taxonomy
|
41
41
|
# => GET http://api.seatgeek.com/2/taxonomies
|
42
42
|
#=> contains all of the above
|
43
|
-
|
44
|
-
all[:sports] or
|
45
|
-
all[:concert] or
|
46
|
-
all[:theater]
|
47
43
|
```
|
48
44
|
|
49
45
|
Events
|
@@ -1,12 +1,16 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
3
|
class Tree
|
4
|
-
def initialize(parent_ids
|
4
|
+
def initialize(parent_ids:, taxonomies:)
|
5
5
|
@parent_ids = parent_ids
|
6
6
|
@taxonomies = taxonomies
|
7
7
|
build_tree
|
8
8
|
end
|
9
9
|
|
10
|
+
def all
|
11
|
+
finished_tree
|
12
|
+
end
|
13
|
+
|
10
14
|
def sports
|
11
15
|
finished_tree[:sports]
|
12
16
|
end
|
@@ -31,14 +35,8 @@ module SeatGeek
|
|
31
35
|
taxonomy['parent_id'] == parent_id
|
32
36
|
end
|
33
37
|
|
34
|
-
|
35
|
-
|
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)
|
38
|
+
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(parent_object: parent_object, sub_taxonomies: sub_taxonomies)
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
data/lib/seat_geek/taxonomy.rb
CHANGED
@@ -1,62 +0,0 @@
|
|
1
|
-
module SeatGeek
|
2
|
-
class Taxonomy
|
3
|
-
PUBLIC_API_URL = 'https://api.seatgeek.com/2/taxonomies'
|
4
|
-
SPORTS_ID = 1000000
|
5
|
-
CONCERT_ID = 2000000
|
6
|
-
THEATRE_ID = 3000000
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@base_url = PUBLIC_API_URL
|
10
|
-
@taxonomies = parse_response(typhoeus_request.body)
|
11
|
-
end
|
12
|
-
|
13
|
-
def all
|
14
|
-
taxonomies
|
15
|
-
end
|
16
|
-
|
17
|
-
def sports
|
18
|
-
taxonomies_tree.sports
|
19
|
-
end
|
20
|
-
|
21
|
-
def concert
|
22
|
-
taxonomies_tree.concert
|
23
|
-
end
|
24
|
-
|
25
|
-
def theater
|
26
|
-
taxonomies_tree.theater
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
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
|
36
|
-
|
37
|
-
def get_events(event_ids)
|
38
|
-
events = []
|
39
|
-
taxonomies = SeatGeek::Taxonomy.new.all['taxonomies']
|
40
|
-
|
41
|
-
event_ids.each do |x|
|
42
|
-
events << taxonomies[x]
|
43
|
-
end
|
44
|
-
events
|
45
|
-
end
|
46
|
-
|
47
|
-
def build_url
|
48
|
-
BuildQuery.build({}, base_url)
|
49
|
-
end
|
50
|
-
|
51
|
-
def typhoeus_request
|
52
|
-
request = Typhoeus::Request.new(build_url,
|
53
|
-
method: :get,
|
54
|
-
headers: { Accept: "json" }
|
55
|
-
).run
|
56
|
-
end
|
57
|
-
|
58
|
-
def parse_response(json_string)
|
59
|
-
Oj.load(json_string)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
data/lib/seat_geek/version.rb
CHANGED
data/lib/seat_geek.rb
CHANGED
@@ -3,7 +3,6 @@ require 'oj'
|
|
3
3
|
|
4
4
|
require "seat_geek/version"
|
5
5
|
require "seat_geek/build_query"
|
6
|
-
require "seat_geek/taxonomy"
|
7
6
|
require "seat_geek/taxonomies/tree"
|
8
7
|
require "seat_geek/taxonomies/sports"
|
9
8
|
require "seat_geek/taxonomies/concert"
|
@@ -11,6 +10,10 @@ require "seat_geek/taxonomies/theater"
|
|
11
10
|
|
12
11
|
|
13
12
|
module SeatGeek
|
13
|
+
SPORTS_ID = 1000000
|
14
|
+
CONCERT_ID = 2000000
|
15
|
+
THEATRE_ID = 3000000
|
16
|
+
|
14
17
|
extend self
|
15
18
|
PUBLIC_API_URL = 'https://api.seatgeek.com/2/'
|
16
19
|
|
@@ -24,6 +27,14 @@ module SeatGeek
|
|
24
27
|
parse_response(typhoeus_request.body)
|
25
28
|
end
|
26
29
|
|
30
|
+
def self.get_taxonomies
|
31
|
+
@options = {}
|
32
|
+
@base_url = 'https://api.seatgeek.com/2/taxonomies'
|
33
|
+
taxonomies = parse_response(typhoeus_request.body)['taxonomies']
|
34
|
+
|
35
|
+
SeatGeek::Taxonomies::Tree.new(parent_ids: [SPORTS_ID, CONCERT_ID, THEATRE_ID], taxonomies: taxonomies)
|
36
|
+
end
|
37
|
+
|
27
38
|
#TODO Need to think this through
|
28
39
|
# not sure how to get recommendations or what we should get recommendations
|
29
40
|
# for
|
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.8.1
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -129,6 +129,7 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".byebug_history"
|
132
133
|
- ".gitignore"
|
133
134
|
- ".travis.yml"
|
134
135
|
- CODE_OF_CONDUCT.md
|