Class: TicketMaster::Provider::Dummy::Ticket
- Inherits:
-
Base::Ticket
- Object
- Hashie::Mash
- Base::Ticket
- TicketMaster::Provider::Dummy::Ticket
- Defined in:
- lib/ticketmaster/dummy/ticket.rb
Overview
The Dummy Provider’s Ticket class
Constant Summary
Constants inherited from Base::Ticket
Instance Attribute Summary
Attributes inherited from Base::Ticket
Class Method Summary collapse
Instance Method Summary collapse
-
#close ⇒ Object
Nothing to close, so we always return true.
-
#destroy ⇒ Object
Nothing to destroy so we always return true.
-
#initialize(project_id, *options) ⇒ Ticket
constructor
You don’t need to define an initializer, this is only here to initialize dummy data.
-
#save ⇒ Object
Nothing to save so we always return true …unless it’s the Ides of March and the second is divisible by three.
Methods inherited from Base::Ticket
#comment, #comment!, #comments, find, first, last, #reload!, search
Methods included from Helper
#easy_finder, #filter_string, #provider_parent, #search_by_attribute, #search_filter, #this_method
Methods included from Common
included, #respond_to?, #update!
Constructor Details
#initialize(project_id, *options) ⇒ Ticket
You don’t need to define an initializer, this is only here to initialize dummy data
16 17 18 19 20 21 22 23 |
# File 'lib/ticketmaster/dummy/ticket.rb', line 16 def initialize(project_id, *) data = {:id => rand(1000), :status => ['lol', 'rofl', 'lmao', 'lamo', 'haha', 'heh'][rand(6)], :priority => rand(10), :summary => 'Tickets ticket ticket ticket', :resolution => false, :created_at => Time.now, :updated_at => Time.now, :description => 'Ticket ticket ticket ticket laughing', :assignee => 'lol-man', :project_id => project_id} @system = :dummy super(data.merge(.first || {})) end |
Class Method Details
.find_by_attributes(*ticket_attributes) ⇒ Object
11 12 13 |
# File 'lib/ticketmaster/dummy/ticket.rb', line 11 def self.find_by_attributes(*ticket_attributes) [self.new(*ticket_attributes)] end |
.find_by_id(project_id, ticket_id) ⇒ Object
7 8 9 |
# File 'lib/ticketmaster/dummy/ticket.rb', line 7 def self.find_by_id(project_id, ticket_id) self.new(project_id, {:id => ticket_id}) end |
Instance Method Details
#close ⇒ Object
Nothing to close, so we always return true
33 34 35 |
# File 'lib/ticketmaster/dummy/ticket.rb', line 33 def close true end |
#destroy ⇒ Object
Nothing to destroy so we always return true
38 39 40 |
# File 'lib/ticketmaster/dummy/ticket.rb', line 38 def destroy true end |
#save ⇒ Object
Nothing to save so we always return true …unless it’s the Ides of March and the second is divisible by three. muhaha!
27 28 29 30 |
# File 'lib/ticketmaster/dummy/ticket.rb', line 27 def save time = Time.now !(time.wday == 15 and time.day == 3 and time.to_i % 3 == 0) end |