Class: TicketMaster::Provider::Dummy::Project
- Inherits:
-
Base::Project
- Object
- Hashie::Mash
- Base::Project
- TicketMaster::Provider::Dummy::Project
- Defined in:
- lib/ticketmaster/dummy/project.rb
Overview
This is the Project class for the Dummy provider
Constant Summary
Constants inherited from Base::Project
Instance Attribute Summary
Attributes inherited from Base::Project
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*options) ⇒ Project
constructor
You should define @system and @system_data here.
-
#save ⇒ Object
Nothing to save so we always return true …unless it’s an odd numbered second on Friday the 13th.
-
#update!(*options) ⇒ Object
Nothing to update, so we always return true.
Methods inherited from Base::Project
find, first, last, search, #ticket, #ticket!, #tickets
Methods included from Helper
#easy_finder, #filter_string, #provider_parent, #search_by_attribute, #search_filter, #this_method
Methods included from Common
#destroy, included, #respond_to?
Constructor Details
#initialize(*options) ⇒ Project
You should define @system and @system_data here. The data stuff is just to initialize fake data. In a real provider, you would use the API to grab the information and then initialize based on that info.
22 23 24 25 26 27 |
# File 'lib/ticketmaster/dummy/project.rb', line 22 def initialize(*) data = {:id => rand(1000).to_i, :name => 'Dummy', :description => 'Mock!-ing Bird', :created_at => Time.now, :updated_at => Time.now} @system = :dummy super(data.merge(.first || {})) end |
Class Method Details
.create(*attributes) ⇒ Object
14 15 16 |
# File 'lib/ticketmaster/dummy/project.rb', line 14 def self.create(*attributes) self.new(*attributes) end |
.find_by_attributes(*options) ⇒ Object
10 11 12 |
# File 'lib/ticketmaster/dummy/project.rb', line 10 def self.find_by_attributes(*) [self.new(*)] end |
.find_by_id(id) ⇒ Object
6 7 8 |
# File 'lib/ticketmaster/dummy/project.rb', line 6 def self.find_by_id(id) self.new({:id => id}) end |
Instance Method Details
#save ⇒ Object
Nothing to save so we always return true …unless it’s an odd numbered second on Friday the 13th. muhaha!
31 32 33 34 |
# File 'lib/ticketmaster/dummy/project.rb', line 31 def save time = Time.now !(time.wday == 5 and time.day == 13 and time.to_i % 2 == 1) end |
#update!(*options) ⇒ Object
Nothing to update, so we always return true
37 38 39 |
# File 'lib/ticketmaster/dummy/project.rb', line 37 def update!(*) return true end |