trail-ruby 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+ gem 'httparty'
6
+ gem 'facets'
7
+ gem 'hashie'
8
+ gem 'actionpack', :require => "action_pack"
9
+ gem 'activesupport'
10
+
11
+ # Add dependencies to develop your gem here.
12
+ # Include everything needed to run rake, tests, features, etc.
13
+ group :development do
14
+ gem "cucumber", ">= 0"
15
+ gem "bundler", "~> 1.0.0"
16
+ gem "jeweler", "~> 1.6.4"
17
+ gem "rcov", ">= 0"
18
+ gem 'rainbow'
19
+ gem 'faker'
20
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Spencer Markowski
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ = trail-api
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to trail-api
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
9
+ * Fork the project
10
+ * Start a feature/bugfix branch
11
+ * Commit and push until you are happy with your contribution
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2011 Spencer Markowski. See LICENSE.txt for
18
+ further details.
19
+
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "trail-ruby"
18
+ gem.homepage = "https://github.com/bollsy/trail-ruby"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{API Wrapper for Trail}
21
+ gem.description = %Q{API Wrapper for Trail}
22
+ gem.email = "spencer@theablefew.com"
23
+ gem.authors = ["Spencer Markowski"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ require 'cucumber/rake/task'
44
+ Cucumber::Rake::Task.new(:features)
45
+
46
+ task :default => :test
47
+
48
+ require 'rdoc/task'
49
+ Rake::RDocTask.new do |rdoc|
50
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
51
+
52
+ rdoc.rdoc_dir = 'rdoc'
53
+ rdoc.title = "trail-api #{version}"
54
+ rdoc.rdoc_files.include('README*')
55
+ rdoc.rdoc_files.include('lib/**/*.rb')
56
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
@@ -0,0 +1,56 @@
1
+ $LOAD_PATH << './lib/'
2
+ require 'trail_api'
3
+ require 'rainbow'
4
+ require 'pp'
5
+ require 'faker'
6
+
7
+ def display( title , response )
8
+ puts "::#{title}::".color( :green )
9
+ pp response
10
+ puts ""
11
+ end
12
+
13
+ begin
14
+
15
+ TrailAPI::Base.auth( '4TyZ4VrF1U7bFi5f5pSh' )
16
+ @organization = TrailAPI::Organization.all.last
17
+ @fund = TrailAPI::Fund.all( @organization.id ).first
18
+ name = Faker::Name
19
+ address = Faker::Address
20
+
21
+ donor_deets = {
22
+ :first_name => name.first_name,
23
+ :last_name => name.last_name,
24
+ :street_address_1 => address.street_address,
25
+ :city => address.city,
26
+ :state => address.state,
27
+ :zip_code => address.zip_code
28
+ }
29
+
30
+ @donor = TrailAPI::Donor.create( @organization.id, :donor => donor_deets )
31
+
32
+ credit_card = {
33
+ :first_name => name.first_name,
34
+ :last_name => name.last_name,
35
+ :card_type => "visa",
36
+ :credit_card_number => "4111111111111111",
37
+ :exp_mnth => "05",
38
+ :exp_year => "2014",
39
+ :cvv => "123"
40
+ }
41
+
42
+ response = TrailAPI::Donor.purchase( @organization.id, @donor.guid, {:purchase => {
43
+ :fund_id => @fund.id,
44
+ :amount => 2.00,
45
+ :credit_card => credit_card
46
+ }
47
+ })
48
+
49
+ display "Response" , response
50
+
51
+ rescue => e
52
+ puts "#{e}".color :yellow
53
+ puts "#{e.backtrace}".color :red
54
+ end
55
+
56
+ #Donor.last.donation_recurrences.build( :fund_id => 1 , :recurrence_period_id => 6 , :recurrence_period_option_id => 4, :amount => 2.00)
@@ -0,0 +1,15 @@
1
+ require 'bundler'
2
+ begin
3
+ Bundler.setup(:default, :development)
4
+ rescue Bundler::BundlerError => e
5
+ $stderr.puts e.message
6
+ $stderr.puts "Run `bundle install` to install missing gems"
7
+ exit e.status_code
8
+ end
9
+
10
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
11
+ require 'trail-api'
12
+
13
+ require 'test/unit/assertions'
14
+
15
+ World(Test::Unit::Assertions)
@@ -0,0 +1,9 @@
1
+ Feature: something something
2
+ In order to something something
3
+ A user something something
4
+ something something something
5
+
6
+ Scenario: something something
7
+ Given inspiration
8
+ When I create a sweet new gem
9
+ Then everyone should see how awesome I am
@@ -0,0 +1,22 @@
1
+ TrailAPI.routes.draw do
2
+ namespace :api do
3
+ namespace :v1 do
4
+ resources :info, :only => :index
5
+ resources :donors, :only => [:index, :create, :show, :update] do
6
+ resources :transactions, :only => [:show, :index]
7
+ end
8
+
9
+ resources :organizations do
10
+ resources :funds #, :only => [:create, :index, :show, :update]
11
+ resources :transactions, :only => [:show, :index]
12
+ resources :donors do
13
+ post 'purchase' => "donors#purchase"
14
+ end
15
+ end
16
+ resources :funds, :only => [:index, :show, :update] do
17
+ resources :transactions, :only => [:show, :index]
18
+ end
19
+ resources :transactions, :only => [:show, :index]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,44 @@
1
+
2
+ require 'hashie'
3
+ require 'active_support/core_ext'
4
+
5
+ require 'action_dispatch'
6
+
7
+ module TrailAPI
8
+
9
+ autoload :ActionPack, "action_pack"
10
+ autoload :ActionDispatch, 'action_dispatch'
11
+ autoload :Base, "trail_api/base"
12
+ autoload :Donor, "trail_api/donor"
13
+ autoload :Organization, "trail_api/organization"
14
+ autoload :Fund, "trail_api/fund"
15
+
16
+ mattr_accessor :uri
17
+ @@uri = "localhost:3000"
18
+
19
+ @@routes_loaded = false
20
+
21
+ #mattr_accessor :routes
22
+ def self.routes
23
+ @@routes ||= ActionDispatch::Routing::RouteSet.new
24
+ end
25
+
26
+ def self.load_routes
27
+ @@routes_loaded = require 'config/routes' unless routes_loaded?
28
+ end
29
+
30
+ def self.routes_loaded?
31
+ @@routes_loaded
32
+ end
33
+
34
+ end
35
+
36
+ module Hashie
37
+ module HashExtensions
38
+ def hashie_stringify_keys!
39
+ inject({}) do |hash, (key, value)|
40
+ hash.merge(key.to_s => value.respond_to?(:stringify_keys) ? value.stringify_keys : value)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,50 @@
1
+ require 'httparty'
2
+ require 'action_dispatch'
3
+ require 'action_controller'
4
+ require 'hashie'
5
+ module TrailAPI
6
+ class Base
7
+ include HTTParty
8
+
9
+ headers 'Accept' => 'application/json', 'Content-Type' => 'application/json'
10
+ format :json
11
+
12
+ # default_params :output => 'json'
13
+
14
+ cattr_accessor :organization_id
15
+ extend ActionController::UrlFor
16
+ extend ActionDispatch::Routing::PolymorphicRoutes
17
+ maintain_method_across_redirects true
18
+ include TrailAPI.routes.url_helpers
19
+
20
+ def self.api_path_for( args = {} , options = {} )
21
+ TrailAPI.load_routes
22
+ # self.new.send :polymorphic_path, args
23
+ TrailAPI.routes.url_helpers
24
+ end
25
+
26
+ def self.auth( token )
27
+ basic_auth token, "X"
28
+ end
29
+
30
+ def initialize
31
+ #raise "You must provide an auth token" if self.class.default_options[:basic_auth].nil?
32
+ end
33
+
34
+ def self.url_options( options = {} )
35
+ { :host => "localhost", :port => 3000 }
36
+ end
37
+
38
+ def self.hashize( response )
39
+ if response.is_a?(Array)
40
+ response.parsed_response.collect do |result|
41
+ Hashie::Mash.new( result )
42
+ end
43
+ else
44
+ Hashie::Mash.new response
45
+ end
46
+ end
47
+
48
+
49
+ end
50
+ end
@@ -0,0 +1,47 @@
1
+ module TrailAPI
2
+ class Donor < TrailAPI::Base
3
+
4
+ base_uri "#{TrailAPI.uri}"
5
+
6
+
7
+ def self.all(organization_id )
8
+ hashize get( api_path_for.api_v1_organization_donors_path( organization_id ) )
9
+ end
10
+
11
+ def self.show( organization_id , donor_id )
12
+ hashize get( api_path_for.api_v1_organization_donor_path( organization_id , donor_id))
13
+ end
14
+
15
+ def self.update( organization_id, donor_id , new_params )
16
+ params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
17
+ # This is such a crazy mess -- httparty/rails really mangles the PUT process
18
+ # So we're building what HTTParty SHOULD be building. Because this works excellent.
19
+ #
20
+ hashize HTTParty::Request.new( Net::HTTP::Put,
21
+ "http://" + TrailAPI.uri + api_path_for.api_v1_organization_donor_path( organization_id , donor_id),
22
+ :body => ActiveSupport::JSON.encode(params),
23
+ :basic_auth => default_options[:basic_auth],
24
+ :headers => {'Accept' => 'application/json', 'Content-Type' => 'application/json'},
25
+ :format => :json).perform
26
+
27
+ end
28
+
29
+ def self.create( organization_id, new_params )
30
+ new_params[:donor].merge! :organization_id => organization_id
31
+ params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
32
+ hashize post( api_path_for.api_v1_organization_donors_path( organization_id), :body => ActiveSupport::JSON.encode(params) )
33
+ end
34
+
35
+ def self.destroy( organization_id, donor_id )
36
+ hashize delete( api_path_for.api_v1_organization_donor_path( organization_id , donor_id) )
37
+ end
38
+
39
+ def self.purchase( organization_id, donor_id, fund_info )
40
+ params = Hashie::Mash.new(fund_info).stringify_keys!.to_hash
41
+ hashize post( api_path_for.api_v1_organization_donor_purchase_path( organization_id, donor_id) , :body => ActiveSupport::JSON.encode( params ))
42
+ end
43
+
44
+ end
45
+ end
46
+
47
+ #curl -u 4TyZ4VrF1U7bFi5f5pSh:hi -X GET -H 'Accept: application/json' -H 'Content-Type: application/json' http://localhost:3000/api/v1/organizations/1/funds
@@ -0,0 +1,42 @@
1
+ module TrailAPI
2
+ class Fund < TrailAPI::Base
3
+
4
+ base_uri "#{TrailAPI.uri}"
5
+
6
+ cattr_accessor :organization_id, :fund_id
7
+
8
+ def self.all(organization_id)
9
+ hashize get( api_path_for.api_v1_organization_funds_path( organization_id ) )
10
+ end
11
+
12
+ def self.show( organization_id , fund_id )
13
+ # puts TrailAPI.routes.url_helpers.api_v1_organization_path(:id => organization_id )
14
+ hashize get( api_path_for.api_v1_organization_fund_path( organization_id , fund_id))
15
+ end
16
+
17
+ def self.update( organization_id, fund_id , new_params )
18
+ params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
19
+ # This is such a crazy mess -- httparty/rails really mangles the PUT process
20
+ # So we're building what HTTParty SHOULD be building. Because this works excellent.
21
+ #
22
+ hashize HTTParty::Request.new( Net::HTTP::Put,
23
+ "http://" + TrailAPI.uri + api_path_for.api_v1_organization_fund_path( organization_id , fund_id),
24
+ :body => ActiveSupport::JSON.encode(params),
25
+ :basic_auth => default_options[:basic_auth],
26
+ :headers => {'Accept' => 'application/json', 'Content-Type' => 'application/json'},
27
+ :format => :json).perform
28
+
29
+ end
30
+
31
+ def self.create( organization_id, new_params )
32
+ new_params[:fund].merge! :organization_id => organization_id
33
+ params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
34
+ hashize post( api_path_for.api_v1_organization_funds_path( organization_id), :body => ActiveSupport::JSON.encode(params) )
35
+ end
36
+
37
+ def self.destroy( organization_id, fund_id )
38
+ hashize delete( api_path_for.api_v1_organization_fund_path( organization_id , fund_id) )
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,42 @@
1
+ module TrailAPI
2
+ class Organization < TrailAPI::Base
3
+ #include TrailAPI.routes.url_helpers
4
+
5
+ base_uri "#{TrailAPI.uri}"
6
+
7
+ cattr_accessor :organization_id, :fund_id
8
+
9
+ def self.all
10
+ hashize get( api_path_for.api_v1_organizations_path )
11
+ end
12
+
13
+ def self.show( organization_id )
14
+ # puts TrailAPI.routes.url_helpers.api_v1_organization_path(:id => organization_id )
15
+ hashize get( api_path_for.api_v1_organization_path organization_id )
16
+ end
17
+
18
+ def self.update( organization_id, new_params )
19
+ params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
20
+ # This is such a crazy mess -- httparty/rails really mangles the PUT process
21
+ # So we're building what HTTParty SHOULD be building. Because this works excellent.
22
+ #
23
+ hashize HTTParty::Request.new( Net::HTTP::Put,
24
+ "http://" + TrailAPI.uri + api_path_for.api_v1_organization_path(organization_id ),
25
+ :body => ActiveSupport::JSON.encode(params),
26
+ :basic_auth => default_options[:basic_auth],
27
+ :headers => {'Accept' => 'application/json', 'Content-Type' => 'application/json'},
28
+ :format => :json).perform
29
+
30
+ end
31
+
32
+ def self.create( new_params )
33
+ params = Hashie::Mash.new(new_params).stringify_keys!.to_hash
34
+ hashize post( api_path_for.api_v1_organizations_path , :body => ActiveSupport::JSON.encode(params) )
35
+ end
36
+
37
+ def self.destroy( organization_id )
38
+ hashize delete( api_path_for.api_v1_organization_path organization_id )
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,183 @@
1
+ $LOAD_PATH << './lib/'
2
+ require 'trail_api'
3
+ require 'rainbow'
4
+ require 'pp'
5
+
6
+ def display( title , response )
7
+ puts "::#{title}::".color( :green )
8
+ pp response
9
+ puts ""
10
+ end
11
+
12
+ begin
13
+
14
+ TrailAPI::Base.auth( '4TyZ4VrF1U7bFi5f5pSh' )
15
+
16
+ # Organizations
17
+ puts "Organizations".color :cyan
18
+
19
+ begin
20
+ @organizations = TrailAPI::Organization.all
21
+ display "Organizations", @organizations
22
+ rescue => e
23
+ puts "Organizations List --> #{e}".color :red
24
+ end
25
+
26
+ begin
27
+ display "Show Organization", TrailAPI::Organization.show( @organizations.first.id )
28
+ rescue => e
29
+ puts "Show an Organization --> #{e}".color :red
30
+ end
31
+
32
+ begin
33
+ @organization = TrailAPI::Organization.create( :organization => {:name => "banger"} )
34
+ display "New Organization", @organization
35
+ rescue => e
36
+ puts "Create an Organization --> #{e}".color :red
37
+ end
38
+
39
+ begin
40
+ TrailAPI::Organization.update( @organization.id , :organization => {:id => @organization.id, :name => "Zeenor"} )
41
+ @new_organization = TrailAPI::Organization.show( @organization.id )
42
+ display "Update Organization", @new_organization
43
+ rescue => e
44
+ puts "Update an Organization --> #{e}".color :red
45
+ end
46
+
47
+ begin
48
+ display "Organization Deleted", TrailAPI::Organization.destroy( @organization.id )
49
+ rescue => e
50
+ puts "Delete an Organization --> #{e}".color :red
51
+ end
52
+
53
+ # Funds
54
+ puts "Funds".color :cyan
55
+
56
+ begin
57
+ display "Funds#index", @funds = TrailAPI::Fund.all( @organizations.first.id )
58
+ rescue => e
59
+ puts "Funds#index --> #{e}".color :red
60
+ end
61
+
62
+ begin
63
+ display "Funds#show", TrailAPI::Fund.show( @organizations.first.id, @funds.first.id )
64
+ rescue => e
65
+ puts "Funds#show --> #{e}".color :red
66
+ end
67
+
68
+ begin
69
+ display "Funds#create" , @fund = TrailAPI::Fund.create( @organizations.first.id, :fund => {:name => "Brand New Initiative"} )
70
+ rescue => e
71
+ puts "Funds#create --> #{e}".color :red
72
+ end
73
+
74
+ begin
75
+ TrailAPI::Fund.update( @organizations.first.id, @funds.first.id, :fund => {:organization_id => @organizations.first.id, :id => @funds.first.id, :name => "Zeenor"})
76
+ @updated_fund = TrailAPI::Fund.show( @organizations.first.id, @funds.first.id )
77
+ display "Funds#update", @updated_fund
78
+ rescue => e
79
+ puts "Funds#update --> #{e}".color :red
80
+ end
81
+
82
+
83
+ begin
84
+ display "Funds#delete", TrailAPI::Fund.destroy( @organizations.first.id , @fund.id)
85
+ rescue => e
86
+ puts "Funds#delete --> #{e}".color :red
87
+ end
88
+
89
+
90
+ # Donors
91
+ puts "Donors".color :cyan
92
+
93
+ begin
94
+ display "donors#index", @donors = TrailAPI::Donor.all( @organizations.first.id )
95
+ rescue => e
96
+ puts "donors#index --> #{e}".color :red
97
+ end
98
+
99
+ begin
100
+ display "donors#show", TrailAPI::Donor.show( @organizations.first.id, @donors.first.guid )
101
+ rescue => e
102
+ puts "donors#show --> #{e}".color :red
103
+ end
104
+
105
+ begin
106
+ display "donors#create" , @donor = TrailAPI::Donor.create(
107
+ @organizations.first.id, :donor => {
108
+ :first_name => "Ron",
109
+ :last_name => "Paul",
110
+ :street_address_1 => "White House",
111
+ :city => "Greenville",
112
+ :state => "SC",
113
+ :zip_code => "12345"} )
114
+ puts "Received GUID for new donor!: #{@donor.guid}".color :magenta
115
+ rescue => e
116
+ puts "donors#create --> #{e}".color :red
117
+ end
118
+
119
+ begin
120
+ TrailAPI::Donor.update( @organizations.first.id, @donors.first.guid, :donor => {
121
+ :organization_id => @organizations.first.id,
122
+ :id => @donors.first.guid,
123
+ :first_name => "Jadzia",
124
+ :last_name => "Dax",
125
+ :street_address_1 => "10215 Pamona Gorge",
126
+ :city => "Heaven",
127
+ :state => "HL"})
128
+ @updated_donor = TrailAPI::Donor.show( @organizations.first.id, @donors.first.guid )
129
+ display "donors#update", @updated_donor
130
+ rescue => e
131
+ puts "donors#update --> #{e}".color :red
132
+ end
133
+
134
+
135
+ puts "Donor Purchase".color :green
136
+ begin
137
+
138
+ @organization = TrailAPI::Organization.all.last
139
+ @fund = TrailAPI::Fund.all( @organization.id ).first
140
+
141
+ donor_deets = {
142
+ :first_name => "John",
143
+ :last_name => "Doe",
144
+ :street_address_1 => "115 Pamona Court",
145
+ :city => "Fishers",
146
+ :state => "IN",
147
+ :zip_code => "46038"
148
+ }
149
+
150
+ @donor = TrailAPI::Donor.create( @organization.id, :donor => donor_deets )
151
+
152
+ credit_card = {
153
+ :first_name => "John",
154
+ :last_name => "Doe",
155
+ :card_type => "visa",
156
+ :credit_card_number => "4111111111111111",
157
+ :exp_mnth => "05",
158
+ :exp_year => "2014",
159
+ :cvv => "123"
160
+ }
161
+
162
+ response = TrailAPI::Donor.purchase(
163
+ @organization.id, @donor.guid, {
164
+ :purchase => { :fund_id => @fund.id, :amount => 2000, :credit_card => credit_card }
165
+ })
166
+
167
+ display "Response" , response
168
+
169
+ rescue => e
170
+ puts "donors#purchase --> #{e}".color :red
171
+ puts "#{e.backtrace}".color :red
172
+ end
173
+
174
+
175
+ begin
176
+ display "donors#delete", TrailAPI::Donor.destroy( @organizations.first.id , @donor.guid)
177
+ rescue => e
178
+ puts "donors#delete --> #{e}".color :red
179
+ end
180
+
181
+ rescue => e
182
+ puts "#{e}".color :red
183
+ end
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+
12
+ # $LOAD_PATH.unshift(File.dirname(__FILE__))
13
+ # $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH << './lib/'
15
+ require 'trail_api'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestTrailApi < Test::Unit::TestCase
4
+ def test_something_for_real
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,89 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "trail-ruby"
8
+ s.version = "0.0.2"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Spencer Markowski"]
12
+ s.date = "2011-11-11"
13
+ s.description = "API Wrapper for Trail"
14
+ s.email = "spencer@theablefew.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "LICENSE.txt",
23
+ "README.rdoc",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "card-store-test.rb",
27
+ "features/step_definitions/trail-api_steps.rb",
28
+ "features/support/env.rb",
29
+ "features/trail-api.feature",
30
+ "lib/config/routes.rb",
31
+ "lib/trail_api.rb",
32
+ "lib/trail_api/base.rb",
33
+ "lib/trail_api/donor.rb",
34
+ "lib/trail_api/fund.rb",
35
+ "lib/trail_api/organization.rb",
36
+ "quick-test.rb",
37
+ "test/helper.rb",
38
+ "test/test_trail-api.rb",
39
+ "trail-ruby.gemspec"
40
+ ]
41
+ s.homepage = "https://github.com/bollsy/trail-ruby"
42
+ s.licenses = ["MIT"]
43
+ s.require_paths = ["lib"]
44
+ s.rubygems_version = "1.8.10"
45
+ s.summary = "API Wrapper for Trail"
46
+
47
+ if s.respond_to? :specification_version then
48
+ s.specification_version = 3
49
+
50
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
52
+ s.add_runtime_dependency(%q<facets>, [">= 0"])
53
+ s.add_runtime_dependency(%q<hashie>, [">= 0"])
54
+ s.add_runtime_dependency(%q<actionpack>, [">= 0"])
55
+ s.add_runtime_dependency(%q<activesupport>, [">= 0"])
56
+ s.add_development_dependency(%q<cucumber>, [">= 0"])
57
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
59
+ s.add_development_dependency(%q<rcov>, [">= 0"])
60
+ s.add_development_dependency(%q<rainbow>, [">= 0"])
61
+ s.add_development_dependency(%q<faker>, [">= 0"])
62
+ else
63
+ s.add_dependency(%q<httparty>, [">= 0"])
64
+ s.add_dependency(%q<facets>, [">= 0"])
65
+ s.add_dependency(%q<hashie>, [">= 0"])
66
+ s.add_dependency(%q<actionpack>, [">= 0"])
67
+ s.add_dependency(%q<activesupport>, [">= 0"])
68
+ s.add_dependency(%q<cucumber>, [">= 0"])
69
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
70
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
71
+ s.add_dependency(%q<rcov>, [">= 0"])
72
+ s.add_dependency(%q<rainbow>, [">= 0"])
73
+ s.add_dependency(%q<faker>, [">= 0"])
74
+ end
75
+ else
76
+ s.add_dependency(%q<httparty>, [">= 0"])
77
+ s.add_dependency(%q<facets>, [">= 0"])
78
+ s.add_dependency(%q<hashie>, [">= 0"])
79
+ s.add_dependency(%q<actionpack>, [">= 0"])
80
+ s.add_dependency(%q<activesupport>, [">= 0"])
81
+ s.add_dependency(%q<cucumber>, [">= 0"])
82
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
83
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
84
+ s.add_dependency(%q<rcov>, [">= 0"])
85
+ s.add_dependency(%q<rainbow>, [">= 0"])
86
+ s.add_dependency(%q<faker>, [">= 0"])
87
+ end
88
+ end
89
+
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trail-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Spencer Markowski
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-11-11 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: &70330376623660 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70330376623660
25
+ - !ruby/object:Gem::Dependency
26
+ name: facets
27
+ requirement: &70330376617060 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70330376617060
36
+ - !ruby/object:Gem::Dependency
37
+ name: hashie
38
+ requirement: &70330376616520 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *70330376616520
47
+ - !ruby/object:Gem::Dependency
48
+ name: actionpack
49
+ requirement: &70330376615720 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70330376615720
58
+ - !ruby/object:Gem::Dependency
59
+ name: activesupport
60
+ requirement: &70330376614560 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: *70330376614560
69
+ - !ruby/object:Gem::Dependency
70
+ name: cucumber
71
+ requirement: &70330376612720 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70330376612720
80
+ - !ruby/object:Gem::Dependency
81
+ name: bundler
82
+ requirement: &70330376611700 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: 1.0.0
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70330376611700
91
+ - !ruby/object:Gem::Dependency
92
+ name: jeweler
93
+ requirement: &70330376610060 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ~>
97
+ - !ruby/object:Gem::Version
98
+ version: 1.6.4
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70330376610060
102
+ - !ruby/object:Gem::Dependency
103
+ name: rcov
104
+ requirement: &70330376604820 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70330376604820
113
+ - !ruby/object:Gem::Dependency
114
+ name: rainbow
115
+ requirement: &70330376603520 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *70330376603520
124
+ - !ruby/object:Gem::Dependency
125
+ name: faker
126
+ requirement: &70330376602480 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: *70330376602480
135
+ description: API Wrapper for Trail
136
+ email: spencer@theablefew.com
137
+ executables: []
138
+ extensions: []
139
+ extra_rdoc_files:
140
+ - LICENSE.txt
141
+ - README.rdoc
142
+ files:
143
+ - .document
144
+ - Gemfile
145
+ - LICENSE.txt
146
+ - README.rdoc
147
+ - Rakefile
148
+ - VERSION
149
+ - card-store-test.rb
150
+ - features/step_definitions/trail-api_steps.rb
151
+ - features/support/env.rb
152
+ - features/trail-api.feature
153
+ - lib/config/routes.rb
154
+ - lib/trail_api.rb
155
+ - lib/trail_api/base.rb
156
+ - lib/trail_api/donor.rb
157
+ - lib/trail_api/fund.rb
158
+ - lib/trail_api/organization.rb
159
+ - quick-test.rb
160
+ - test/helper.rb
161
+ - test/test_trail-api.rb
162
+ - trail-ruby.gemspec
163
+ homepage: https://github.com/bollsy/trail-ruby
164
+ licenses:
165
+ - MIT
166
+ post_install_message:
167
+ rdoc_options: []
168
+ require_paths:
169
+ - lib
170
+ required_ruby_version: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ! '>='
174
+ - !ruby/object:Gem::Version
175
+ version: '0'
176
+ segments:
177
+ - 0
178
+ hash: -3202236023349543485
179
+ required_rubygems_version: !ruby/object:Gem::Requirement
180
+ none: false
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubyforge_project:
187
+ rubygems_version: 1.8.10
188
+ signing_key:
189
+ specification_version: 3
190
+ summary: API Wrapper for Trail
191
+ test_files: []