From 56945538ddf519662d13a6b5d7cfa962333e11aa Mon Sep 17 00:00:00 2001 From: David Haslem Date: Sat, 28 May 2011 21:06:08 -0400 Subject: [PATCH] Rename everything, handle update of httparty for mocking --- Rakefile | 4 +- eventbright.gemspec => eventbrite.gemspec | 12 +- lib/eventbright.rb | 6 - lib/eventbrite.rb | 6 + lib/{eventbright => eventbrite}/api_object.rb | 16 +- .../api_object_class_methods.rb | 10 +- .../api_object_collection.rb | 4 +- .../api_object_relationships.rb | 8 +- .../api_objects/attendee.rb | 8 +- .../api_objects/discount.rb | 6 +- .../api_objects/event.rb | 28 ++-- .../api_objects/organizer.rb | 10 +- .../api_objects/ticket.rb | 6 +- .../api_objects/user.rb | 12 +- .../api_objects/venue.rb | 4 +- lib/{eventbright => eventbrite}/error.rb | 6 +- lib/{eventbright => eventbrite}/main.rb | 6 +- spec/eventbright/user_spec.rb | 141 ------------------ spec/eventbright_spec.rb | 36 ----- .../api_object_class_spec.rb | 84 +++++------ .../api_object_collection_spec.rb | 24 +-- .../api_object_relationship_spec.rb | 14 +- .../api_object_spec.rb | 8 +- spec/eventbrite/user_spec.rb | 141 ++++++++++++++++++ ...t_api_faker.rb => eventbrite_api_faker.rb} | 15 +- spec/eventbrite_spec.rb | 36 +++++ spec/spec_helper.rb | 12 +- 27 files changed, 335 insertions(+), 328 deletions(-) rename eventbright.gemspec => eventbrite.gemspec (90%) delete mode 100644 lib/eventbright.rb create mode 100644 lib/eventbrite.rb rename lib/{eventbright => eventbrite}/api_object.rb (91%) rename lib/{eventbright => eventbrite}/api_object_class_methods.rb (92%) rename lib/{eventbright => eventbrite}/api_object_collection.rb (98%) rename lib/{eventbright => eventbrite}/api_object_relationships.rb (95%) rename lib/{eventbright => eventbrite}/api_objects/attendee.rb (92%) rename lib/{eventbright => eventbrite}/api_objects/discount.rb (94%) rename lib/{eventbright => eventbrite}/api_objects/event.rb (76%) rename lib/{eventbright => eventbrite}/api_objects/organizer.rb (70%) rename lib/{eventbright => eventbrite}/api_objects/ticket.rb (94%) rename lib/{eventbright => eventbrite}/api_objects/user.rb (79%) rename lib/{eventbright => eventbrite}/api_objects/venue.rb (96%) rename lib/{eventbright => eventbrite}/error.rb (78%) rename lib/{eventbright => eventbrite}/main.rb (95%) delete mode 100644 spec/eventbright/user_spec.rb delete mode 100644 spec/eventbright_spec.rb rename spec/{eventbright => eventbrite}/api_object_class_spec.rb (52%) rename spec/{eventbright => eventbrite}/api_object_collection_spec.rb (70%) rename spec/{eventbright => eventbrite}/api_object_relationship_spec.rb (57%) rename spec/{eventbright => eventbrite}/api_object_spec.rb (69%) create mode 100644 spec/eventbrite/user_spec.rb rename spec/{eventbright_api_faker.rb => eventbrite_api_faker.rb} (59%) create mode 100644 spec/eventbrite_spec.rb diff --git a/Rakefile b/Rakefile index a1b7617..fe1d9cb 100644 --- a/Rakefile +++ b/Rakefile @@ -4,11 +4,11 @@ require 'rake' begin require 'jeweler' Jeweler::Tasks.new do |gem| - gem.name = "eventbright" + gem.name = "eventbrite" gem.summary = %Q{An unofficial gem for EventBrite Integration} gem.description = %Q{A simple, unoffical gem that integrates with the EventBrite events service. (http://www.eventbrite.com)} gem.email = "therabidbanana@gmail.com" - gem.homepage = "http://github.com/therabidbanana/eventbright" + gem.homepage = "http://github.com/therabidbanana/eventbrite" gem.authors = ["David Haslem"] gem.add_development_dependency "rspec", ">= 1.2.9" gem.add_dependency "httparty", ">= 0.5.2" diff --git a/eventbright.gemspec b/eventbrite.gemspec similarity index 90% rename from eventbright.gemspec rename to eventbrite.gemspec index f148c66..8ecc197 100644 --- a/eventbright.gemspec +++ b/eventbrite.gemspec @@ -4,12 +4,12 @@ # -*- encoding: utf-8 -*- Gem::Specification.new do |s| - s.name = %q{eventbright} + s.name = %q{eventbrite} s.version = "0.2.3" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["David Haslem"] - s.date = %q{2010-09-01} + s.date = %q{2011-05-28} s.description = %q{A simple, unoffical gem that integrates with the EventBrite events service. (http://www.eventbrite.com)} s.email = %q{therabidbanana@gmail.com} s.extra_rdoc_files = [ @@ -23,7 +23,6 @@ Gem::Specification.new do |s| "README.markdown", "Rakefile", "VERSION", - "eventbright.gemspec", "init.rb.example", "lib/eventbright.rb", "lib/eventbright/api_object.rb", @@ -56,10 +55,10 @@ Gem::Specification.new do |s| "spec/spec.opts", "spec/spec_helper.rb" ] - s.homepage = %q{http://github.com/therabidbanana/eventbright} + s.homepage = %q{http://github.com/therabidbanana/eventbrite} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] - s.rubygems_version = %q{1.3.6} + s.rubygems_version = %q{1.7.2} s.summary = %q{An unofficial gem for EventBrite Integration} s.test_files = [ "spec/eventbright/api_object_class_spec.rb", @@ -73,10 +72,9 @@ Gem::Specification.new do |s| ] if s.respond_to? :specification_version then - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q, [">= 1.2.9"]) s.add_runtime_dependency(%q, [">= 0.5.2"]) s.add_runtime_dependency(%q, [">= 0.3.22"]) diff --git a/lib/eventbright.rb b/lib/eventbright.rb deleted file mode 100644 index 21cafd1..0000000 --- a/lib/eventbright.rb +++ /dev/null @@ -1,6 +0,0 @@ -libdir = File.dirname(__FILE__) -$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) -require File.join(libdir, 'eventbright', 'main.rb') -Dir.glob(File.join(libdir, 'eventbright', '*.rb')).each {|f| require f } -require File.join(libdir, 'eventbright', 'api_objects', 'event.rb') -Dir.glob(File.join(libdir, 'eventbright', 'api_objects', '*.rb')).each {|f| require f } diff --git a/lib/eventbrite.rb b/lib/eventbrite.rb new file mode 100644 index 0000000..929355b --- /dev/null +++ b/lib/eventbrite.rb @@ -0,0 +1,6 @@ +libdir = File.dirname(__FILE__) +$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) +require File.join(libdir, 'eventbrite', 'main.rb') +Dir.glob(File.join(libdir, 'eventbrite', '*.rb')).each {|f| require f } +require File.join(libdir, 'eventbrite', 'api_objects', 'event.rb') +Dir.glob(File.join(libdir, 'eventbrite', 'api_objects', '*.rb')).each {|f| require f } diff --git a/lib/eventbright/api_object.rb b/lib/eventbrite/api_object.rb similarity index 91% rename from lib/eventbright/api_object.rb rename to lib/eventbrite/api_object.rb index 699a471..be75c68 100644 --- a/lib/eventbright/api_object.rb +++ b/lib/eventbrite/api_object.rb @@ -1,9 +1,9 @@ -require 'eventbright/api_object_class_methods' -require 'eventbright/api_object_relationships' -module EventBright +require 'eventbrite/api_object_class_methods' +require 'eventbrite/api_object_relationships' +module Eventbrite class ApiObject - extend EventBright::ApiObjectClassMethods - include EventBright::ApiObjectRelationships + extend Eventbrite::ApiObjectClassMethods + include Eventbrite::ApiObjectRelationships attr_accessor :id, :owner attr_accessor :attributes, :relations, :collections attr_accessor :dirty, :dirty_relations, :dirty_collections @@ -48,7 +48,7 @@ def id=(new_id,*args) def load(hash = {}, no_dirty = false) if hash.nil? || hash.size == 0 - response = EventBright.call("#{self.class.singlet_name}_get", prep_api_hash('get')) + response = Eventbrite.call("#{self.class.singlet_name}_get", prep_api_hash('get')) hash = response["#{self.class.singlet_name}"] end unless hash.nil? || hash.size == 0 @@ -118,11 +118,11 @@ def save(opts = {}) opts = relations_save(opts) opts = before_save(opts) call = if loaded? - c = EventBright.call("#{self.class.singlet_name}_update", prep_api_hash('update', opts)) + c = Eventbrite.call("#{self.class.singlet_name}_update", prep_api_hash('update', opts)) after_update c else - c = EventBright.call("#{self.class.singlet_name}_new", prep_api_hash('new', opts)) + c = Eventbrite.call("#{self.class.singlet_name}_new", prep_api_hash('new', opts)) after_new c end diff --git a/lib/eventbright/api_object_class_methods.rb b/lib/eventbrite/api_object_class_methods.rb similarity index 92% rename from lib/eventbright/api_object_class_methods.rb rename to lib/eventbrite/api_object_class_methods.rb index b44aafa..4d2bb08 100644 --- a/lib/eventbright/api_object_class_methods.rb +++ b/lib/eventbrite/api_object_class_methods.rb @@ -1,8 +1,8 @@ -module EventBright +module Eventbrite module ApiObjectClassMethods def singlet_name(name = false) @singlet_name = name if name - @singlet_name || self.to_s.gsub('EventBright::', '').downcase + @singlet_name || self.to_s.gsub('Eventbrite::', '').downcase end def plural_name(name = false) @@ -57,7 +57,7 @@ def readable(*args) def updatable_date(*args) args.each{|symbol| - module_eval( "def #{symbol}(); EventBright.formatted_time(attribute_get(:#{symbol})); end") + module_eval( "def #{symbol}(); Eventbrite.formatted_time(attribute_get(:#{symbol})); end") module_eval( "def #{symbol}=(val, no_dirty = false); attribute_set(:#{symbol}, Time.parse(val), no_dirty); end") } end @@ -65,7 +65,7 @@ def updatable_date(*args) def readable_date(*args) args.each{|symbol| - module_eval( "def #{symbol}(); EventBright.formatted_time(attribute_get(:#{symbol})); end") + module_eval( "def #{symbol}(); Eventbrite.formatted_time(attribute_get(:#{symbol})); end") module_eval( "def #{symbol}=(val, no_dirty = false); attribute_set(:#{symbol}, Time.parse(val), true); end") } end @@ -114,4 +114,4 @@ def collections end end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_object_collection.rb b/lib/eventbrite/api_object_collection.rb similarity index 98% rename from lib/eventbright/api_object_collection.rb rename to lib/eventbrite/api_object_collection.rb index 6821a6d..050b19d 100644 --- a/lib/eventbright/api_object_collection.rb +++ b/lib/eventbrite/api_object_collection.rb @@ -1,4 +1,4 @@ -module EventBright +module Eventbrite class ApiObjectCollection def initialize(owner = false, hash_array = [], parent = false) @@ -57,4 +57,4 @@ def self.getter(name = false) @getter || "user_list_#{self.plural_name}" end end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_object_relationships.rb b/lib/eventbrite/api_object_relationships.rb similarity index 95% rename from lib/eventbright/api_object_relationships.rb rename to lib/eventbrite/api_object_relationships.rb index b219b8a..4d14183 100644 --- a/lib/eventbright/api_object_relationships.rb +++ b/lib/eventbrite/api_object_relationships.rb @@ -1,14 +1,14 @@ -module EventBright +module Eventbrite module ApiObjectRelationships def relation_get(key); @relations[key]; end def collection_get(key); return @collections[key] unless @collections[key].nil? || collection_dirty?(key) klass = self.class.collections[key] begin - response = EventBright.call(klass.getter, nested_hash) + response = Eventbrite.call(klass.getter, nested_hash) response = unnest_child_response(response) c = klass.new(owner, response[klass.plural_name], self) - rescue EventBright::Error => e + rescue Eventbrite::Error => e if e.type == "Not Found" || e.type == "Discount error" || e.type == "Order error" c = klass.new(owner, nil, self) else @@ -69,4 +69,4 @@ def collections_save end end end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_objects/attendee.rb b/lib/eventbrite/api_objects/attendee.rb similarity index 92% rename from lib/eventbright/api_objects/attendee.rb rename to lib/eventbrite/api_objects/attendee.rb index 160c758..9a75fea 100644 --- a/lib/eventbright/api_objects/attendee.rb +++ b/lib/eventbrite/api_objects/attendee.rb @@ -1,5 +1,5 @@ -require 'eventbright/api_objects/ticket' -module EventBright +require 'eventbrite/api_objects/ticket' +module Eventbrite class Attendee < ApiObject @@ -28,7 +28,7 @@ class Attendee < ApiObject # Attendees can't live outside events, so we override standard owner to be event. def initialize(event = nil, hash = {}) preinit - raise ArgumentError unless event.is_a? EventBright::Event + raise ArgumentError unless event.is_a? Eventbrite::Event @id = hash.delete(:id) @event = event @owner = event.owner @@ -49,4 +49,4 @@ def save(*args) # noop. Attendees can't be altered via api end end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_objects/discount.rb b/lib/eventbrite/api_objects/discount.rb similarity index 94% rename from lib/eventbright/api_objects/discount.rb rename to lib/eventbrite/api_objects/discount.rb index 6a94190..119e4ae 100644 --- a/lib/eventbright/api_objects/discount.rb +++ b/lib/eventbrite/api_objects/discount.rb @@ -1,4 +1,4 @@ -module EventBright +module Eventbrite class Discount < ApiObject @@ -14,7 +14,7 @@ class Discount < ApiObject # Tickets can't live outside events, so we override standard owner to be event. def initialize(event = nil, hash = {}) preinit - raise ArgumentError unless event.is_a? EventBright::Event + raise ArgumentError unless event.is_a? Eventbrite::Event @id = hash.delete(:id) @event = event @owner = event.owner @@ -59,4 +59,4 @@ def initialize(owner = false, hash_array = [], event = false) super(event, hash_array) end end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_objects/event.rb b/lib/eventbrite/api_objects/event.rb similarity index 76% rename from lib/eventbright/api_objects/event.rb rename to lib/eventbrite/api_objects/event.rb index 137efe5..af41136 100644 --- a/lib/eventbright/api_objects/event.rb +++ b/lib/eventbrite/api_objects/event.rb @@ -1,11 +1,11 @@ -require 'eventbright/api_objects/organizer' -require 'eventbright/api_objects/venue' -require 'eventbright/api_objects/ticket' -require 'eventbright/api_objects/organizer' -require 'eventbright/api_objects/discount' -require 'eventbright/api_objects/attendee' -module EventBright - class Event < EventBright::ApiObject +require 'eventbrite/api_objects/organizer' +require 'eventbrite/api_objects/venue' +require 'eventbrite/api_objects/ticket' +require 'eventbrite/api_objects/organizer' +require 'eventbrite/api_objects/discount' +require 'eventbrite/api_objects/attendee' +module Eventbrite + class Event < Eventbrite::ApiObject updatable :title, :description, :tags, :timezone updatable_date :start_date, :end_date @@ -25,11 +25,11 @@ class Event < EventBright::ApiObject renames :id => :event_id attr_accessor :organizer, :venue - has :organizer => EventBright::Organizer - has :venue => EventBright::Venue - collection :tickets => EventBright::TicketCollection - collection :attendees => EventBright::AttendeeCollection - collection :discounts => EventBright::DiscountCollection + has :organizer => Eventbrite::Organizer + has :venue => Eventbrite::Venue + collection :tickets => Eventbrite::TicketCollection + collection :attendees => Eventbrite::AttendeeCollection + collection :discounts => Eventbrite::DiscountCollection def privacy case attribute_get(:privacy) @@ -76,4 +76,4 @@ def nested_hash end class EventCollection < ApiObjectCollection; collection_for Event; end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_objects/organizer.rb b/lib/eventbrite/api_objects/organizer.rb similarity index 70% rename from lib/eventbright/api_objects/organizer.rb rename to lib/eventbrite/api_objects/organizer.rb index 5b8aa7b..31231c7 100644 --- a/lib/eventbright/api_objects/organizer.rb +++ b/lib/eventbrite/api_objects/organizer.rb @@ -1,17 +1,17 @@ -module EventBright - class Event < EventBright::ApiObject; end +module Eventbrite + class Event < Eventbrite::ApiObject; end class OrganizerEventCollection < ApiObjectCollection collection_for Event getter :organizer_list_events end - class Organizer < EventBright::ApiObject + class Organizer < Eventbrite::ApiObject updatable :name, :description readable :url requires :name - collection :events => EventBright::OrganizerEventCollection + collection :events => Eventbrite::OrganizerEventCollection def after_new @owner.dirty_organizers! end @@ -23,4 +23,4 @@ def unnest_child_response(response) end class OrganizerCollection < ApiObjectCollection; collection_for Organizer; end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_objects/ticket.rb b/lib/eventbrite/api_objects/ticket.rb similarity index 94% rename from lib/eventbright/api_objects/ticket.rb rename to lib/eventbrite/api_objects/ticket.rb index fedb81e..4b819a9 100644 --- a/lib/eventbright/api_objects/ticket.rb +++ b/lib/eventbrite/api_objects/ticket.rb @@ -1,4 +1,4 @@ -module EventBright +module Eventbrite class Ticket < ApiObject @@ -22,7 +22,7 @@ class Ticket < ApiObject # Tickets can't live outside events, so we override standard owner to be event. def initialize(event = nil, hash = {}) preinit - raise ArgumentError unless event.is_a? EventBright::Event + raise ArgumentError unless event.is_a? Eventbrite::Event @id = hash.delete(:id) @event = event @owner = event.owner @@ -60,4 +60,4 @@ def initialize(owner = false, hash_array = [], event = false) super(event, hash_array) end end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_objects/user.rb b/lib/eventbrite/api_objects/user.rb similarity index 79% rename from lib/eventbright/api_objects/user.rb rename to lib/eventbrite/api_objects/user.rb index 33b71a5..f8bb25d 100644 --- a/lib/eventbright/api_objects/user.rb +++ b/lib/eventbrite/api_objects/user.rb @@ -1,5 +1,5 @@ -module EventBright - class User < EventBright::ApiObject +module Eventbrite + class User < Eventbrite::ApiObject updatable :email, :password readable :user_key @@ -8,9 +8,9 @@ class User < EventBright::ApiObject remap :user_id => :id ignores ['subusers'] - collection :events => EventBright::EventCollection - collection :organizers => EventBright::OrganizerCollection - collection :venues => EventBright::VenueCollection + collection :events => Eventbrite::EventCollection + collection :organizers => Eventbrite::OrganizerCollection + collection :venues => Eventbrite::VenueCollection def initialize(user, no_load = false) preinit @@ -42,4 +42,4 @@ def auth end end -end \ No newline at end of file +end diff --git a/lib/eventbright/api_objects/venue.rb b/lib/eventbrite/api_objects/venue.rb similarity index 96% rename from lib/eventbright/api_objects/venue.rb rename to lib/eventbrite/api_objects/venue.rb index 30af9e7..340c3bd 100644 --- a/lib/eventbright/api_objects/venue.rb +++ b/lib/eventbrite/api_objects/venue.rb @@ -1,4 +1,4 @@ -module EventBright +module Eventbrite class Venue < ApiObject @@ -16,4 +16,4 @@ def state; region; end # Region is same as state in US def state=(val); region= val; end # Region is same as state in US end class VenueCollection < ApiObjectCollection; collection_for Venue; end -end \ No newline at end of file +end diff --git a/lib/eventbright/error.rb b/lib/eventbrite/error.rb similarity index 78% rename from lib/eventbright/error.rb rename to lib/eventbrite/error.rb index 88c22cc..0bd42e4 100644 --- a/lib/eventbright/error.rb +++ b/lib/eventbrite/error.rb @@ -1,4 +1,4 @@ -module EventBright +module Eventbrite class Error < Exception attr_accessor :type, :response, :message def initialize(message, type = "", response = nil) @@ -8,7 +8,7 @@ def initialize(message, type = "", response = nil) super(message) end def inspect - "" + "" end end -end \ No newline at end of file +end diff --git a/lib/eventbright/main.rb b/lib/eventbrite/main.rb similarity index 95% rename from lib/eventbright/main.rb rename to lib/eventbrite/main.rb index 2660204..3d706e8 100644 --- a/lib/eventbright/main.rb +++ b/lib/eventbrite/main.rb @@ -1,6 +1,6 @@ require 'httparty' require 'tzinfo' -module EventBright +module Eventbrite EVENTBRITE_TIME_STRING = '%Y-%m-%d %H:%M:%S' def self.setup(app_key = "YmRmMmMxMjYzNDYy", debug = false) @app_key = app_key @@ -14,7 +14,7 @@ def self.debug! def self.call(function, opts = {}) @app_key ||= "YmRmMmMxMjYzNDYy" opts[:app_key] = @app_key - if opts[:user].is_a? EventBright::User + if opts[:user].is_a? Eventbrite::User # Allow passing User object instead of user auth info. u = opts.delete :user opts.merge!(u.auth) @@ -54,4 +54,4 @@ def self.do_post(function, opts = {}) response end end -end \ No newline at end of file +end diff --git a/spec/eventbright/user_spec.rb b/spec/eventbright/user_spec.rb deleted file mode 100644 index c468ab9..0000000 --- a/spec/eventbright/user_spec.rb +++ /dev/null @@ -1,141 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') - -describe EventBright::User do - before(:all) do - EventBright.setup("key") - end - - it "should load from API on initialization" do - EventBright::API.should_receive(:do_post).with("/user_get", anything).and_return(fake_response("/user_get")) - u = EventBright::User.new("fake_key") - u.attribute_get(:email).should == "david@orangesparkleball.com" - u.attribute_get(:password).should be_nil - u.attribute_get(:user_key).should_not be_nil - end - - it "should not call API if no_load set in initialization" do - EventBright::API.should_not_receive(:do_post) - EventBright::User.new("fake_key", true) - end - - it "should accept an array of [email, password] as authentication" do - EventBright::API.should_receive(:do_post).with("/user_get", :body => hash_including("password", "user")).and_return(fake_response("/user_get")) - u = EventBright::User.new(["fake_user", "fake_pass"]) - u.attribute_get(:email).should_not be_nil - end - - it "should return a user auth hash" do - u = EventBright::User.new("fake_key", true) - u2 = EventBright::User.new(["fake_email", "fake_pass"], true) - u.auth.should_not == u2.auth - u.auth["user_key"].should_not be_nil - u2.auth["user_key"].should be_nil - u.auth["user"].should be_nil - u2.auth["user"].should_not be_nil - end - - it "should retrieve venues" do - u = EventBright::User.new("fake_key", true) - EventBright::API.should_receive(:do_post).with("/user_list_venues", anything).and_return(fake_response("/user_list_venues")) - v = u.venues - v.should be_an EventBright::VenueCollection - v.should_not be_empty - end - - it "should cache venues" do - u = EventBright::User.new("fake_key", true) - EventBright::API.should_receive(:do_post).once.with("/user_list_venues", anything).and_return(fake_response("/user_list_venues")) - u.venues - u.venues - EventBright::API.should_receive(:do_post).once.with("/user_list_venues", anything).and_return(fake_response("/user_list_venues")) - u.dirty_venues! - u.venues - end - - it "should retrieve organizers" do - u = EventBright::User.new("fake_key", true) - EventBright::API.should_receive(:do_post).with("/user_list_organizers", anything).and_return(fake_response("/user_list_organizers")) - o = u.organizers - o.should be_an EventBright::OrganizerCollection - o.should_not be_empty - end - - it "should cache organizers" do - u = EventBright::User.new("fake_key", true) - EventBright::API.should_receive(:do_post).once.with("/user_list_organizers", anything).and_return(fake_response("/user_list_organizers")) - u.organizers - u.organizers - EventBright::API.should_receive(:do_post).once.with("/user_list_organizers", anything).and_return(fake_response("/user_list_organizers")) - u.dirty_organizers! - u.organizers - end - - it "should retrieve events" do - u = EventBright::User.new("fake_key", true) - EventBright::API.should_receive(:do_post).with("/user_list_events", anything).and_return(fake_response("/user_list_events")) - e = u.events - e.should be_an EventBright::EventCollection - e.should_not be_empty - end - - it "should cache events" do - u = EventBright::User.new("fake_key", true) - EventBright::API.should_receive(:do_post).once.with("/user_list_events", anything).and_return(fake_response("/user_list_events")) - u.events - u.events - EventBright::API.should_receive(:do_post).once.with("/user_list_events", anything).and_return(fake_response("/user_list_events")) - u.dirty_events! - u.events - end - - it "should call init_with_hash and call API if calling load" do - u = EventBright::User.new("fake_key", true) - EventBright::API.should_receive(:do_post).with("/user_get", anything).and_return(fake_response("/user_get")) - u.should_receive(:init_with_hash).with(instance_of(Hash), anything) - u.load - end - - it "should get an init_with_hash method" do - u = EventBright::User.new("fake_key", true) - h = fake_response("/user_get")["user"] - u.init_with_hash(h) - u.email.should_not be_nil - end - - it "should load attributes when calling load" do - u = EventBright::User.new("fake_key", true) - u.email.should be_nil - u.load - u.email.should_not be_nil - end - - it "should have a dirty-tracking update hash" do - u = EventBright::User.new("fake_key", true) - u.updatable_hash.should be_empty - u.load! - u.updatable_hash.size.should == 1 - u.updatable_hash[:id].should_not be_nil - u.email = "foo" - u.updatable_hash.size.should == 2 - u.updatable_hash[:email].should_not be_nil - end - - it "should track loaded status" do - u = EventBright::User.new("fake_key", true) - u.loaded?.should be_false - u.load - u.loaded?.should be_true - end - - it "should track dirty status" do - u = EventBright::User.new("fake_key", true) - # Can't be clean until we load - u.dirty?.should be_true - u.load! - u.dirty?.should be_false - u.date_modified = "now" - u.dirty?.should be_false - u.email = "banana" - u.dirty?.should be_true - end -end diff --git a/spec/eventbright_spec.rb b/spec/eventbright_spec.rb deleted file mode 100644 index 0b5eaa1..0000000 --- a/spec/eventbright_spec.rb +++ /dev/null @@ -1,36 +0,0 @@ -require File.expand_path(File.dirname(__FILE__) + '/spec_helper') - -describe EventBright do - before(:each) do - EventBright.setup("key") - end - it "should have setup method" do - EventBright.should respond_to(:setup) - lambda { - EventBright.setup("key") - EventBright.setup("key", true) - }.should_not raise_error - end - it "should call httparty with key given to setup" do - EventBright::API.should_receive(:do_post).with(anything, hash_including(:body => hash_including(:app_key => "key"))) - EventBright.call("event_get", {}) - end - - it "should have call method" do - EventBright.should respond_to(:call) - end - it "should have debug! method" do - EventBright.should respond_to(:debug!) - end - - it "should replace a user object with a user_key on #call" do - EventBright::API.should_receive(:do_post).with("/user_get", {:body => {:app_key => "key", "user_key" => "fake_key"}}) - EventBright.call(:user_get, :user => EventBright::User.new("fake_key", true)) - end - - it "should format time according to eventbright's wrong iso8601" do - a = "2010-04-01 13:37:00" - b = Time.parse("4/1/2010 13:37") - a.should == EventBright.formatted_time(b) - end -end diff --git a/spec/eventbright/api_object_class_spec.rb b/spec/eventbrite/api_object_class_spec.rb similarity index 52% rename from spec/eventbright/api_object_class_spec.rb rename to spec/eventbrite/api_object_class_spec.rb index 1df9c9e..b8c8488 100644 --- a/spec/eventbright/api_object_class_spec.rb +++ b/spec/eventbrite/api_object_class_spec.rb @@ -1,45 +1,45 @@ -share_examples_for "EventBright::ApiObject class methods" do +share_examples_for "Eventbrite::ApiObject class methods" do it "should have a singlet name same as class name, or set singlet_name" do - EventBright::Foo.singlet_name.should == 'foo' - EventBright::Bar.singlet_name.should == 'baz' + Eventbrite::Foo.singlet_name.should == 'foo' + Eventbrite::Bar.singlet_name.should == 'baz' end it "should add an s to the singlet name to get the plural, or use set plural" do - EventBright::Foo.plural_name.should == 'foos' - EventBright::Bar.plural_name.should == 'bazzes' + Eventbrite::Foo.plural_name.should == 'foos' + Eventbrite::Bar.plural_name.should == 'bazzes' end it "should have ignores" do - EventBright::Foo.ignores.should == [] - EventBright::Foo.ignores :foo, :bar - EventBright::Foo.ignores :baz - EventBright::Foo.ignores.should == [:foo, :bar, :baz] + Eventbrite::Foo.ignores.should == [] + Eventbrite::Foo.ignores :foo, :bar + Eventbrite::Foo.ignores :baz + Eventbrite::Foo.ignores.should == [:foo, :bar, :baz] end it "should have requires" do - EventBright::Foo.requires.should == [] - EventBright::Foo.requires :foo, :bar - EventBright::Foo.requires :baz - EventBright::Foo.requires.should == [:foo, :bar, :baz] + Eventbrite::Foo.requires.should == [] + Eventbrite::Foo.requires :foo, :bar + Eventbrite::Foo.requires :baz + Eventbrite::Foo.requires.should == [:foo, :bar, :baz] end it "should have reformats" do - EventBright::Foo.reformats.should == [] - EventBright::Foo.reformats :foo, :bar - EventBright::Foo.reformats :baz - EventBright::Foo.reformats.should == [:foo, :bar, :baz] + Eventbrite::Foo.reformats.should == [] + Eventbrite::Foo.reformats :foo, :bar + Eventbrite::Foo.reformats :baz + Eventbrite::Foo.reformats.should == [:foo, :bar, :baz] end it "should have renames" do - EventBright::Foo.renames.should == {} - EventBright::Foo.renames :foo => :bar, :quux => :wobble - EventBright::Foo.renames :baz => :qux - EventBright::Foo.renames.should == {:foo => :bar, :baz => :qux, :quux => :wobble} + Eventbrite::Foo.renames.should == {} + Eventbrite::Foo.renames :foo => :bar, :quux => :wobble + Eventbrite::Foo.renames :baz => :qux + Eventbrite::Foo.renames.should == {:foo => :bar, :baz => :qux, :quux => :wobble} end it "should have updatable" do - f = EventBright::Foo.new(false, {}) + f = Eventbrite::Foo.new(false, {}) f.should_not respond_to(:attr_1) f.should_not respond_to(:attr_2) f.should_not respond_to(:attr_3) f.should_not respond_to(:attr_3=) - EventBright::Foo.updatable :attr_1, :attr_2 - EventBright::Foo.updatable :attr_3 + Eventbrite::Foo.updatable :attr_1, :attr_2 + Eventbrite::Foo.updatable :attr_3 f.should respond_to(:attr_1) f.should respond_to(:attr_2) f.should respond_to(:attr_3) @@ -48,13 +48,13 @@ f.attr_3 = :banana end it "should have readable" do - f = EventBright::Foo.new(false, {}) + f = Eventbrite::Foo.new(false, {}) f.should_not respond_to(:attr_4) f.should_not respond_to(:attr_5) f.should_not respond_to(:attr_6) f.should_not respond_to(:attr_6=) - EventBright::Foo.readable :attr_4, :attr_5 - EventBright::Foo.readable :attr_6 + Eventbrite::Foo.readable :attr_4, :attr_5 + Eventbrite::Foo.readable :attr_6 f.should respond_to(:attr_4) f.should respond_to(:attr_5) f.should respond_to(:attr_6) @@ -63,25 +63,25 @@ f.attr_6 = :banana end it "should have a readable_date" do - f = EventBright::Foo.new(false, {}) + f = Eventbrite::Foo.new(false, {}) time = Time.parse("4/1/2010 13:37") - EventBright::Foo.readable_date :attr_7, :attr_8 + Eventbrite::Foo.readable_date :attr_7, :attr_8 f.attr_7 = f.attr_8 = "4/1/2010 13:37" f.attributes.should == {:attr_7 => time, :attr_8 => time} - f.attr_7.should == EventBright.formatted_time(time) + f.attr_7.should == Eventbrite.formatted_time(time) end it "should have an updatable_date" do - f = EventBright::Foo.new(false, {}) + f = Eventbrite::Foo.new(false, {}) time = Time.parse("4/1/2010 13:37") - EventBright::Foo.updatable_date :attr_9, :attr_0 + Eventbrite::Foo.updatable_date :attr_9, :attr_0 f.attr_9 = f.attr_0 = "4/1/2010 13:37" f.attributes.should == {:attr_9 => time, :attr_0 => time} - f.attr_9.should == EventBright.formatted_time(time) + f.attr_9.should == Eventbrite.formatted_time(time) end it "should have a remap method" do - f = EventBright::Foo.new(false, {}) + f = Eventbrite::Foo.new(false, {}) f.should_not respond_to(:banana) - EventBright::Foo.remap :banana => :attr_1 + Eventbrite::Foo.remap :banana => :attr_1 f.should respond_to(:banana) f.should_receive(:attr_1=).once f.should_receive(:attr_1).once @@ -90,24 +90,24 @@ end it "should have the #has method" do - f = EventBright::Foo.new(false, {}) + f = Eventbrite::Foo.new(false, {}) f.should_not respond_to(:bar) f.class.relations.should == {} - EventBright::Foo.has :bar => EventBright::Bar + Eventbrite::Foo.has :bar => Eventbrite::Bar f.should respond_to(:bar) f.should respond_to(:bar=) f.class.relations.should have(1).relation - f.class.relations[:bar].should == EventBright::Bar + f.class.relations[:bar].should == Eventbrite::Bar end it "should have the #collection method" do - f = EventBright::Foo.new(false, {}) + f = Eventbrite::Foo.new(false, {}) f.should_not respond_to(:baz) f.class.collections.should == {} - EventBright::Foo.collection :baz => EventBright::BananaBunch + Eventbrite::Foo.collection :baz => Eventbrite::BananaBunch f.should respond_to(:baz) f.should respond_to(:baz=) f.class.collections.should have(1).relation - f.class.collections[:baz].should == EventBright::BananaBunch + f.class.collections[:baz].should == Eventbrite::BananaBunch end -end \ No newline at end of file +end diff --git a/spec/eventbright/api_object_collection_spec.rb b/spec/eventbrite/api_object_collection_spec.rb similarity index 70% rename from spec/eventbright/api_object_collection_spec.rb rename to spec/eventbrite/api_object_collection_spec.rb index 9639bd7..a15d159 100644 --- a/spec/eventbright/api_object_collection_spec.rb +++ b/spec/eventbrite/api_object_collection_spec.rb @@ -1,8 +1,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') -describe EventBright::ApiObjectCollection do +describe Eventbrite::ApiObjectCollection do before(:all) do - @b = EventBright::BananaBunch.new(false, [{"banana" => {:val => 1}}, {"banana" => {:val => 2}}]) + @b = Eventbrite::BananaBunch.new(false, [{"banana" => {:val => 1}}, {"banana" => {:val => 2}}]) end context "collection functions" do it "should pass through standard Array methods" do @@ -38,20 +38,20 @@ context "class definitions" do it "should have a singlet name same as class name" do - EventBright::BananaBunch.singlet_name.should == 'banana' - EventBright::BradyBunch.singlet_name.should == 'bob' + Eventbrite::BananaBunch.singlet_name.should == 'banana' + Eventbrite::BradyBunch.singlet_name.should == 'bob' end it "should add an s to the singlet name to get the plural" do - EventBright::BananaBunch.plural_name.should == 'bananas' - EventBright::BradyBunch.plural_name.should == 'joe' + Eventbrite::BananaBunch.plural_name.should == 'bananas' + Eventbrite::BradyBunch.plural_name.should == 'joe' end it "should know what class it collects" do - EventBright::BananaBunch.collection_for.should eql EventBright::Banana - EventBright::BradyBunch.collection_for.should eql EventBright::Brady + Eventbrite::BananaBunch.collection_for.should eql Eventbrite::Banana + Eventbrite::BradyBunch.collection_for.should eql Eventbrite::Brady end it "should have a getter" do - EventBright::BananaBunch.getter.should == "user_list_bananas" - EventBright::BradyBunch.getter.should == :foo_bar_baz + Eventbrite::BananaBunch.getter.should == "user_list_bananas" + Eventbrite::BradyBunch.getter.should == :foo_bar_baz end end @@ -61,7 +61,7 @@ end it "should silently reject useless objects (ones without required attributes, empty ones)" do - @bb = EventBright::BradyBunch.new(false, [{"bob" => {:foo => 1}}, {"bob" => {}}, {"bob" => {:bar => 3}}]) + @bb = Eventbrite::BradyBunch.new(false, [{"bob" => {:foo => 1}}, {"bob" => {}}, {"bob" => {:bar => 3}}]) @bb.size.should == 1 end -end \ No newline at end of file +end diff --git a/spec/eventbright/api_object_relationship_spec.rb b/spec/eventbrite/api_object_relationship_spec.rb similarity index 57% rename from spec/eventbright/api_object_relationship_spec.rb rename to spec/eventbrite/api_object_relationship_spec.rb index 26c3574..d269bf9 100644 --- a/spec/eventbright/api_object_relationship_spec.rb +++ b/spec/eventbrite/api_object_relationship_spec.rb @@ -1,11 +1,11 @@ -share_examples_for "EventBright::ApiObject relationship methods" do +share_examples_for "Eventbrite::ApiObject relationship methods" do before :all do - @bar = EventBright::Bar.new + @bar = Eventbrite::Bar.new end it "should be able to get relations" do @bar.relations.should == {} - @bar.relations = {:banana => EventBright::Banana.new} - @bar.banana.should be_an_instance_of(EventBright::Banana) + @bar.relations = {:banana => Eventbrite::Banana.new} + @bar.banana.should be_an_instance_of(Eventbrite::Banana) @bar.relations.should have(1).items @bar.should_receive(:relation_get).with(:banana) lambda{ @@ -14,10 +14,10 @@ end it "should be able to get collections" do @bar.collections.should == {} - @bar.collections = {:bananas => EventBright::BananaBunch.new} - @bar.bananas.should be_an_instance_of(EventBright::BananaBunch) + @bar.collections = {:bananas => Eventbrite::BananaBunch.new} + @bar.bananas.should be_an_instance_of(Eventbrite::BananaBunch) @bar.collections.should have(1).items @bar.should_receive(:collection_get).with(:bananas) lambda{@bar.bananas}.should_not raise_error end -end \ No newline at end of file +end diff --git a/spec/eventbright/api_object_spec.rb b/spec/eventbrite/api_object_spec.rb similarity index 69% rename from spec/eventbright/api_object_spec.rb rename to spec/eventbrite/api_object_spec.rb index ec0ec8f..cb32987 100644 --- a/spec/eventbright/api_object_spec.rb +++ b/spec/eventbrite/api_object_spec.rb @@ -1,17 +1,17 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') require File.expand_path(File.dirname(__FILE__) + '/api_object_class_spec') require File.expand_path(File.dirname(__FILE__) + '/api_object_relationship_spec') -describe EventBright::ApiObject do +describe Eventbrite::ApiObject do before(:all) do end describe "class methods" do - it_should_behave_like "EventBright::ApiObject class methods" + it_should_behave_like "Eventbrite::ApiObject class methods" end describe "relationships" do - it_should_behave_like "EventBright::ApiObject relationship methods" + it_should_behave_like "Eventbrite::ApiObject relationship methods" end it "should have an init with hash method" do # Implement this end -end \ No newline at end of file +end diff --git a/spec/eventbrite/user_spec.rb b/spec/eventbrite/user_spec.rb new file mode 100644 index 0000000..c7eaa08 --- /dev/null +++ b/spec/eventbrite/user_spec.rb @@ -0,0 +1,141 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +describe Eventbrite::User do + before(:all) do + Eventbrite.setup("key") + end + + it "should load from API on initialization" do + Eventbrite::API.should_receive(:do_post).with("/user_get", anything).and_return(fake_response("/user_get")) + u = Eventbrite::User.new("fake_key") + u.attribute_get(:email).should == "david@orangesparkleball.com" + u.attribute_get(:password).should be_nil + u.attribute_get(:user_key).should_not be_nil + end + + it "should not call API if no_load set in initialization" do + Eventbrite::API.should_not_receive(:do_post) + Eventbrite::User.new("fake_key", true) + end + + it "should accept an array of [email, password] as authentication" do + Eventbrite::API.should_receive(:do_post).with("/user_get", :body => hash_including("password", "user")).and_return(fake_response("/user_get")) + u = Eventbrite::User.new(["fake_user", "fake_pass"]) + u.attribute_get(:email).should_not be_nil + end + + it "should return a user auth hash" do + u = Eventbrite::User.new("fake_key", true) + u2 = Eventbrite::User.new(["fake_email", "fake_pass"], true) + u.auth.should_not == u2.auth + u.auth["user_key"].should_not be_nil + u2.auth["user_key"].should be_nil + u.auth["user"].should be_nil + u2.auth["user"].should_not be_nil + end + + it "should retrieve venues" do + u = Eventbrite::User.new("fake_key", true) + Eventbrite::API.should_receive(:do_post).with("/user_list_venues", anything).and_return(fake_response("/user_list_venues")) + v = u.venues + v.should be_an Eventbrite::VenueCollection + v.should_not be_empty + end + + it "should cache venues" do + u = Eventbrite::User.new("fake_key", true) + Eventbrite::API.should_receive(:do_post).once.with("/user_list_venues", anything).and_return(fake_response("/user_list_venues")) + u.venues + u.venues + Eventbrite::API.should_receive(:do_post).once.with("/user_list_venues", anything).and_return(fake_response("/user_list_venues")) + u.dirty_venues! + u.venues + end + + it "should retrieve organizers" do + u = Eventbrite::User.new("fake_key", true) + Eventbrite::API.should_receive(:do_post).with("/user_list_organizers", anything).and_return(fake_response("/user_list_organizers")) + o = u.organizers + o.should be_an Eventbrite::OrganizerCollection + o.should_not be_empty + end + + it "should cache organizers" do + u = Eventbrite::User.new("fake_key", true) + Eventbrite::API.should_receive(:do_post).once.with("/user_list_organizers", anything).and_return(fake_response("/user_list_organizers")) + u.organizers + u.organizers + Eventbrite::API.should_receive(:do_post).once.with("/user_list_organizers", anything).and_return(fake_response("/user_list_organizers")) + u.dirty_organizers! + u.organizers + end + + it "should retrieve events" do + u = Eventbrite::User.new("fake_key", true) + Eventbrite::API.should_receive(:do_post).with("/user_list_events", anything).and_return(fake_response("/user_list_events")) + e = u.events + e.should be_an Eventbrite::EventCollection + e.should_not be_empty + end + + it "should cache events" do + u = Eventbrite::User.new("fake_key", true) + Eventbrite::API.should_receive(:do_post).once.with("/user_list_events", anything).and_return(fake_response("/user_list_events")) + u.events + u.events + Eventbrite::API.should_receive(:do_post).once.with("/user_list_events", anything).and_return(fake_response("/user_list_events")) + u.dirty_events! + u.events + end + + it "should call init_with_hash and call API if calling load" do + u = Eventbrite::User.new("fake_key", true) + Eventbrite::API.should_receive(:do_post).with("/user_get", anything).and_return(fake_response("/user_get")) + u.should_receive(:init_with_hash).with(instance_of(Hash), anything) + u.load + end + + it "should get an init_with_hash method" do + u = Eventbrite::User.new("fake_key", true) + h = fake_response("/user_get")["user"] + u.init_with_hash(h) + u.email.should_not be_nil + end + + it "should load attributes when calling load" do + u = Eventbrite::User.new("fake_key", true) + u.email.should be_nil + u.load + u.email.should_not be_nil + end + + it "should have a dirty-tracking update hash" do + u = Eventbrite::User.new("fake_key", true) + u.updatable_hash.should be_empty + u.load! + u.updatable_hash.size.should == 1 + u.updatable_hash[:id].should_not be_nil + u.email = "foo" + u.updatable_hash.size.should == 2 + u.updatable_hash[:email].should_not be_nil + end + + it "should track loaded status" do + u = Eventbrite::User.new("fake_key", true) + u.loaded?.should be_false + u.load + u.loaded?.should be_true + end + + it "should track dirty status" do + u = Eventbrite::User.new("fake_key", true) + # Can't be clean until we load + u.dirty?.should be_true + u.load! + u.dirty?.should be_false + u.date_modified = "now" + u.dirty?.should be_false + u.email = "banana" + u.dirty?.should be_true + end +end diff --git a/spec/eventbright_api_faker.rb b/spec/eventbrite_api_faker.rb similarity index 59% rename from spec/eventbright_api_faker.rb rename to spec/eventbrite_api_faker.rb index e92c57e..7016f18 100644 --- a/spec/eventbright_api_faker.rb +++ b/spec/eventbrite_api_faker.rb @@ -5,14 +5,23 @@ def fake_response(call) string << line end end - HTTParty::Response.new(HTTParty::Parser.call(string, :json), string, 200, "") + HTTParty::Response.new(call, FakeResponse.new, HTTParty::Parser.call(string, :json)) end +class FakeResponse + def body + "" + end + def to_hash + {} + end +end -module EventBright + +module Eventbrite class API def self.do_post(string, opts = {}) fake_response(string) end end -end \ No newline at end of file +end diff --git a/spec/eventbrite_spec.rb b/spec/eventbrite_spec.rb new file mode 100644 index 0000000..60b5b0c --- /dev/null +++ b/spec/eventbrite_spec.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + '/spec_helper') + +describe Eventbrite do + before(:each) do + Eventbrite.setup("key") + end + it "should have setup method" do + Eventbrite.should respond_to(:setup) + lambda { + Eventbrite.setup("key") + Eventbrite.setup("key", true) + }.should_not raise_error + end + it "should call httparty with key given to setup" do + Eventbrite::API.should_receive(:do_post).with(anything, hash_including(:body => hash_including(:app_key => "key"))) + Eventbrite.call("event_get", {}) + end + + it "should have call method" do + Eventbrite.should respond_to(:call) + end + it "should have debug! method" do + Eventbrite.should respond_to(:debug!) + end + + it "should replace a user object with a user_key on #call" do + Eventbrite::API.should_receive(:do_post).with("/user_get", {:body => {:app_key => "key", "user_key" => "fake_key"}}) + Eventbrite.call(:user_get, :user => Eventbrite::User.new("fake_key", true)) + end + + it "should format time according to eventbrite's wrong iso8601" do + a = "2010-04-01 13:37:00" + b = Time.parse("4/1/2010 13:37") + a.should == Eventbrite.formatted_time(b) + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0ffed87..45c1035 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,8 @@ $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' -require 'eventbright' -require 'eventbright_api_faker' +require 'eventbrite' +require 'eventbrite_api_faker' require 'spec' require 'spec/autorun' @@ -10,7 +10,7 @@ end -module EventBright +module Eventbrite class Banana < ApiObject; readable :val; end class BananaBunch < ApiObjectCollection collection_for Banana @@ -29,7 +29,7 @@ class Bar < ApiObject plural_name "bazzes" readable :foo updatable :bar, :baz - has :banana => EventBright::Banana - collection :bananas => EventBright::BananaBunch + has :banana => Eventbrite::Banana + collection :bananas => Eventbrite::BananaBunch end -end \ No newline at end of file +end