ticketfly_plus 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6e655a91b8d779ee510c945be6cc090159779c5b
4
+ data.tar.gz: e1617445ae1ad94583fd1420271e9fd9398f4dda
5
+ SHA512:
6
+ metadata.gz: 5a65e2285a961eb5fa26f69330db99b9616034e302cb16cfa66e159e4332cb43b3ec1289a41221393a4511e623195859121ba6647561edb8b735fa3b7c0052fd
7
+ data.tar.gz: c554abdf248cd2b9fef21dc329ec788634cd4e5af087e95cbfb06a2c61cc4cfccc52499aeb9cf13f1b2f9355035f3c1a65106803376cdf2164ea87010bb2277b
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ticketfly_plus.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,11 @@
1
+ guard 'rspec' do
2
+ # watch /lib/ files
3
+ watch(%r{^lib/(.+).rb$}) do |m|
4
+ "spec/#{m[1]}_spec.rb"
5
+ end
6
+
7
+ # watch /spec/ files
8
+ watch(%r{^spec/(.+).rb$}) do |m|
9
+ "spec/#{m[1]}.rb"
10
+ end
11
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Joshua Nathaniel Miller
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # TicketflyPlus
2
+
3
+ Get usable ticketfly data.
4
+
5
+ #### Work in progress
6
+
7
+ Testing, Shareasale url functionality, Standard Location params
8
+
9
+ ### Testing
10
+
11
+ Work in progress...
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ gem 'ticketfly_plus'
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install ticketfly_plus
26
+
27
+ ## Usage
28
+
29
+ #### First make a request using the requestors:
30
+
31
+ response = TicketflyPlus::Requestors::Events.new(:orgId => 1).upcoming
32
+
33
+ #### Then pass the response to the corresponding TicketflyPlus response:
34
+
35
+ data = TicketflyPlus::Responses::Events.new(response)
36
+
37
+ ##### Work in progress...
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it ( https://github.com/[my-github-username]/ticketfly_plus/fork )
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'rspec/core/rake_task'
2
+ require "bundler/gem_tasks"
3
+
4
+ # Default directory to look in is `/specs`
5
+ # Run with `rake spec`
6
+ RSpec::Core::RakeTask.new(:spec) do |task|
7
+ task.rspec_opts = ['--color', '--format', 'nested']
8
+ end
9
+
10
+ task :default => :spec
11
+
@@ -0,0 +1,388 @@
1
+ module TicketflyPlus
2
+ class Objects
3
+ class Event
4
+ attr_accessor :additionalInfo
5
+ attr_accessor :additionalTicketText
6
+ attr_accessor :ageLimit
7
+ attr_accessor :ageLimitCode
8
+ attr_accessor :dateCreated
9
+ attr_accessor :doorsDate
10
+ attr_accessor :endDate
11
+ attr_accessor :eventStatus
12
+ attr_accessor :eventStatusCode
13
+ attr_accessor :eventStatusMessage
14
+ attr_accessor :externalTicketingUrls
15
+ attr_accessor :facebookEventId
16
+ attr_accessor :facebookEventIdString
17
+ attr_accessor :featured
18
+ attr_accessor :headliners
19
+ attr_accessor :headlinersName
20
+ attr_accessor :id
21
+ attr_accessor :image
22
+ attr_accessor :lastUpdated
23
+ attr_accessor :name
24
+ attr_accessor :offSaleDate
25
+ attr_accessor :onSaleDate
26
+ attr_accessor :onSaleDates
27
+ attr_accessor :org
28
+ attr_accessor :promoterName
29
+ attr_accessor :publishDate
30
+ attr_accessor :published
31
+ attr_accessor :purchaseSkin
32
+ attr_accessor :showType
33
+ attr_accessor :showTypeCode
34
+ attr_accessor :slug
35
+ attr_accessor :sponsorImage
36
+ attr_accessor :sponsorName
37
+ attr_accessor :startDate
38
+ attr_accessor :supports
39
+ attr_accessor :supportsName
40
+ attr_accessor :ticketPrice
41
+ attr_accessor :ticketPurchaseUrl
42
+ attr_accessor :topLineInfo
43
+ attr_accessor :urlEventDetailsUrl
44
+ attr_accessor :venue
45
+
46
+ def initialize(event)
47
+ @additionalInfo = event['additionalInfo']
48
+ @additionalTicketText = event['additionalTicketText']
49
+ @ageLimit = event['ageLimit']
50
+ @ageLimitCode = event['ageLimitCode']
51
+ @dateCreated = event['dateCreated'] != nil ? DateTime.parse(event['dateCreated']) : event['dateCreated']
52
+ @doorsDate = event['doorsDate'] != nil ? DateTime.parse(event['doorsDate']) : event['doorsDate']
53
+ @endDate = event['endDate'] != nil ? DateTime.parse(event['endDate']) : event['endDate']
54
+ @eventStatus = event['eventStatus']
55
+ @eventStatusCode = event['eventStatusCode']
56
+ @eventStatusMessage = event['eventStatusMessage']
57
+ @externalTicketingUrls = event['externalTicketingUrls'] != nil ? get_ticketing_urls(event['externalTicketingUrls']) : event['externalTicketingUrls']
58
+ @facebookEventId = event['facebookEventId']
59
+ @facebookEventIdString = event['facebookEventIdString']
60
+ @featured = event['featured']
61
+ @headliners = event['headliners'] != nil ? get_attractions(event['headliners']) : event['headliners']
62
+ @headlinersName = event['headlinersName']
63
+ @id = event['id']
64
+ @image = event['image'] != nil ? Objects::Image.new(event['image']) : event['image']
65
+ @lastUpdated = event['lastUpdated'] != nil ? DateTime.parse(event['lastUpdated']) : event['lastUpdated']
66
+ @name = event['name']
67
+ @offSaleDate = event['offSaleDate'] != nil ? DateTime.parse(event['offSaleDate']) : event['offSaleDate']
68
+ @onSaleDate = event['onSaleDate'] != nil ? DateTime.parse(event['onSaleDate']) : event['onSaleDate']
69
+ @onSaleDates = event['onSaleDates'] != nil ? get_on_sale_dates(event['onSaleDates']) : event['onSaleDates']
70
+ @org = event['org'] != nil ? Objects::Org.new(event['org']) : event['org']
71
+ @promoterName = event['promoterName']
72
+ @publishDate = event['publishDate'] != nil ? DateTime.parse(event['publishDate']) : event['publishDate']
73
+ @published = event['published']
74
+ @purchaseSkin = event['purchaseSkin'] != nil ? Objects::PurchaseSkin.new(event['purchaseSkin']) : event['purchaseSkin']
75
+ @showType = event['showType']
76
+ @showTypeCode = event['showTypeCode']
77
+ @slug = event['slug']
78
+ @sponsorImage = event['sponsorImage'] != nil ? Objects::Image.new(event['sponsorImage']) : event['sponsorImage']
79
+ @sponsorName = event['sponsorName']
80
+ @startDate = event['startDate'] != nil ? DateTime.parse(event['startDate']) : event['startDate']
81
+ @supports = event['supports'] != nil ? get_attractions(event['supports']) : event['supports']
82
+ @supportsName = event['supportsName']
83
+ @ticketPrice = event['ticketPrice']
84
+ @ticketPurchaseUrl = event['ticketPurchaseUrl']
85
+ @topLineInfo = event['topLineInfo']
86
+ @urlEventDetailsUrl = event['urlEventDetailsUrl']
87
+ @venue = event['venue'] != nil ? Objects::Venue.new(event['venue']) : event['venue']
88
+ end
89
+
90
+ private
91
+
92
+ def get_on_sale_dates(dates)
93
+ arr = Array.new
94
+ if dates.length > 0
95
+ dates.each do |date|
96
+ arr.push Objects::SaleDate.new(date)
97
+ end
98
+ end
99
+ arr
100
+ end
101
+
102
+ def get_ticketing_urls(urls)
103
+ arr = Array.new
104
+ if urls.length > 0
105
+ urls.each do |url|
106
+ arr.push Objects::TicketingUrl.new(url)
107
+ end
108
+ end
109
+ arr
110
+ end
111
+
112
+ def get_attractions(attractions)
113
+ arr = Array.new
114
+ if attractions.length > 0
115
+ attractions.each do |attraction|
116
+ arr.push Objects::Attraction.new(attraction)
117
+ end
118
+ end
119
+ arr
120
+ end
121
+ end
122
+
123
+ class Org
124
+ attr_accessor :id
125
+ attr_accessor :name
126
+ attr_accessor :promoter
127
+ attr_accessor :timeZone
128
+
129
+ def initialize(org)
130
+ @id = org['id']
131
+ @name = org['name']
132
+ @promoter = org['promoter']
133
+ @timeZone = org['timeZone']
134
+ end
135
+ end
136
+
137
+ class Venue
138
+ attr_accessor :address1
139
+ attr_accessor :address2
140
+ attr_accessor :blurb
141
+ attr_accessor :city
142
+ attr_accessor :country
143
+ attr_accessor :id
144
+ attr_accessor :image
145
+ attr_accessor :lat
146
+ attr_accessor :lng
147
+ attr_accessor :metroCode
148
+ attr_accessor :name
149
+ attr_accessor :postalCode
150
+ attr_accessor :stateProvince
151
+ attr_accessor :timeZone
152
+ attr_accessor :url
153
+ attr_accessor :urlFacebook
154
+ attr_accessor :urlTwitter
155
+
156
+ def initialize(venue)
157
+ @address1 = venue['address1']
158
+ @address2 = venue['address2']
159
+ @blurb = venue['blurb']
160
+ @city = venue['city']
161
+ @country = venue['country']
162
+ @id = venue['id']
163
+ @image = venue['image'] != nil ? Objects::Image.new(venue['image']) : venue['image']
164
+ @lat = venue['lat']
165
+ @lng = venue['lng']
166
+ @metroCode = venue['metrocode']
167
+ @name = venue['name']
168
+ @postalCode = venue['postalCode']
169
+ @stateProvince = venue['stateProvince']
170
+ @timeZone = venue['timeZone']
171
+ @url = venue['url']
172
+ @urlFacebook = venue['urlFacebook']
173
+ @urlTwitter = venue['urlTwitter']
174
+ end
175
+ end
176
+
177
+ class YoutubeVideo
178
+ attr_accessor :embedCodeIframe
179
+ attr_accessor :title
180
+ attr_accessor :videoId
181
+
182
+ def initialize(video)
183
+ @embedcodeiframe = video['embedcodeiframe']
184
+ @title = video['title']
185
+ @videoid = video['videoid']
186
+ end
187
+ end
188
+
189
+ class Attraction
190
+ attr_accessor :embedAudio
191
+ attr_accessor :embedVideo
192
+ attr_accessor :eventDescription
193
+ attr_accessor :id
194
+ attr_accessor :image
195
+ attr_accessor :isMobileFriendlyBoolean
196
+ attr_accessor :name
197
+ attr_accessor :startTime
198
+ attr_accessor :twitterScreenName
199
+ attr_accessor :urlFacebook
200
+ attr_accessor :urlMySpace
201
+ attr_accessor :urlOfficialWebsite
202
+ attr_accessor :urlPurchaseMusic
203
+ attr_accessor :urlTwitter
204
+ attr_accessor :youtubeVideos
205
+
206
+ def initialize(attraction)
207
+ @embedAudio = attraction['embedAudio']
208
+ @embedVideo = attraction['embedVideo']
209
+ @eventDescription = attraction['eventDescription']
210
+ @id = attraction['id']
211
+ @image = attraction['image'] != nil ? Objects::Image.new(attraction['image']) : attraction['image']
212
+ @isMobileFriendlyBoolean = attraction['isMobileFriendlyBoolean']
213
+ @name = attraction['name']
214
+ @startTime = attraction['startTime'] != nil ? Time.parse(attraction['startTime']) : attraction['startTime']
215
+ @twitterScreenName = attraction['twitterScreenName']
216
+ @urlFacebook = attraction['urlFacebook']
217
+ @urlMySpace = attraction['urlMySpace']
218
+ @urlOfficialWebsite = attraction['urlOfficialWebsite']
219
+ @urlPurchaseMusic = attraction['urlPurchaseMusic']
220
+ @urlTwitter = attraction['urlTwitter']
221
+ @youtubeVideos = attraction['youtubeVideos'] != nil ? get_youtube_videos(attraction['youtubeVideos']) : attraction['youtubeVideos']
222
+ end
223
+
224
+ private
225
+
226
+ def get_youtube_videos(videos)
227
+ arr = Array.new
228
+ if videos.length > 0
229
+ videos.each do |video|
230
+ arr.push Objects::YoutubeVideo.new(video)
231
+ end
232
+ end
233
+ arr
234
+ end
235
+ end
236
+
237
+ class ImageDetails
238
+ attr_accessor :height
239
+ attr_accessor :path
240
+ attr_accessor :width
241
+
242
+ def initialize(image_details)
243
+ @height = image_details['height']
244
+ @path = image_details['path']
245
+ @width = image_details['width']
246
+ end
247
+ end
248
+
249
+ class Image
250
+ attr_accessor :jumbo
251
+ attr_accessor :jumbo1
252
+ attr_accessor :large
253
+ attr_accessor :large1
254
+ attr_accessor :medium
255
+ attr_accessor :medium1
256
+ attr_accessor :original
257
+ attr_accessor :small
258
+ attr_accessor :small1
259
+ attr_accessor :square
260
+ attr_accessor :squareSmall
261
+ attr_accessor :xlarge
262
+ attr_accessor :xlarge1
263
+ attr_accessor :xxlarge
264
+ attr_accessor :xxlarge1
265
+
266
+ def initialize(image)
267
+ @jumbo = check_nil(image['jumbo'])
268
+ @jumbo1 = check_nil(image['jumbo1'])
269
+ @large = check_nil(image['large'])
270
+ @large1 = check_nil(image['large1'])
271
+ @medium = check_nil(image['medium'])
272
+ @medium1 = check_nil(image['medium1'])
273
+ @original = check_nil(image['original'])
274
+ @small = check_nil(image['small'])
275
+ @small1 = check_nil(image['small1'])
276
+ @square = check_nil(image['square'])
277
+ @squareSmall = check_nil(image['squareSmall'])
278
+ @xlarge = check_nil(image['xlarge'])
279
+ @xlarge1 = check_nil(image['xlarge1'])
280
+ @xxlarge = check_nil(image['xxlarge'])
281
+ @xxlarge1 = check_nil(image['xxlarge1'])
282
+ end
283
+
284
+ private
285
+
286
+ def check_nil(image)
287
+ image != nil ? Objects::ImageDetails.new(image) : image
288
+ end
289
+ end
290
+
291
+ class TicketingUrl
292
+ attr_accessor :name
293
+ attr_accessor :url
294
+
295
+ def initialize(url)
296
+ @name = url['name']
297
+ @url = url['url']
298
+ end
299
+ end
300
+
301
+ class SaleDate
302
+ attr_accessor :endDate
303
+ attr_accessor :name
304
+ attr_accessor :startDate
305
+
306
+ def initialize(date)
307
+ @endDate = date['endDate'] != nil ? DateTime.parse(date['endDate']) : date['endDate']
308
+ @name = date['name']
309
+ @startDate = date['startDate'] != nil ? DateTime.parse(date['startDate']) : date['startDate']
310
+ end
311
+ end
312
+ class PurchaseSkin
313
+ attr_accessor :backgroundColor
314
+ attr_accessor :backgroundFixed
315
+ attr_accessor :backgroundImage
316
+ attr_accessor :backgroundPositionType
317
+ attr_accessor :backgroundRepeatType
318
+ attr_accessor :bodyHoverColor
319
+ attr_accessor :bodyLinkColor
320
+ attr_accessor :bodyTextColor
321
+ attr_accessor :class
322
+ attr_accessor :contentBackgroundColor
323
+ attr_accessor :dateCreated
324
+ attr_accessor :eventInfoBoxBackgroundColor
325
+ attr_accessor :eventInfoBoxBorderColor
326
+ attr_accessor :eventInfoBoxHeadlinerColor
327
+ attr_accessor :eventInfoBoxHoverColor
328
+ attr_accessor :eventInfoBoxLinkColor
329
+ attr_accessor :eventInfoBoxTextColor
330
+ attr_accessor :eventInfoSubheadColor
331
+ attr_accessor :eventInfoSubheadTextColor
332
+ attr_accessor :footerHtml
333
+ attr_accessor :footerImage
334
+ attr_accessor :footerTextColor
335
+ attr_accessor :footerTicketflyLogo
336
+ attr_accessor :headerHtml
337
+ attr_accessor :headerImage
338
+ attr_accessor :headerTextColor
339
+ attr_accessor :headerTicketflyLogo
340
+ attr_accessor :id
341
+ attr_accessor :lastUpdated
342
+ attr_accessor :name
343
+ attr_accessor :org
344
+ attr_accessor :secondaryBorderColor
345
+ attr_accessor :theme
346
+ attr_accessor :ticketButtonColor
347
+ attr_accessor :ticketButtonTextColor
348
+
349
+ def initialize(skin)
350
+ @backgroundColor = skin['backgroundColor']
351
+ @backgroundFixed = skin['backgroundFixed']
352
+ @backgroundImage = skin['backgroundImage']
353
+ @backgroundPositionType = skin['backgroundPositionType']
354
+ @backgroundRepeatType = skin['backgroundRepeatType']
355
+ @bodyHoverColor = skin['bodyHoverColor']
356
+ @bodyLinkColor = skin['bodyLinkColor']
357
+ @bodyTextColor = skin['bodyTextColor']
358
+ @class = skin['class']
359
+ @contentBackgroundColor = skin['contentBackgroundColor']
360
+ @dateCreated = skin['dateCreated']
361
+ @eventInfoBoxBackgroundColor = skin['eventInfoBoxBackgroundColor']
362
+ @eventInfoBoxBorderColor = skin['eventInfoBoxBorderColor']
363
+ @eventInfoBoxHeadlinerColor = skin['eventInfoBoxHeadlinerColor']
364
+ @eventInfoBoxHoverColor = skin['eventInfoBoxHoverColor']
365
+ @eventInfoBoxLinkColor = skin['eventInfoBoxLinkColor']
366
+ @eventInfoBoxTextColor = skin['eventInfoBoxTextColor']
367
+ @eventInfoSubheadColor = skin['eventInfoSubheadColor']
368
+ @eventInfoSubheadTextColor = skin['eventInfoSubheadTextColor']
369
+ @footerHtml = skin['footerHtml']
370
+ @footerImage = skin['footerImage']
371
+ @footerTextColor = skin['footerTextColor']
372
+ @footerTicketflyLogo = skin['footerTicketflyLogo']
373
+ @headerHtml = skin['headerHtml']
374
+ @headerImage = skin['headerImage']
375
+ @headerTextColor = skin['headerTextColor']
376
+ @headerTicketflyLogo = skin['headerTicketflyLogo']
377
+ @id = skin['id']
378
+ @lastUpdated = skin['lastUpdated']
379
+ @name = skin['name']
380
+ @org = skin['org']
381
+ @secondaryBorderColor = skin['secondaryBorderColor']
382
+ @theme = skin['theme']
383
+ @ticketButtonColor = skin['ticketButtonColor']
384
+ @ticketButtonTextColor = skin['ticketButtonTextColor']
385
+ end
386
+ end
387
+ end
388
+ end
@@ -0,0 +1,182 @@
1
+ module TicketflyPlus
2
+ class Requestors
3
+ require 'json'
4
+ require 'net/https'
5
+ require 'uri'
6
+
7
+ class Base
8
+ BASE_STRING = 'http://www.ticketfly.com/api'
9
+ attr_accessor :params
10
+
11
+ def initialize(options={})
12
+ @params = Array.new
13
+ end
14
+
15
+ def request(string)
16
+ url = URI.parse(BASE_STRING + string)
17
+ request = Net::HTTP::Get.new(url.request_uri)
18
+ http = Net::HTTP.new(url.host, url.port)
19
+ result = http.start do |ht|
20
+ ht.request(request)
21
+ end
22
+ response = JSON.parse(result.body)
23
+ end
24
+
25
+ private
26
+
27
+ def stringify(prefix, value)
28
+ value != nil ? ("&" + prefix + fill_spaces(value)) : ''
29
+ end
30
+
31
+ def fill_spaces(value)
32
+ str = value.to_s.split
33
+ count = 0
34
+ arr = Array.new
35
+ str.each do |word|
36
+ if count == 0
37
+ arr.push(word)
38
+ else
39
+ arr.push("%20" + word)
40
+ end
41
+ count +=1
42
+ end
43
+ arr.join
44
+ end
45
+ end
46
+
47
+ class Events < Requestors::Base
48
+ EVENTS_STRING = '/events'
49
+ attr_accessor :artistName
50
+ attr_accessor :fieldGroup
51
+ attr_accessor :fields
52
+ attr_accessor :fromDate
53
+ attr_accessor :maxResults
54
+ attr_accessor :orgId
55
+ attr_accessor :pageNum
56
+ attr_accessor :q
57
+ attr_accessor :skin
58
+ attr_accessor :tflyTicketed
59
+ attr_accessor :thruDate
60
+ attr_accessor :venueId
61
+
62
+ attr_accessor :geo
63
+ attr_accessor :ip
64
+ attr_accessor :clientip
65
+ attr_accessor :distance
66
+
67
+ def initialize(options={})
68
+ super
69
+ @params.push(@artistName = stringify('artistName=', options[:artistName]))
70
+ @params.push(@fields = stringify('fields=', options[:fields]))
71
+ @params.push(@fieldsGroup = stringify('fieldsGroup=', options[:fieldsGroup]))
72
+ @params.push(@fromDate = stringify('fromDate=', options[:fromDate]))
73
+ @params.push(@maxResults = stringify('maxResults=', options[:maxResults]))
74
+ @params.push(@orgId = stringify('orgId=', options[:orgId]))
75
+ @params.push(@pageNum = stringify('pageNum=', options[:pageNum]))
76
+ @params.push(@q = stringify('q=', options[:q]))
77
+ @params.push(@skin = stringify('skin=', options[:skin]))
78
+ @params.push(@tflyTicketed = stringify('tflyTicketed=', options[:tflyTicketed]))
79
+ @params.push(@thruDate = stringify('thruDate=', options[:thruDate]))
80
+ @params.push(@venueId = stringify('venueId=', options[:venueId]))
81
+ @params.push(@geo = stringify('location=geo:', options[:geo]))
82
+ @params.push(@ip = stringify('location=ip:', options[:ip]))
83
+ @params.push(@clientip = stringify('location=clientip', options[:clientip]))
84
+ @params.push(@distance = stringify('distance=', options[:distance]))
85
+
86
+ end
87
+
88
+ def list
89
+ string = EVENTS_STRING + '/list.json?' + @params.join.to_s
90
+ request(string)
91
+ end
92
+
93
+ def upcoming
94
+ string = EVENTS_STRING + '/upcoming.json?' + @params.join.to_s
95
+ request(string)
96
+ end
97
+
98
+ def featured
99
+ string = EVENTS_STRING + '/featured.json?' + @params.join.to_s
100
+ request(string)
101
+ end
102
+
103
+ def just_announced
104
+ string = EVENTS_STRING + '/justAnnounced.json?' + @params.join.to_s
105
+ request(string)
106
+ end
107
+
108
+ def past
109
+ string = EVENTS_STRING + '/past.json?' + @params.join.to_s
110
+ request(string)
111
+ end
112
+
113
+ def on_sale
114
+ string = EVENTS_STRING + '/onsale.json?' + @params.join.to_s
115
+ request(string)
116
+ end
117
+ end
118
+
119
+ class Event < Requestors::Base
120
+ EVENT_STRING = '/events'
121
+ attr_accessor :eventId
122
+ attr_accessor :fieldGroup
123
+ attr_accessor :fields
124
+ attr_accessor :showRelatedEvents
125
+ attr_accessor :skin
126
+
127
+ def initialize(options = {})
128
+ super
129
+ @params.push(@eventId = stringify('eventId=', options[:eventId]))
130
+ @params.push(@fields = stringify('fields=', options[:fields]))
131
+ @params.push(@fieldsGroup = stringify('fieldsGroup=', options[:fieldsGroup]))
132
+ @params.push(@showRelatedEvents = stringify('showRelatedEvents=', options[:showRelatedEvents]))
133
+ @params.push(@skin = stringify('skin=', options[:skin]))
134
+ end
135
+
136
+ def event
137
+ string = EVENT_STRING + '/event.json?' + @params.join.to_s
138
+ end
139
+
140
+ end
141
+
142
+ class Venues < Requestors::Base
143
+ VENUES_STRING = '/venues'
144
+ attr_accessor :maxResults
145
+ attr_accessor :orgId
146
+ attr_accessor :pageNum
147
+ attr_accessor :venueId
148
+
149
+ def initialize(options={})
150
+ super
151
+ @params.push(@maxResults = stringify('maxResults=', options[:maxResults]))
152
+ @params.push(@orgId = stringify('orgId=', options[:orgId]))
153
+ @params.push(@pageNum = stringify('pageNum=', options[:pageNum]))
154
+ @params.push(@venueId = stringify('venueId=', options[:venueId]))
155
+ end
156
+
157
+ def list
158
+ string = VENUES_STRING + '/list.json?' + @params.join.to_s
159
+ request(string)
160
+ end
161
+ end
162
+
163
+ class Orgs < Requestors::Base
164
+ ORGS_STRING = '/orgs'
165
+ attr_accessor :maxResults
166
+ attr_accessor :orgId
167
+ attr_accessor :pageNum
168
+
169
+ def initialize(options={})
170
+ super
171
+ @params.push(@maxResults = stringify('maxResults=', options[:maxResults]))
172
+ @params.push(@orgId = stringify('orgId=', options[:orgId]))
173
+ @params.push(@pageNum = stringify('pageNum=', options[:pageNum]))
174
+ end
175
+
176
+ def list()
177
+ string = ORGS_STRING + '/list.json?' + @params.join.to_s
178
+ request(string)
179
+ end
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,91 @@
1
+ module TicketflyPlus
2
+ class Responses
3
+ require 'date'
4
+ require 'time'
5
+
6
+ class Base
7
+ attr_accessor :link
8
+ attr_accessor :maxResults
9
+ attr_accessor :pageNum
10
+ attr_accessor :status
11
+ attr_accessor :title
12
+ attr_accessor :totalPages
13
+ attr_accessor :totalResults
14
+
15
+ def initialize(response)
16
+ @link = response['link']
17
+ @maxResults = check_nil(response['maxResults']).to_i
18
+ @pageNum = check_nil(response['pageNum']).to_i
19
+ @status = response['status']
20
+ @title = response['title']
21
+ @totalPages = check_nil(response['totalPages']).to_i
22
+ @totalResults = check_nil(response['totalResults']).to_i
23
+ end
24
+
25
+ private
26
+
27
+ def check_nil(response)
28
+ response != nil ? response : nil
29
+ end
30
+ end
31
+
32
+ class Events < Responses::Base
33
+ attr_accessor :events
34
+ attr_accessor :org
35
+
36
+ def initialize(response)
37
+ super
38
+ @events = check_nil(response['events']) != nil ? get_events(response['events']) : response['events']
39
+ @org = response['org'] != nil ? TicketflyPlus::Objects::Org.new(response['org']) : response['org']
40
+ end
41
+
42
+ def get_events(events)
43
+ arr = Array.new
44
+ if events.length > 0
45
+ events.each do |event|
46
+ arr.push TicketflyPlus::Objects::Event.new(event)
47
+ end
48
+ end
49
+ arr
50
+ end
51
+ end
52
+
53
+ class Orgs < Responses::Base
54
+ attr_accessor :orgs
55
+
56
+ def initialize
57
+ super
58
+ @orgs = check_nil(response['orgs']) != nil ? get_orgs(response['orgs']) : response['orgs']
59
+ end
60
+
61
+ def get_orgs(orgs)
62
+ arr = Array.new
63
+ if orgs.length > 0
64
+ orgs.each do |org|
65
+ arr.push TicketflyPlus::Objects::Org.new(org)
66
+ end
67
+ end
68
+ arr
69
+ end
70
+ end
71
+
72
+ class Venues < Responses::Base
73
+ attr_accessor :venues
74
+
75
+ def initialize
76
+ super
77
+ @venues = check_nil(response['venues']) != nil ? get_venues(response['venues']) : response['venues']
78
+ end
79
+
80
+ def get_venues(venues)
81
+ arr = Array.new
82
+ if venues.length > 0
83
+ venues.each do |venue|
84
+ arr.push TicketflyPlus::Objects::Venue.new(venue)
85
+ end
86
+ end
87
+ arr
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,3 @@
1
+ module TicketflyPlus
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require 'ticketfly_plus/version'
2
+ require 'ticketfly_plus/requestors'
3
+ require 'ticketfly_plus/responses'
4
+ require 'ticketfly_plus/objects'
@@ -0,0 +1,2 @@
1
+ require 'pry'
2
+ require 'ticketfly_plus'
@@ -0,0 +1,6 @@
1
+ require 'spec_helper'
2
+
3
+ describe TicketflyPlus do
4
+ it 'does stuff' do
5
+ end
6
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ticketfly_plus/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ticketfly_plus"
8
+ spec.version = TicketflyPlus::VERSION
9
+ spec.authors = ["Joshua Nathaniel Miller"]
10
+ spec.email = ["jnmiller15@gmail.com"]
11
+ spec.summary = %q{"Api wrapper for ticketfly"}
12
+ spec.description = %q{"Get usable ticketfly data"}
13
+ spec.homepage = "http://github.com/joshuaNathaniel/ticketflyPlus"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "rspec-nc"
25
+ spec.add_development_dependency "guard"
26
+ spec.add_development_dependency "guard-rspec"
27
+ spec.add_development_dependency "pry"
28
+ spec.add_development_dependency "pry-remote"
29
+ spec.add_development_dependency "pry-nav"
30
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ticketfly_plus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Joshua Nathaniel Miller
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-nc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: guard
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'
83
+ - !ruby/object:Gem::Dependency
84
+ name: guard-rspec
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'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry-remote
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-nav
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: '"Get usable ticketfly data"'
140
+ email:
141
+ - jnmiller15@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - Gemfile
148
+ - Guardfile
149
+ - LICENSE.txt
150
+ - README.md
151
+ - Rakefile
152
+ - lib/ticketfly_plus.rb
153
+ - lib/ticketfly_plus/objects.rb
154
+ - lib/ticketfly_plus/requestors.rb
155
+ - lib/ticketfly_plus/responses.rb
156
+ - lib/ticketfly_plus/version.rb
157
+ - spec/spec_helper.rb
158
+ - spec/ticketfly_plus_spec.rb
159
+ - ticketfly_plus.gemspec
160
+ homepage: http://github.com/joshuaNathaniel/ticketflyPlus
161
+ licenses:
162
+ - MIT
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.2.2
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: '"Api wrapper for ticketfly"'
184
+ test_files:
185
+ - spec/spec_helper.rb
186
+ - spec/ticketfly_plus_spec.rb