seat_geek 0.4.1 → 0.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd5d921349d85661378ff27d9ecb023856482865
4
- data.tar.gz: f0ea333ebcfc479f84ef8cc3df29b0ae60d0a404
3
+ metadata.gz: 3d55fd815c4c10b39965f4f82b116c160f822761
4
+ data.tar.gz: efe51d2eff9a71ac78c5dab7196006c5e3bbeb7d
5
5
  SHA512:
6
- metadata.gz: 3b50f96f6adede224ce97c039b84bae72f5a6f0d768fe417dd0d91192376464da8fa41830ff630259d51b87d6a1db645384a91fcb49421c1b6db6a3a07cf6dbb
7
- data.tar.gz: e76ec66f3a866c2862fb987cc5f5a7a08a5e035cbd6b7d31b6e44fc9c8b304b24e5349e664bd6045ae45ec9393c51d4561681ba61401fa62a4b43f256d86e231
6
+ metadata.gz: 861f2d78951233b676f9d1bed6c2ab35e00994c5208f73d5c7371d55186f694adbe4c0ee739501387f2225197d0fbe46ad2ebb34a9c393917cc7d0705564a8d1
7
+ data.tar.gz: f42bd5c892b2e7eacde1c861abbf88c90d8c1746e420d0aaa231396d505bb11dfe7fc1f7482ddd51941252f98389f9897afba171d65e84ba23298352cd44dbee
@@ -1,9 +1,12 @@
1
1
  module SeatGeek
2
2
  class BuildQuery
3
- def self.build(options)
3
+ def self.build(options, base_url)
4
4
  query = ""
5
+ if !base_url.match(/\?/)
6
+ query = "?"
7
+ end
5
8
  if options[:month_of_the_year]
6
- query = month_query(options[:month_of_the_year])
9
+ query = query + month_query(options[:month_of_the_year])
7
10
  end
8
11
  if options[:state]
9
12
  query = query + location_query(options[:state])
@@ -14,7 +17,7 @@ module SeatGeek
14
17
  if options[:event_type]
15
18
  query = query + event_type_query(options[:event_type])
16
19
  end
17
- options[:base_url] + query
20
+ base_url + query
18
21
  end
19
22
 
20
23
  private
@@ -28,7 +31,7 @@ module SeatGeek
28
31
  first_day_of_month = Date.civil(year, month, 1).strftime('%F')
29
32
  last_day_of_month = Date.civil(year, month, -1).strftime('%F')
30
33
 
31
- "?datetime_utc.gte=#{first_day_of_month}&datetime_utc.lte=#{last_day_of_month}"
34
+ "&datetime_utc.gte=#{first_day_of_month}&datetime_utc.lte=#{last_day_of_month}"
32
35
  end
33
36
 
34
37
  # Events in NY state
@@ -54,7 +54,7 @@ module SeatGeek
54
54
  attr_accessor :base_url
55
55
 
56
56
  def build_url
57
- BuildQuery.build(options)
57
+ BuildQuery.build({}, base_url)
58
58
  end
59
59
 
60
60
  def typhoeus_request
@@ -67,15 +67,5 @@ module SeatGeek
67
67
  def parse_response(json_string)
68
68
  Oj.load(json_string)
69
69
  end
70
-
71
- def options
72
- {
73
- base_url: base_url,
74
- # month_of_the_year: month_of_the_year,
75
- # state: state,
76
- # attendee_count: attendee_count,
77
- # event_type: event_type,
78
- }
79
- end
80
70
  end
81
71
  end
@@ -1,3 +1,3 @@
1
1
  module SeatGeek
2
- VERSION = "0.4.1"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/seat_geek.rb CHANGED
@@ -6,50 +6,45 @@ require 'oj'
6
6
 
7
7
  module SeatGeek
8
8
  extend self
9
- PUBLIC_API_URL = 'http://api.seatgeek.com/2'
9
+ PUBLIC_API_URL = 'http://api.seatgeek.com/2/events?'
10
10
 
11
- def self.get_events(month_of_the_year: nil, state: nil, attendee_count: nil, event_type: nil, seat_geek_partner_id: nil)
12
- @base_url = PUBLIC_API_URL + "/events?aid=#{seat_geek_partner_id}"
13
- @month_of_the_year = month_of_the_year
14
- @state = state
15
- @attendee_count = attendee_count
16
- @event_type = event_type
11
+ def self.get_events(options)
12
+ @options = options
13
+ @base_url = PUBLIC_API_URL
14
+ if options[:seat_geek_partner_id]
15
+ @base_url =+ "aid=#{options[:seat_geek_partner_id]}"
16
+ end
17
17
 
18
18
  parse_response(typhoeus_request.body)
19
19
  end
20
20
 
21
- def self.get_taxonomies
22
- @base_url = PUBLIC_API_URL + '/taxonomies'
23
- @month_of_the_year = nil
24
- @state = nil
25
- @attendee_count = nil
26
- @event_type = nil
21
+ #TODO Need to think this through
22
+ # not sure how to get recommendations or what we should get recommendations
23
+ # for
27
24
 
28
- parse_response(typhoeus_request.body)
29
- end
25
+ #Possible have a show page for the each events
26
+ #Then add recommendations on the bottom for that event_id + zipcode
30
27
 
31
- #TODO incomplete
32
28
  #GET http://api.seatgeek.com/2/recommendations
33
-
34
- def self.get_recommendations(client_key:)
35
- @base_url = PUBLIC_API_URL + '/recommendations'
29
+ def self.get_recommendations()#client_key:)
30
+ @base_url = PUBLIC_API_URL + '/recommendations?client_id=MzkzMjEyMnwxNDQ5MjgzMTQ1'
36
31
  parse_response(typhoeus_request.body)
37
32
  end
38
33
 
39
34
  private
40
35
 
41
- attr_accessor :month_of_the_year, :state, :attendee_count, :event_type, :base_url
36
+ attr_accessor :options, :base_url
42
37
 
43
38
  # Instead of BuildQuery what if it's the Method name?
44
39
  # E.G Recommendations.build(options)
45
40
  # E.G Events.build(options)
46
41
  # This way each build could have their own custom settings
47
42
  def build_url
48
- BuildQuery.build(options)
43
+ BuildQuery.build(options, base_url)
49
44
  end
50
45
 
51
46
  def typhoeus_request
52
- request = Typhoeus::Request.new(build_url,
47
+ Typhoeus::Request.new(build_url,
53
48
  method: :get,
54
49
  headers: { Accept: "json" }
55
50
  ).run
@@ -58,14 +53,4 @@ module SeatGeek
58
53
  def parse_response(json_string)
59
54
  Oj.load(json_string)
60
55
  end
61
-
62
- def options
63
- {
64
- base_url: base_url,
65
- month_of_the_year: month_of_the_year,
66
- state: state,
67
- attendee_count: attendee_count,
68
- event_type: event_type,
69
- }
70
- end
71
56
  end
data/seat_geek.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency "rspec"
25
25
  spec.add_development_dependency "pry-byebug"
26
+ spec.add_development_dependency "awesome_print"
26
27
 
27
28
  spec.add_runtime_dependency "scoped_attr_accessor"
28
29
  spec.add_dependency "typhoeus"
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.1
4
+ version: 0.6.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: 2015-12-27 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: awesome_print
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: scoped_attr_accessor
71
85
  requirement: !ruby/object:Gem::Requirement