vivid_seats 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,54 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ module VividSeats
5
+ class API
6
+ Error = Class.new(StandardError)
7
+ Timeout = Class.new(Error)
8
+ Unauthorized = Class.new(Error)
9
+
10
+ include HTTParty
11
+
12
+ base_uri 'https://webservices.vividseats.com/rest/v2'
13
+ default_params :accessId => ENV['VIVID_ACCESS_ID']
14
+ parser lambda { |body, format| JSON.parse(body) }
15
+
16
+ if ENV['VIVID_SEATS_PROXY']
17
+ http_proxy *ENV['VIVID_SEATS_PROXY'].split(':')
18
+ end
19
+
20
+ class << self
21
+ def categories(query={})
22
+ get('/getCategories', :query => query)
23
+ end
24
+
25
+ def performances(query={})
26
+ get('/getEventPerformers', :query => query)
27
+ end
28
+
29
+ def events(query={})
30
+ get('/getEvents', :query => query)
31
+ end
32
+
33
+ def performers(query={})
34
+ get('/getPerformers', :query => query)
35
+ end
36
+
37
+ def get(*args)
38
+ response = super
39
+
40
+ case response.code
41
+ when 412
42
+ raise Unauthorized.new(response.body)
43
+ else
44
+ response
45
+ end
46
+ rescue Errno::ECONNRESET
47
+ raise Error.new($!.message)
48
+ rescue Errno::ETIMEDOUT
49
+ raise Timeout.new($!.message)
50
+ end
51
+ private :get
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,7 @@
1
+ module VividSeats
2
+ class Category
3
+ def all
4
+ API.categories
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module VividSeats
2
+ class Event
3
+ def all(query={})
4
+ API.events(query)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module VividSeats
2
+ class Performance
3
+ def all(query={})
4
+ API.performances(query)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module VividSeats
2
+ class Performer
3
+ def all(query={})
4
+ API.performers(query)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ module VividSeats
2
+ autoload :API, 'vivid_seats/api'
3
+
4
+ autoload :Category, 'vivid_seats/category'
5
+ autoload :Event, 'vivid_seats/event'
6
+ autoload :Performance, 'vivid_seats/performance'
7
+ autoload :Performer, 'vivid_seats/performer'
8
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vivid_seats
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Tyler Hunt
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-02-02 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: httparty
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - "="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 6
31
+ - 1
32
+ version: 0.6.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: json
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - "="
42
+ - !ruby/object:Gem::Version
43
+ segments:
44
+ - 1
45
+ - 5
46
+ - 1
47
+ version: 1.5.1
48
+ type: :runtime
49
+ version_requirements: *id002
50
+ - !ruby/object:Gem::Dependency
51
+ name: rspec
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - "="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 2
60
+ - 3
61
+ - 0
62
+ version: 2.3.0
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: vcr
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - "="
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 1
75
+ - 4
76
+ - 0
77
+ version: 1.4.0
78
+ type: :development
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: webmock
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - "="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 1
90
+ - 6
91
+ - 1
92
+ version: 1.6.1
93
+ type: :development
94
+ version_requirements: *id005
95
+ description:
96
+ email:
97
+ executables: []
98
+
99
+ extensions: []
100
+
101
+ extra_rdoc_files: []
102
+
103
+ files:
104
+ - lib/vivid_seats/api.rb
105
+ - lib/vivid_seats/category.rb
106
+ - lib/vivid_seats/event.rb
107
+ - lib/vivid_seats/performance.rb
108
+ - lib/vivid_seats/performer.rb
109
+ - lib/vivid_seats.rb
110
+ has_rdoc: true
111
+ homepage: http://github.com/tylerhunt/vivid_seats
112
+ licenses: []
113
+
114
+ post_install_message:
115
+ rdoc_options: []
116
+
117
+ require_paths:
118
+ - lib
119
+ required_ruby_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ segments:
125
+ - 0
126
+ version: "0"
127
+ required_rubygems_version: !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ segments:
133
+ - 0
134
+ version: "0"
135
+ requirements: []
136
+
137
+ rubyforge_project:
138
+ rubygems_version: 1.3.7
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: An interface library for the Vivid Seats web service.
142
+ test_files: []
143
+