Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added in stuff for testing, and started on grabbing events

commit 3dee69999e9d22534acd42e0a22c947c5060577e 1 parent e1bfd68
@jwoertink jwoertink authored
View
1  .gitignore
@@ -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
3  .yardopts
@@ -0,0 +1,3 @@
+--title 'ticketsnow-ruby Documentation'
+--charset utf-8
+--markup markdown
View
16 Guardfile
@@ -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
4 README.md
@@ -1,6 +1,6 @@
-# Ticketsnow::Ruby
+# Ticketsnow-ruby
-TODO: Write a gem description
+gem to interface with the TicketsNow.com SOAP API
## Installation
View
30 Rakefile
@@ -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
17 lib/ticketsnow.rb
@@ -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
15 lib/ticketsnow/base.rb
@@ -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
View
22 lib/ticketsnow/connection.rb
@@ -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
14 lib/ticketsnow/event.rb
@@ -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
View
5 lib/ticketsnow/exceptions.rb
@@ -0,0 +1,5 @@
+module Ticketsnow
+
+ class ConnectionError < StandardError; end
+
+end
View
18 ticketsnow-ruby.gemspec
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.