Permalink
Browse files

added in stuff for testing, and started on grabbing events

  • Loading branch information...
1 parent e1bfd68 commit 3dee69999e9d22534acd42e0a22c947c5060577e @jwoertink jwoertink committed Nov 20, 2012
Showing with 163 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +21 −0 .pryrc
  3. +1 −0 .rspec
  4. +3 −0 .yardopts
  5. +16 −0 Guardfile
  6. +2 −2 README.md
  7. +29 −1 Rakefile
  8. +16 −1 lib/ticketsnow.rb
  9. +15 −0 lib/ticketsnow/base.rb
  10. +22 −0 lib/ticketsnow/connection.rb
  11. +14 −0 lib/ticketsnow/event.rb
  12. +5 −0 lib/ticketsnow/exceptions.rb
  13. +18 −0 ticketsnow-ruby.gemspec
View
@@ -4,6 +4,7 @@
.config
.yardoc
.DS_Store
+.rvmrc
Gemfile.lock
InstalledFiles
_yardoc
View
21 .pryrc
@@ -0,0 +1,21 @@
+#!/usr/bin/env ruby
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+
+require 'pathname'
+$LOAD_PATH.unshift(Pathname.getwd.join('lib').to_s)
+require 'ticketsnow-ruby'
+
+def reload!
+ Dir["#{Dir.pwd}/lib/**/*.rb"].each { |f| load f }
+end
View
1 .rspec
@@ -0,0 +1 @@
+--color --format nested
View
@@ -0,0 +1,3 @@
+--title 'ticketsnow-ruby Documentation'
+--charset utf-8
+--markup markdown
View
@@ -0,0 +1,16 @@
+guard 'bundler' do
+ watch('Gemfile')
+ watch('ticketsnow-ruby.gemspec')
+end
+
+guard 'rspec' do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
+
+guard 'yard' do
+ watch(%r{app/.+\.rb})
+ watch(%r{lib/.+\.rb})
+ watch(%r{ext/.+\.c})
+end
View
@@ -1,6 +1,6 @@
-# Ticketsnow::Ruby
+# Ticketsnow-ruby
-TODO: Write a gem description
+gem to interface with the TicketsNow.com SOAP API
## Installation
View
@@ -1,2 +1,30 @@
#!/usr/bin/env rake
-require "bundler/gem_tasks"
+require 'rubygems'
+require 'bundler'
+begin
+ Bundler.setup(:default, :development)
+rescue Bundler::BundlerError => e
+ $stderr.puts e.message
+ $stderr.puts "Run `bundle install` to install missing gems"
+ exit e.status_code
+end
+require 'rake'
+require 'bundler/gem_tasks'
+
+require 'rspec/core'
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec) do |spec|
+ spec.pattern = FileList['spec/**/*_spec.rb']
+end
+
+task :default => :spec
+
+require 'yard'
+YARD::Rake::YardocTask.new
+
+desc 'Start Pry with all runtime dependencies loaded'
+task :console, :script do |t, args|
+ command = 'bundle exec pry'
+ command += "-r #{args[:script]}" if args[:script]
+ sh command
+end
View
@@ -1,5 +1,20 @@
require 'ticketsnow/version'
+require 'ticketsnow/exceptions'
+require 'ticketsnow/base'
+require 'ticketsnow/connection'
-module Ticketnow
+module Ticketsnow
+
+ class << self
+ attr_accessor :test_mode, :api_key
+
+ def configure
+ yield self
+ self.test_mode ||= false
+ Base.token = api_key
+ Base.endpoint = "http://services.#{ test_mode ? 'preview.' : '' }eventinventory.com/webservices/ticketsearch.asmx?wsdl"
+ end
+
+ end
end
View
@@ -0,0 +1,15 @@
+require 'savon'
+
+module Ticketsnow
+ class Base
+ @@current_connection = nil
+
+ DEFAULT_OPTIONS = {:body => {"APPCLIENT_ID" => token}}
+
+ class << self
+ attr_accessor :token, :endpoint
+ end
+
+
+ end
+end
@@ -0,0 +1,22 @@
+module Ticketsnow
+
+ class Connection < Ticketsnow::Base
+
+ def self.ensure_connection!
+ new unless @@current_connection
+ end
+
+ def initialize
+ raise ConnectionError, "You must Configure Ticketsnow first." if Base.endpoint.nil?
+ @url = Base.endpoint
+ @client = Savon.client(@url)
+ @@current_connection = @client if @client.wsdl.document?
+ end
+
+ def client
+ @client
+ end
+
+ end
+
+end
View
@@ -0,0 +1,14 @@
+module Ticketsnow
+ class Event < Ticketsnow::Connection
+
+ class << self
+
+ def all
+ ensure_connection!
+ @@current_connection.client.request(:wsdl, :get_event_list, DEFAULT_OPTIONS)
+ end
+
+ end
+
+ end
+end
@@ -0,0 +1,5 @@
+module Ticketsnow
+
+ class ConnectionError < StandardError; end
+
+end
View
@@ -16,7 +16,25 @@ Gem::Specification.new do |gem|
gem.version = Ticketsnow::VERSION
gem.add_dependency 'savon', '1.2.0'
+ # Basic
+ gem.add_development_dependency 'rake'
+ gem.add_development_dependency 'bundler'
+ gem.add_development_dependency 'yard'
+ gem.add_development_dependency 'redcarpet'
+
+ # Testing
gem.add_development_dependency 'rspec'
+ gem.add_development_dependency 'simplecov'
gem.add_development_dependency 'vcr'
gem.add_development_dependency 'webmock'
+
+ # Development tools & helpers
+ gem.add_development_dependency 'pry'
+ gem.add_development_dependency 'guard'
+ gem.add_development_dependency 'guard-bundler'
+ gem.add_development_dependency 'guard-rspec'
+ gem.add_development_dependency 'guard-yard'
+ gem.add_development_dependency 'rb-fsevent'
+ gem.add_development_dependency 'rb-inotify'
+ gem.add_development_dependency 'growl'
end

0 comments on commit 3dee699

Please sign in to comment.