brownpapertickets 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+
21
+ ## PROJECT::SPECIFIC
File without changes
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in browpapertickets.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,32 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ brownpapertickets (0.0.2)
5
+ hpricot (>= 0.8.3)
6
+ httparty (>= 0.6.1)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ crack (0.1.8)
12
+ diff-lcs (1.1.2)
13
+ fakeweb (1.2.8)
14
+ hpricot (0.8.3)
15
+ httparty (0.7.4)
16
+ crack (= 0.1.8)
17
+ rspec (2.5.0)
18
+ rspec-core (~> 2.5.0)
19
+ rspec-expectations (~> 2.5.0)
20
+ rspec-mocks (~> 2.5.0)
21
+ rspec-core (2.5.1)
22
+ rspec-expectations (2.5.0)
23
+ diff-lcs (~> 1.1.2)
24
+ rspec-mocks (2.5.0)
25
+
26
+ PLATFORMS
27
+ ruby
28
+
29
+ DEPENDENCIES
30
+ brownpapertickets!
31
+ fakeweb (~> 1.2.0)
32
+ rspec (>= 2.0.0)
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Alvaro Insignares
1
+ Copyright (c) 2010-2011 Alvaro Insignares
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.textile ADDED
@@ -0,0 +1,22 @@
1
+ h1. Brownpapertickets Gem
2
+
3
+ Brownpapertickests gem, is a wrapper for Brownpapertickests's service. The purpose of this is gem is provide an "ActiveRecord-like" wrapper for create events.
4
+
5
+
6
+ h2. Installing
7
+
8
+ bc. $ [sudo] gem install brownpapertickets
9
+
10
+
11
+ h2. Examples
12
+
13
+ h3. Create an Event
14
+
15
+ bc. @bpt = BrownPaperTickets::Base.new("brownpaper_id","brownpaper_account")
16
+ event = @bpt.events.new({:e_zip => "90210", :e_name => "super awesome event", :e_city => "Beverly Hills", :e_state => "CA", :e_short_description => "Super Awesome Event!!!", :e_description => "Woodstock was initiated through the efforts of Michael Lang, John Roberts, Joel Rosenman, and Artie Kornfeld. It was Roberts and Rosenman who had the finances."})
17
+ event.save!
18
+
19
+
20
+ h2. Copyright
21
+
22
+ Copyright (c) 2010-2011 Alvaro Insignares. See LICENSE for details.
data/Rakefile CHANGED
@@ -1,47 +1,25 @@
1
1
  require 'rubygems'
2
- require 'rake'
2
+ require 'bundler'
3
3
 
4
- begin
5
- require 'jeweler'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "brownpapertickets"
8
- gem.summary = "Brown Paper tickets API wrapper"
9
- gem.description = "Brown Paper tickets API wrapper"
10
- gem.email = ["alvaro@koombea.com", "niyireth.delahoz@koombea.com"]
11
- gem.homepage = "http://github.com/niyireth/brownpapertickets"
12
- gem.authors = ["Alvaro Insignares", "Niyireth De La Hoz"]
13
- gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_development_dependency "fakeweb", "~> 1.2.0"
15
- gem.add_dependency "httparty", ">=0.6.1"
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- end
18
- Jeweler::GemcutterTasks.new
19
- rescue LoadError
20
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
- end
4
+ $:.push File.expand_path("../lib", __FILE__)
5
+ require "brownpapertickets/version"
22
6
 
23
- require 'spec/rake/spectask'
24
- Spec::Rake::SpecTask.new(:spec) do |spec|
25
- spec.libs << 'lib' << 'spec'
26
- spec.spec_files = FileList['spec/**/*_spec.rb']
27
- end
7
+ Bundler::GemHelper.install_tasks
28
8
 
29
- Spec::Rake::SpecTask.new(:rcov) do |spec|
30
- spec.libs << 'lib' << 'spec'
31
- spec.pattern = 'spec/**/*_spec.rb'
32
- spec.rcov = true
9
+ require 'rspec/core'
10
+ require 'rspec/core/rake_task'
11
+ RSpec::Core::RakeTask.new(:spec) do |spec|
12
+ spec.pattern = FileList['spec/**/*_spec.rb']
33
13
  end
34
14
 
35
- task :spec => :check_dependencies
36
-
37
15
  task :default => :spec
