Sha256: d849e1e1e667e900c7840f66b9f1d8d26445e465862d64872533f637b969c739

Contents?: true

Size: 877 Bytes

Versions: 55

Compression:

Stored size: 877 Bytes

Contents

require_relative '../resource'

module Tickethub
  class Supplier::Message < Resource
    path '/supplier/messages'

    require_relative 'user'
    require_relative 'message/email'
    require_relative 'message/sms'
    require_relative '../contact'

    association :user, Supplier::User
    association :contact, Tickethub::Contact
    association :customer, Supplier::Customer

    association :context, -> (endpoint, attributes) {
      case attributes['object']
        when 'booking'  then Supplier::Booking.call(endpoint, attributes)
        when 'customer' then Supplier::Customer.call(endpoint, attributes)
        when 'order'    then Supplier::Order.call(endpoint, attributes)
        when 'reseller' then Supplier::Reseller.call(endpoint, attributes)
      end
    }

    attribute :created_at, type: :datetime

    collection :replies, Supplier::Message
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
tickethub-0.3.45 lib/tickethub/supplier/message.rb
tickethub-0.3.44 lib/tickethub/supplier/message.rb
tickethub-0.3.43 lib/tickethub/supplier/message.rb
tickethub-0.3.42 lib/tickethub/supplier/message.rb
tickethub-0.3.41 lib/tickethub/supplier/message.rb
tickethub-0.3.40 lib/tickethub/supplier/message.rb
tickethub-0.3.39 lib/tickethub/supplier/message.rb
tickethub-0.3.38 lib/tickethub/supplier/message.rb
tickethub-0.3.37 lib/tickethub/supplier/message.rb
tickethub-0.3.36 lib/tickethub/supplier/message.rb
tickethub-0.3.35 lib/tickethub/supplier/message.rb
tickethub-0.3.34 lib/tickethub/supplier/message.rb
tickethub-0.3.33 lib/tickethub/supplier/message.rb
tickethub-0.3.32 lib/tickethub/supplier/message.rb
tickethub-0.3.31 lib/tickethub/supplier/message.rb
tickethub-0.3.30 lib/tickethub/supplier/message.rb
tickethub-0.3.29 lib/tickethub/supplier/message.rb
tickethub-0.3.28 lib/tickethub/supplier/message.rb
tickethub-0.3.27 lib/tickethub/supplier/message.rb
tickethub-0.3.26 lib/tickethub/supplier/message.rb