ticketfly 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/ticketfly.rb +39 -1
  3. data/ticketfly.gemspec +1 -1
  4. metadata +12 -12
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/lib/ticketfly.rb CHANGED
@@ -23,16 +23,29 @@ module Ticketfly
23
23
  venue
24
24
  end
25
25
  end
26
+
27
+ class Headliner
28
+ attr_accessor :id, :name, :json
29
+ def self.build(json)
30
+ headliner = Headliner.new
31
+ headliner.id = json['id']
32
+ headliner.name = json['name']
33
+ headliner.json = json
34
+ headliner
35
+ end
36
+ end
26
37
 
27
38
  class Event
28
- attr_accessor :id, :name, :venue, :org, :json
39
+ attr_accessor :id, :name, :venue, :org, :date, :json, :headliners
29
40
  def self.build(json)
30
41
  event = Event.new
42
+ event.headliners = []
31
43
  event.id = json['id']
32
44
  event.name = json['name']
33
45
  event.json = json
34
46
  event.venue = Venue.build(json['venue'])
35
47
  event.org = Org.build(json['org'])
48
+ event.date = json['startDate']
36
49
  event
37
50
  end
38
51
  end
@@ -45,6 +58,31 @@ module Ticketfly
45
58
  Event.build(result['events'].first)
46
59
  end
47
60
 
61
+ def self.get_next_event_by_venue_id(venue_id)
62
+ base_uri = "http://www.ticketfly.com/api/events/upcoming.json"
63
+ max_results = 1
64
+ result = JSON.parse(open(base_uri + "?venueId=" + venue_id.to_s).read)
65
+ Event.build(result['events'].first)
66
+ end
67
+
68
+ def self.get_by_venue_id(venue_id)
69
+ base_uri = "http://www.ticketfly.com/api/events/upcoming.json"
70
+ max_results = 200
71
+ events = []
72
+ total_pages = 1
73
+ page = 1
74
+ begin
75
+ result = JSON.parse(open(base_uri + "?venueId=" + venue_id.to_s).read)
76
+ total_pages = result["totalPages"]
77
+ result['events'].each do |e|
78
+ event = Event.build(e)
79
+ events << event
80
+ end
81
+ page += 1
82
+ end while not page > total_pages
83
+ events
84
+ end
85
+
48
86
  def self.search(query)
49
87
  base_uri = "http://www.ticketfly.com/api/events/upcoming.json"
50
88
  max_results = 200
data/ticketfly.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ticketfly"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Charley Hine"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ticketfly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
16
- requirement: &70213148743940 !ruby/object:Gem::Requirement
16
+ requirement: &70225808293340 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70213148743940
24
+ version_requirements: *70225808293340
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &70213148742860 !ruby/object:Gem::Requirement
27
+ requirement: &70225808292180 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70213148742860
35
+ version_requirements: *70225808292180
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &70213148757380 !ruby/object:Gem::Requirement
38
+ requirement: &70225808289360 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3.12'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70213148757380
46
+ version_requirements: *70225808289360
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70213148756200 !ruby/object:Gem::Requirement
49
+ requirement: &70225808301800 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70213148756200
57
+ version_requirements: *70225808301800
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70213148754840 !ruby/object:Gem::Requirement
60
+ requirement: &70225808301040 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 1.8.3
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70213148754840
68
+ version_requirements: *70225808301040
69
69
  description: A ruby implementation of the Ticketfly event and venue API.
70
70
  email: charles.hine@gmail.com
71
71
  executables: []
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: 4326588423763551586
103
+ hash: 4317577769993306950
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements: