This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Grzegorz Witek = 104 | |
Dirkjan Bussink = 84 | |
Konstantin Tennhard = 74 | |
Pat Shaughnessy = 74 | |
Benjamin Smith = 72 | |
Daniel Lobato García = 59 | |
Josep M. Bach = 56 | |
Javier Ramírez = 56 | |
Alexandre de Oliveira = 52 | |
Alexey Vasiliev = 49 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VendorBooker | |
# This class is responsible for calling the appropriate translation mechanism to convert a CRM Trip | |
# into the appropriate format to book | |
# | |
# It also translates the response into a CRM Booking object to persist to the database | |
def initialize(trip, vendor, credentials) | |
@trip = trip | |
@vendor = vendor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TripBooker | |
# Given a trip and a list of vendors, this class makes bookings for all the vendors | |
def initialize(trip, vendors = :all) | |
@trip = trip | |
@vendors = VendorSelector.new(vendors).all | |
@credentials = CredentialSelector.get_available_credentials | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActivityLog | |
include DataMapper::Resource | |
property :id, Serial | |
property :type, Discriminator | |
property :model_id, Integer | |
property :event, String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
include DataMapper::Resource | |
include ActivityLogger | |
log_with :foo_activity_log | |
# ...snip ... | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActivityLogger | |
include ActiveSupport | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods | |
def log_with(model_name, options = {}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FoosController < ActionController::Base | |
# ..snip .. | |
def create | |
@foo = Foo.new(params[:foo]) | |
@foo.save_with_log(current_user) | |
# ... | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActivityLog | |
include DataMapper::Resource | |
property :id, Serial | |
property :type, Discriminator | |
property :model_id, Integer | |
property :event, String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# following are extracts from the relevant classes and not real Ruby code. | |
class Foo | |
belongs_to :user | |
end | |
class User | |
has n, :foos | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Quotation | |
# ...snip... | |
# methods to be forwarded to the status policy class | |
def self.status_policy_methods | |
[:unconfirmed?, :expirable?, :approvable?, :rejectable?, :poolable?, :on_holdable?, :payable?, :callbackable?, :sendable?] | |
end | |
# methods to be forwarded to workflow class |