seat_geek 0.14.0 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +0 -3
- data/Rakefile +6 -3
- data/bin/console +4 -4
- data/lib/seat_geek/build_query.rb +8 -8
- data/lib/seat_geek/taxonomies/child_tree.rb +16 -0
- data/lib/seat_geek/taxonomies/concert.rb +4 -15
- data/lib/seat_geek/taxonomies/sports.rb +14 -24
- data/lib/seat_geek/taxonomies/theater.rb +4 -15
- data/lib/seat_geek/taxonomies/tree.rb +6 -2
- data/lib/seat_geek/version.rb +1 -1
- data/lib/seat_geek/yaml/event_parent_id.yaml +19 -0
- data/lib/seat_geek.rb +4 -5
- data/seat_geek.gemspec +17 -16
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2af87485b2d1e7e4498afd4e89df1b788d97a7c
|
4
|
+
data.tar.gz: c341113996bcb17a90bf58ce70c6ef858606d153
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30d28e1e0833aa4f98129ad54eb0c1ad6e6c7343a13b0ed846b590f91fe791b731ed84bc68dfd2bed0788a48d00e17383e92244d52c8d5a1fcaf753a47287187
|
7
|
+
data.tar.gz: ece9c42e4c2b970dc69fe90e8844c483b973db7df06fb863b297d6d79234224983dc73c23ea980475b70493d71ba66958891818f004d04e10702e18db855dd7f
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
|
4
4
|
# Setup new RSpec for rake task
|
5
5
|
RSpec::Core::RakeTask.new(:spec)
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
require 'rubocop/rake_task'
|
8
|
+
RuboCop::RakeTask.new
|
9
|
+
|
10
|
+
task default: [:spec]
|
11
|
+
task test: :spec
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'seat_geek'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
@@ -3,17 +3,17 @@ module SeatGeek
|
|
3
3
|
|
4
4
|
def self.query_klass
|
5
5
|
@query_klass ||= {travel_dates: SeatGeek::Query::TravelDates,
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
attendee_count: SeatGeek::Query::AttendeeCount,
|
7
|
+
event_type: SeatGeek::Query::EventType,
|
8
|
+
state: SeatGeek::Query::State,
|
9
|
+
city: SeatGeek::Query::City,
|
10
|
+
rid: SeatGeek::Query::PartnerProgram,
|
11
|
+
pagination: SeatGeek::Query::Pagination
|
12
|
+
}
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.build(options, base_url)
|
16
|
-
options.reject! { |k,
|
16
|
+
options.reject! { |k, _v| k.nil? }
|
17
17
|
|
18
18
|
query_params = options.map do |key, args|
|
19
19
|
query_klass[key].new(args).query
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SeatGeek
|
2
|
+
module Taxonomies
|
3
|
+
class ChildTree
|
4
|
+
def build_child_tree
|
5
|
+
parent_object = taxonomies.detect { |taxonomy| taxonomy['id'] == parent_id }
|
6
|
+
|
7
|
+
child_taxonomies = [parent_object]
|
8
|
+
taxonomies.each do |taxonomy|
|
9
|
+
child_taxonomies << taxonomy if taxonomy['parent_id'] == parent_id
|
10
|
+
end
|
11
|
+
child_taxonomies
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
|
-
class Concert
|
4
|
-
def initialize(child_taxonomies:)
|
3
|
+
class Concert < ChildTree
|
4
|
+
def initialize(child_taxonomies:, file_path:, type:)
|
5
5
|
@taxonomies = child_taxonomies
|
6
|
+
@yaml_hash = YAML.load_file(file_path).fetch('event_parent_id').fetch(type)
|
6
7
|
end
|
7
8
|
|
8
9
|
def all
|
@@ -10,23 +11,11 @@ module SeatGeek
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def music_festival
|
13
|
-
@parent_id = '
|
14
|
+
@parent_id = @yaml_hash.fetch('music_festival')
|
14
15
|
build_tree
|
15
16
|
end
|
16
17
|
|
17
18
|
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
|
30
19
|
end
|
31
20
|
end
|
32
21
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
|
-
class Sports
|
4
|
-
def initialize(child_taxonomies:)
|
3
|
+
class Sports < ChildTree
|
4
|
+
def initialize(child_taxonomies:, file_path:, type:)
|
5
5
|
@taxonomies = child_taxonomies
|
6
|
+
@yaml_hash = YAML.load_file(file_path).fetch('event_parent_id').fetch(type)
|
6
7
|
end
|
7
8
|
|
8
9
|
def all
|
@@ -10,57 +11,57 @@ module SeatGeek
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def baseball
|
13
|
-
@parent_id =
|
14
|
+
@parent_id = @yaml_hash.fetch('baseball')
|
14
15
|
build_tree
|
15
16
|
end
|
16
17
|
|
17
18
|
def basketball
|
18
|
-
@parent_id =
|
19
|
+
@parent_id = @yaml_hash.fetch('basketball')
|
19
20
|
build_tree
|
20
21
|
end
|
21
22
|
|
22
23
|
def hockey
|
23
|
-
@parent_id =
|
24
|
+
@parent_id = @yaml_hash.fetch('hockey')
|
24
25
|
build_tree
|
25
26
|
end
|
26
27
|
|
27
28
|
def football
|
28
|
-
@parent_id =
|
29
|
+
@parent_id = @yaml_hash.fetch('football')
|
29
30
|
build_tree
|
30
31
|
end
|
31
32
|
|
32
33
|
def auto_racing
|
33
|
-
@parent_id =
|
34
|
+
@parent_id = @yaml_hash.fetch('auto_racing')
|
34
35
|
build_tree
|
35
36
|
end
|
36
37
|
|
37
38
|
def golf
|
38
|
-
@parent_id =
|
39
|
+
@parent_id = @yaml_hash.fetch('golf')
|
39
40
|
build_tree
|
40
41
|
end
|
41
42
|
|
42
43
|
def fighting
|
43
|
-
@parent_id =
|
44
|
+
@parent_id = @yaml_hash.fetch('fighting')
|
44
45
|
build_tree
|
45
46
|
end
|
46
47
|
|
47
48
|
def tennis
|
48
|
-
@parent_id =
|
49
|
+
@parent_id = @yaml_hash.fetch('tennis')
|
49
50
|
build_tree
|
50
51
|
end
|
51
52
|
|
52
53
|
def animal_sports
|
53
|
-
@parent_id =
|
54
|
+
@parent_id = @yaml_hash.fetch('animal_sports')
|
54
55
|
build_tree
|
55
56
|
end
|
56
57
|
|
57
58
|
def extreme_sports
|
58
|
-
@parent_id =
|
59
|
+
@parent_id = @yaml_hash.fetch('extreme_sports')
|
59
60
|
build_tree
|
60
61
|
end
|
61
62
|
|
62
63
|
def olympic_sports
|
63
|
-
@parent_id =
|
64
|
+
@parent_id = @yaml_hash.fetch('olympic_sports')
|
64
65
|
build_tree
|
65
66
|
end
|
66
67
|
|
@@ -68,17 +69,6 @@ module SeatGeek
|
|
68
69
|
|
69
70
|
attr_accessor :parent_id, :taxonomies
|
70
71
|
|
71
|
-
def build_child_tree
|
72
|
-
# parent_ids.each do |parent_id|
|
73
|
-
parent_object = taxonomies.detect { |taxonomy| taxonomy['id'] == parent_id }
|
74
|
-
|
75
|
-
child_taxonomies = [parent_object]
|
76
|
-
taxonomies.each do |taxonomy|
|
77
|
-
child_taxonomies << taxonomy if taxonomy['parent_id'] == parent_id
|
78
|
-
end
|
79
|
-
child_taxonomies
|
80
|
-
# end
|
81
|
-
end
|
82
72
|
end
|
83
73
|
end
|
84
74
|
end
|
@@ -1,8 +1,9 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
|
-
class Theater
|
4
|
-
def initialize(child_taxonomies:)
|
3
|
+
class Theater < ChildTree
|
4
|
+
def initialize(child_taxonomies:, file_path:, type:)
|
5
5
|
@taxonomies = child_taxonomies
|
6
|
+
@yaml_hash = YAML.load_file(file_path).fetch('event_parent_id').fetch(type)
|
6
7
|
end
|
7
8
|
|
8
9
|
def all
|
@@ -10,23 +11,11 @@ module SeatGeek
|
|
10
11
|
end
|
11
12
|
|
12
13
|
def classical
|
13
|
-
@parent_id =
|
14
|
+
@parent_id = @yaml_hash.fetch('classical')
|
14
15
|
build_child_tree
|
15
16
|
end
|
16
17
|
|
17
18
|
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
|
30
19
|
end
|
31
20
|
end
|
32
21
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module SeatGeek
|
2
2
|
module Taxonomies
|
3
3
|
class Tree
|
4
|
+
FILE_PATH = "/Users/johnmoon/Desktop/side_projects/seat_geek/lib/seat_geek/yaml/event_parent_id.yaml"
|
4
5
|
def initialize(parent_ids:, taxonomies:)
|
5
6
|
@parent_ids = parent_ids
|
6
7
|
@taxonomies = taxonomies
|
@@ -36,12 +37,15 @@ module SeatGeek
|
|
36
37
|
child_taxonomies << taxonomy if taxonomy['parent_id'].to_s[0] == parent_id.to_s[0]
|
37
38
|
end
|
38
39
|
|
39
|
-
|
40
|
+
parent_object_name = parent_object['name'].to_sym
|
41
|
+
finished_tree[parent_object_name] = tree_klass[parent_object_name].new(child_taxonomies: child_taxonomies,
|
42
|
+
file_path: FILE_PATH,
|
43
|
+
type: parent_object['name'])
|
40
44
|
end
|
41
45
|
end
|
42
46
|
|
43
47
|
def tree_klass
|
44
|
-
{
|
48
|
+
{ sports: SeatGeek::Taxonomies::Sports, concert: SeatGeek::Taxonomies::Concert, theater: SeatGeek::Taxonomies::Theater }
|
45
49
|
end
|
46
50
|
|
47
51
|
def finished_tree
|
data/lib/seat_geek/version.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
event_parent_id:
|
2
|
+
sports:
|
3
|
+
baseball: 1010000
|
4
|
+
basketball: 1030000
|
5
|
+
hockey: 1040000
|
6
|
+
football: 1020000
|
7
|
+
auto_racing: 1060000
|
8
|
+
golf: 1070000
|
9
|
+
fighting: 1080000
|
10
|
+
tennis: 1090000
|
11
|
+
animal_sports: 1100000
|
12
|
+
extreme_sports: 1110000
|
13
|
+
olympic_sports: 1120000
|
14
|
+
theater:
|
15
|
+
classical: 3010000
|
16
|
+
concert:
|
17
|
+
music_festival: 2010000
|
18
|
+
|
19
|
+
|
data/lib/seat_geek.rb
CHANGED
@@ -13,6 +13,7 @@ require "seat_geek/query/partner_program"
|
|
13
13
|
require "seat_geek/query/pagination"
|
14
14
|
|
15
15
|
require "seat_geek/taxonomies/tree"
|
16
|
+
require "seat_geek/taxonomies/child_tree"
|
16
17
|
require "seat_geek/taxonomies/sports"
|
17
18
|
require "seat_geek/taxonomies/concert"
|
18
19
|
require "seat_geek/taxonomies/theater"
|
@@ -27,11 +28,9 @@ module SeatGeek
|
|
27
28
|
PUBLIC_API_URL = 'https://api.seatgeek.com/2/'
|
28
29
|
|
29
30
|
def self.get_events(options)
|
30
|
-
|
31
|
+
partner_id = options.fetch(:seat_geek_partner_id) { 11781 }
|
32
|
+
@options = options.merge(rid: partner_id)
|
31
33
|
@base_url = PUBLIC_API_URL + 'events'
|
32
|
-
if options[:seat_geek_partner_id]
|
33
|
-
@base_url =+ "aid=#{options[:seat_geek_partner_id]}"
|
34
|
-
end
|
35
34
|
|
36
35
|
parse_response(typhoeus_request.body)
|
37
36
|
end
|
@@ -95,7 +94,7 @@ module SeatGeek
|
|
95
94
|
|
96
95
|
def typhoeus_request
|
97
96
|
Typhoeus::Request.new(build_url,
|
98
|
-
method: :get
|
97
|
+
method: :get
|
99
98
|
).run
|
100
99
|
end
|
101
100
|
|
data/seat_geek.gemspec
CHANGED
@@ -4,30 +4,31 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'seat_geek/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'seat_geek'
|
8
8
|
spec.version = SeatGeek::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['John Moon']
|
10
|
+
spec.email = ['johnmoonyy@gmail.com']
|
11
11
|
spec.summary = %q{SeatGeek Uuby wrapper}
|
12
12
|
spec.description = %q{A Ruby gem for communicating with the SeatGeek REST API}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/jmoon90/seat_geek'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
-
spec.bindir =
|
17
|
+
spec.bindir = 'exe'
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.4.0'
|
23
23
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.4.0'
|
25
|
+
spec.add_development_dependency 'pry-byebug', '~> 3.3.0'
|
26
|
+
spec.add_development_dependency 'awesome_print', '~> 1.6.1'
|
27
|
+
spec.add_development_dependency 'rubocop'
|
27
28
|
|
28
|
-
spec.add_runtime_dependency
|
29
|
-
spec.add_dependency
|
30
|
-
spec.add_dependency
|
29
|
+
spec.add_runtime_dependency 'scoped_attr_accessor', '~> 1.0.3'
|
30
|
+
spec.add_dependency 'typhoeus', '~> 1.0.1'
|
31
|
+
spec.add_dependency 'oj', '~> 2.14.4'
|
31
32
|
|
32
|
-
spec.add_dependency
|
33
|
+
spec.add_dependency 'vcr', '~> 2.9.3'
|
33
34
|
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.14.
|
4
|
+
version: 0.14.2
|
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-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.6.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
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
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: scoped_attr_accessor
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,11 +175,13 @@ files:
|
|
161
175
|
- lib/seat_geek/query/partner_program.rb
|
162
176
|
- lib/seat_geek/query/state.rb
|
163
177
|
- lib/seat_geek/query/travel_dates.rb
|
178
|
+
- lib/seat_geek/taxonomies/child_tree.rb
|
164
179
|
- lib/seat_geek/taxonomies/concert.rb
|
165
180
|
- lib/seat_geek/taxonomies/sports.rb
|
166
181
|
- lib/seat_geek/taxonomies/theater.rb
|
167
182
|
- lib/seat_geek/taxonomies/tree.rb
|
168
183
|
- lib/seat_geek/version.rb
|
184
|
+
- lib/seat_geek/yaml/event_parent_id.yaml
|
169
185
|
- seat_geek.gemspec
|
170
186
|
homepage: https://github.com/jmoon90/seat_geek
|
171
187
|
licenses:
|