38
16
 
39
17
  require 'rake/rdoctask'
40
18
  Rake::RDocTask.new do |rdoc|
41
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
19
+ version = BrownPaperTickets::VERSION
42
20
 
43
21
  rdoc.rdoc_dir = 'rdoc'
44
- rdoc.title = "brownpapertickets #{version}"
22
+ rdoc.title = "brownpaperticket #{version}"
45
23
  rdoc.rdoc_files.include('README*')
46
24
  rdoc.rdoc_files.include('lib/**/*.rb')
47
25
  end
@@ -1,79 +1,26 @@
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 -*-
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "brownpapertickets/version"
5
3
 
6
4
  Gem::Specification.new do |s|
7
- s.name = %q{brownpapertickets}
8
- s.version = "0.0.0"
5
+ s.name = "brownpapertickets"
6
+ s.version = BrownPaperTickets::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Alvaro Insignares", "Niyireth De La Hoz", "Guillermo Iguaran"]
9
+ s.email = ["alvaro@koombea.com", "niyireth.delahoz@koombea.com", "guilleiguaran@gmail.com"]
10
+ s.homepage = "http://github.com/niyireth/brownpapertickets"
11
+ s.summary = %q{Brown Paper Tickets API wrapper}
12
+ s.description = %q{Brown Paper Tickets API wrapper}
9
13
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Alvaro Insignares"]
12
- s.date = %q{2011-02-16}
13
- s.description = %q{Brown Paper tickets API wrapper}
14
- s.email = %q{alvaro@koombea.com}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README",
18
- "README.rdoc"
19
- ]
20
- s.files = [
21
- "README",
22
- "README.rdoc",
23
- "Rakefile",
24
- "VERSION",
25
- "brownpapertickets/.document",
26
- "brownpapertickets/.gitignore",
27
- "examples/create_item.rb",
28
- "examples/fetch_items.rb",
29
- "examples/update_item.rb",
30
- "lib/brownpapertickets.rb",
31
- "lib/brownpapertickets/base.rb",
32
- "lib/brownpapertickets/date.rb",
33
- "lib/brownpapertickets/price.rb",
34
- "lib/brownpapertickets/event.rb",
35
- "lib/brownpapertickets/httpost.rb",
36
- "lib/brownpapertickets/xmlparse.rb",
37
- "spec/brownpapertickets_spec.rb",
38
- "spec/fixtures/all_events.xml",
39
- "spec/fixtures/create_not_ok.xml",
40
- "spec/fixtures/create_ok.xml",
41
- "spec/fixtures/event.xml",
42
- "spec/fixtures/test.json",
43
- "spec/fixtures/update_not_ok.xml",
44
- "spec/fixtures/update_ok.xml",
45
- "spec/spec.opts",
46
- "spec/spec_helper.rb"
47
- ]
48
- s.homepage = %q{http://github.com/bbto/brownpapertickets}
14
+ s.rubyforge_project = "brownpapertickets"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
49
19
  s.require_paths = ["lib"]
50
- s.rubygems_version = %q{1.3.7}
51
- s.summary = %q{Brown Paper tickets API wrapper}
52
- s.test_files = [
53
- "examples/create_item.rb",
54
- "examples/fetch_items.rb",
55
- "examples/update_item.rb",
56
- "spec/brownpapertickets_spec.rb",
57
- "spec/spec_helper.rb"
58
- ]
59
20
 
60
- if s.respond_to? :specification_version then
61
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
62
- s.specification_version = 3
21
+ s.add_development_dependency(%q<rspec>, [">= 2.0.0"])
22
+ s.add_development_dependency(%q<fakeweb>, ["~> 1.2.0"])
23
+ s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
24
+ s.add_runtime_dependency(%q<hpricot>, [">= 0.8.3"])
63
25
 
64
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
65
- s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
66
- s.add_development_dependency(%q<fakeweb>, ["~> 1.2.0"])
67
- s.add_runtime_dependency(%q<httparty>, [">= 0.6.1"])
68
- else
69
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
70
- s.add_dependency(%q<fakeweb>, ["~> 1.2.0"])
71
- s.add_dependency(%q<httparty>, [">= 0.6.1"])
72
- end
73
- else
74
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
75
- s.add_dependency(%q<fakeweb>, ["~> 1.2.0"])
76
- s.add_dependency(%q<httparty>, [">= 0.6.1"])
77
- end
78
26
  end
79
-
@@ -1,7 +1,17 @@
1
+ # This is a API wrapper for brownpapersticker service.
2
+ # The purpose of this is gem is to behave like ActiveRecord
3
+ # in the creation of an event.
4
+ #
5
+ # Author:: Alvaro Insignares (mailto:alvaro@koombea.com) Niyireth De La Hoz (mailto:niyireth.delahoz@koombea.com)
6
+ # Copyright:: Copyright (c) 2010 Koombea, Ltda
7
+ # License:: Distributes under the same terms as Ruby
8
+
1
9
  module BrownPaperTickets
2
10
  class Base
3
11
  attr_reader :id, :account, :event, :date, :price
4
12
 
13
+ # Needs the brownpapersticker's credentials (id and account),
14
+ # creates a new instance of event, date and price
5
15
  def initialize(id, account)
6
16
  @id = id
7
17
  @account = account
@@ -12,12 +22,15 @@ module BrownPaperTickets
12
22
  @price = BrownPaperTickets::Price.new(self.id, self.account)
13
23
  end
14
24
 
25
+ # Returns the event
15
26
  def events
16
27
  @event
17
28
  end
29
+ # Return the date
18
30
  def dates
19
31
  @date
20
32
  end
33
+ # Return the price
21
34
  def prices
22
35
  @price
23
36
  end
@@ -22,12 +22,10 @@ module BrownPaperTickets
22
22
  def new(params={})
23
23
  Event.new(@@id,@@account, params)
24
24
  end
25
-
25
+ # Returns all the account's events from brownpapersticker
26
26
  def all
27
27
  events = Event.get("/eventlist", :query =>{"id" => @@id , "account" => @@account })
28
28
  event_sales = Event.get("/eventsales", :query =>{"id" => @@id , "account" => @@account })
29
- p "*"*12
30
- p event_sales
31
29
  parsed_event = []
32
30
  events.parsed_response["document"]["event"].each do |event|
33
31
  parsed_event << Event.new(@id,@account, event)
@@ -35,11 +33,12 @@ module BrownPaperTickets
35
33
  return parsed_event
36
34
  end
37
35
 
36
+ # This method get an event from brownpapersticker.
37
+ # The event should belong to the account.
38
+ # @param [String] envent_id this is id of the event I want to find
38
39
  def find(event_id)
39
40
  event = Event.get("/eventlist",:query =>{"id" => @@id , "account" => @@account, "event_id" => event_id })
40
41
  event_sales=Event.get("/eventsales",:query =>{"id" => @@id , "account" => @@account, "event_id" => event_id })
41
- p "*"*12
42
- p event_sales
43
42
  @attributes = event.parsed_response["document"]["event"]
44
43
  return self
45
44
  end
@@ -90,8 +89,6 @@ module BrownPaperTickets
90
89
  query = self.attributes.merge("id" => @@id, "account" => @@account)
91
90
  response = BrownPaperTickets::Httpost.new(Net::HTTP::Post, "https://www.brownpapertickets.com/api2/#{param}",:query => query)
92
91
  response1 = BrownPaperTickets::Httpost.new(Net::HTTP::Get, "https://www.brownpapertickets.com/api2/eventsales",:query => query)
93
- p "*"*12
94
- p response1
95
92
  response.options[:body] = query
96
93
  st = response.perform
97
94
  xml = Hpricot(st.response.body)
@@ -0,0 +1,3 @@
1
+ module BrownPaperTickets
2
+ VERSION = "0.0.3"
3
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,14 +1,9 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'brownpapertickets'
4
- require 'spec'
5
- require 'spec/autorun'
4
+ require 'rspec'
6
5
  require "fakeweb"
7
6
 
8
- Spec::Runner.configure do |config|
9
-
10
- end
11
-
12
7
  def fixture_file(filename)
13
8
  return "" if filename == ""
14
9
  file_path = File.expand_path(File.dirname(__FILE__) + "/fixtures/" + filename)
@@ -32,4 +27,4 @@ def fetch_all_events(hash_items)
32
27
  items << BrownPaperTickets::Event.new("id","accoutn", item)
33
28
  end
34
29
  items
35
- end
30
+ end
metadata CHANGED
@@ -1,22 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brownpapertickets
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alvaro Insignares
14
14
  - Niyireth De La Hoz
15
+ - Guillermo Iguaran
15
16
  autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2011-02-23 00:00:00 -05:00
20
+ date: 2011-02-24 00:00:00 -05:00
20
21
  default_executable:
21
22
  dependencies:
22
23
  - !ruby/object:Gem::Dependency
@@ -27,12 +28,12 @@ dependencies:
27
28
  requirements:
28
29
  - - ">="
29
30
  - !ruby/object:Gem::Version
30
- hash: 13
31
+ hash: 15
31
32
  segments:
32
- - 1
33
33
  - 2
34
- - 9
35
- version: 1.2.9
34
+ - 0
35
+ - 0
36
+ version: 2.0.0
36
37
  type: :development
37
38
  version_requirements: *id001
38
39
  - !ruby/object:Gem::Dependency
@@ -67,23 +68,41 @@ dependencies:
67
68
  version: 0.6.1
68
69
  type: :runtime
69
70
  version_requirements: *id003
70
- description: Brown Paper tickets API wrapper
71
+ - !ruby/object:Gem::Dependency
72
+ name: hpricot
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 57
80
+ segments:
81
+ - 0
82
+ - 8
83
+ - 3
84
+ version: 0.8.3
85
+ type: :runtime
86
+ version_requirements: *id004
87
+ description: Brown Paper Tickets API wrapper
71
88
  email:
72
89
  - alvaro@koombea.com
73
90
  - niyireth.delahoz@koombea.com
91
+ - guilleiguaran@gmail.com
74
92
  executables: []
75
93
 
76
94
  extensions: []
77
95
 
78
- extra_rdoc_files:
79
- - LICENSE
80
- - README
81
- - README.rdoc
96
+ extra_rdoc_files: []
97
+
82
98
  files:
83
99
  - .document
100
+ - .gitignore
101
+ - .rspec
102
+ - Gemfile
103
+ - Gemfile.lock
84
104
  - LICENSE
85
- - README
86
- - README.rdoc
105
+ - README.textile
87
106
  - Rakefile
88
107
  - VERSION
89
108
  - brownpapertickets.gemspec
@@ -96,6 +115,7 @@ files:
96
115
  - lib/brownpapertickets/event.rb
97
116
  - lib/brownpapertickets/httpost.rb
98
117
  - lib/brownpapertickets/price.rb
118
+ - lib/brownpapertickets/version.rb
99
119
  - lib/brownpapertickets/xmlparse.rb
100
120
  - spec/brownpapertickets_spec.rb
101
121
  - spec/fixtures/all_events.xml
@@ -105,7 +125,6 @@ files:
105
125
  - spec/fixtures/test.json
106
126
  - spec/fixtures/update_not_ok.xml
107
127
  - spec/fixtures/update_ok.xml
108
- - spec/spec.opts
109
128
  - spec/spec_helper.rb
110
129
  has_rdoc: true
111
130
  homepage: http://github.com/niyireth/brownpapertickets
@@ -136,14 +155,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
155
  version: "0"
137
156
  requirements: []
138
157
 
139
- rubyforge_project:
158
+ rubyforge_project: brownpapertickets
140
159
  rubygems_version: 1.3.7
141
160
  signing_key:
142
161
  specification_version: 3
143
- summary: Brown Paper tickets API wrapper
162
+ summary: Brown Paper Tickets API wrapper
144
163
  test_files:
145
- - examples/create_item.rb
146
- - examples/fetch_items.rb
147
- - examples/update_item.rb
148
164
  - spec/brownpapertickets_spec.rb
165
+ - spec/fixtures/all_events.xml
166
+ - spec/fixtures/create_not_ok.xml
167
+ - spec/fixtures/create_ok.xml
168
+ - spec/fixtures/event.xml
169
+ - spec/fixtures/test.json
170
+ - spec/fixtures/update_not_ok.xml
171
+ - spec/fixtures/update_ok.xml
149
172
  - spec/spec_helper.rb
data/README DELETED
File without changes
data/README.rdoc DELETED
@@ -1,17 +0,0 @@
1
- = brownpapertickets
2
-
3
- Brownpapertickests gem, is a wrapper for Brownpapertickests's service.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2010 Alvaro Insignares. See LICENSE for details.