flyticket 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ebe16a390b161010c474533890fd79070d7692fd
4
+ data.tar.gz: 6d89af551de944c107d317fc9d4a7260ad86bd19
5
+ SHA512:
6
+ metadata.gz: 8cdd8cfcf64dd1f10ecdb8ca7a45b2099cd41b31770cb2a1906468b816dca8acf21c9e7fccfd01b95677933ca511c8aafe0a2c4b453aec7421c996cf38c48af4
7
+ data.tar.gz: 6509c26e0e2f052cb60eb6cb7c2d8aed54de058d649b03932f077b1c3672964877d9ae017f6aeba9a22aa332235e7435b90f0f982d7b7798a9528aed9e6863f1
@@ -0,0 +1,37 @@
1
+ /fixtures/
2
+
3
+ *.gem
4
+ *.rbc
5
+ /.config
6
+ /coverage/
7
+ /InstalledFiles
8
+ /pkg/
9
+ /spec/reports/
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ ## Specific to RubyMotion:
15
+ .dat*
16
+ .repl_history
17
+ build/
18
+
19
+ ## Documentation cache and generated files:
20
+ /.yardoc/
21
+ /_yardoc/
22
+ /doc/
23
+ /rdoc/
24
+
25
+ ## Environment normalisation:
26
+ /.bundle/
27
+ /vendor/bundle
28
+ /lib/bundler/man/
29
+
30
+ # for a library or gem, you might want to ignore these files since the code is
31
+ # intended to run in multiple environments; otherwise, check them in:
32
+ Gemfile.lock
33
+ .ruby-version
34
+ .ruby-gemset
35
+
36
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
37
+ .rvmrc
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in flyticket.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 John Cipriano
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,68 @@
1
+ # Flyticket
2
+
3
+ A Ruby gem for communicating with the [Ticketfly REST API](http://start.ticketfly.com/api/), built
4
+ on [HTTParty](https://github.com/jnunemaker/httparty).
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'flyticket'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install flyticket
21
+
22
+ ## Example Usage
23
+
24
+ Flyticket is still a work in progress, however, to query for events,
25
+ use it like so:
26
+
27
+ ```
28
+ upcoming = Flyticket::Events.upcoming(venueId: 1, maxResults: 3)
29
+ upcoming.first.venue.name # --> 'Brooklyn Bowl'
30
+
31
+ past = Flyticket::Events.past(venueId: 1, maxResults: 3)
32
+ past.first.facebook_event_id # --> FB event id for this venue's last show
33
+ ```
34
+
35
+ #### Some useful properties:
36
+ * orgId
37
+ * venueId
38
+ * eventId
39
+ * maxResults (capped at 1000)
40
+ * pageNum (required when total results > maxResults)
41
+ * fromDate
42
+ * thruDate
43
+
44
+ ## Notes
45
+
46
+ I haven't committed to an API just yet and won't attempt semantic versioning
47
+ until I do.
48
+
49
+ #### TODO
50
+ * [ ] use snake case for options
51
+ * [ ] handle error response
52
+ * [ ] make original json available
53
+ * [ ] handle fields & fieldGroup
54
+ * [ ] specs
55
+
56
+ ## Development
57
+
58
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
59
+
60
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
61
+
62
+ ## Contributing
63
+
64
+ Bug reports and pull requests are welcome on GitHub at https://github.com/johncip/flyticket.
65
+
66
+ ## License
67
+
68
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "flyticket"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+
11
+ require "pry"
12
+ Pry.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'flyticket/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "flyticket"
8
+ spec.version = Flyticket::VERSION
9
+ spec.authors = ["John Cipriano"]
10
+ spec.email = ["johnmikecip@gmail.com"]
11
+
12
+ spec.summary = "Get Ruby objects from Ticketfly's JSON API"
13
+ spec.homepage = "https://github.com/johncip/flyticket"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
+ # delete this section to allow pushing this gem to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
+ end
23
+
24
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
+ spec.bindir = "exe"
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ["lib"]
28
+
29
+ spec.add_development_dependency "bundler", "~> 1.10"
30
+ spec.add_development_dependency "rake", "~> 10.0"
31
+
32
+ # avoid pissing off ticketfly
33
+ spec.add_development_dependency "vcr", "~> 3.0"
34
+ spec.add_development_dependency "webmock", "~> 1.22"
35
+
36
+ # racing stripes
37
+ spec.add_development_dependency "pry", "~> 0.10"
38
+ spec.add_development_dependency "pry-coolline", "~> 0.2"
39
+ spec.add_development_dependency "awesome_print", "~> 1.6"
40
+
41
+ spec.add_runtime_dependency "plissken", "~> 0.2"
42
+ spec.add_runtime_dependency "httparty", "~> 0.13"
43
+ end
@@ -0,0 +1,13 @@
1
+ require 'flyticket/version'
2
+ require 'flyticket/events'
3
+ require 'flyticket/venues'
4
+ require 'flyticket/orgs'
5
+
6
+ # Prevents returned JSON from being wrapped under a 'table' key.
7
+ require 'ostruct'
8
+
9
+ class OpenStruct
10
+ def as_json(options = nil)
11
+ @table.as_json(options)
12
+ end
13
+ end
@@ -0,0 +1,45 @@
1
+ # TODO: handle error response
2
+ # TODO: handle fields & fieldGroup
3
+ # TODO: make original response available
4
+ # TODO: specs
5
+
6
+ require 'httparty'
7
+ require 'ostruct'
8
+ require 'plissken'
9
+
10
+ module Flyticket
11
+ class Endpoint
12
+ include HTTParty
13
+
14
+ def self.key
15
+ base_uri.split('/').last
16
+ end
17
+
18
+ def self.get_many(fragment, query)
19
+ response = get fragment, query: query
20
+ response[key].map { |hash| objectify(hash) }
21
+ end
22
+
23
+ def self.get_one(fragment, query)
24
+ response = get fragment, query: query
25
+ objectify response[key].first
26
+ end
27
+
28
+ private
29
+
30
+ # Converts keys to snake case, then "semi-recursively" converts to OpenStruct.
31
+ def self.objectify(hash)
32
+ hash = hash.to_snake_keys
33
+
34
+ to_struct(hash, :venue)
35
+ to_struct(hash, :org)
36
+ OpenStruct.new(hash)
37
+ end
38
+
39
+ # Replaces a nested hash with a struct, given the parent hash and key.
40
+ def self.to_struct(hash, key)
41
+ return unless hash.has_key? key
42
+ hash[key] = OpenStruct.new(hash[key])
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,31 @@
1
+ require 'flyticket/endpoint'
2
+
3
+ module Flyticket
4
+ class Events < Endpoint
5
+ base_uri 'www.ticketfly.com/api/events'
6
+
7
+ def self.list(options)
8
+ get_many '/list.json', options
9
+ end
10
+
11
+ def self.upcoming(options)
12
+ get_many '/upcoming.json', options
13
+ end
14
+
15
+ def self.featured(options)
16
+ get_many '/featured.json', options
17
+ end
18
+
19
+ def self.past(options)
20
+ get_many '/past.json', options
21
+ end
22
+
23
+ def self.just_announced(options)
24
+ get_many '/justAnnounced.json', options
25
+ end
26
+
27
+ def self.event(options)
28
+ get_one '/event.json', options
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,11 @@
1
+ require 'flyticket/endpoint'
2
+
3
+ module Flyticket
4
+ class Orgs < Endpoint
5
+ base_uri 'www.ticketfly.com/api/orgs'
6
+
7
+ def self.list(options)
8
+ get_many '/list.json', options
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ require 'flyticket/endpoint'
2
+
3
+ module Flyticket
4
+ class Venues < Endpoint
5
+ base_uri 'www.ticketfly.com/api/venues'
6
+
7
+ def self.list(options)
8
+ get_many '/list.json', options
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module Flyticket
2
+ VERSION = "0.1.1"
3
+ end
metadata ADDED
@@ -0,0 +1,186 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flyticket
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - John Cipriano
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-02-07 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: vcr
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.22'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.22'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.10'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.10'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-coolline
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.2'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.2'
97
+ - !ruby/object:Gem::Dependency
98
+ name: awesome_print
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.6'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.6'
111
+ - !ruby/object:Gem::Dependency
112
+ name: plissken
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.2'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.2'
125
+ - !ruby/object:Gem::Dependency
126
+ name: httparty
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.13'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.13'
139
+ description:
140
+ email:
141
+ - johnmikecip@gmail.com
142
+ executables: []
143
+ extensions: []
144
+ extra_rdoc_files: []
145
+ files:
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
+ - Gemfile
149
+ - LICENSE.txt
150
+ - README.md
151
+ - Rakefile
152
+ - bin/console
153
+ - bin/setup
154
+ - flyticket.gemspec
155
+ - lib/flyticket.rb
156
+ - lib/flyticket/endpoint.rb
157
+ - lib/flyticket/events.rb
158
+ - lib/flyticket/orgs.rb
159
+ - lib/flyticket/venues.rb
160
+ - lib/flyticket/version.rb
161
+ homepage: https://github.com/johncip/flyticket
162
+ licenses:
163
+ - MIT
164
+ metadata:
165
+ allowed_push_host: https://rubygems.org
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ requirements: []
181
+ rubyforge_project:
182
+ rubygems_version: 2.4.5.1
183
+ signing_key:
184
+ specification_version: 4
185
+ summary: Get Ruby objects from Ticketfly's JSON API
186
+ test_files: []