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.66 lib/tickethub/supplier/message.rb
tickethub-0.3.65 lib/tickethub/supplier/message.rb
tickethub-0.3.64 lib/tickethub/supplier/message.rb
tickethub-0.3.63 lib/tickethub/supplier/message.rb
tickethub-0.3.62 lib/tickethub/supplier/message.rb
tickethub-0.3.61 lib/tickethub/supplier/message.rb
tickethub-0.3.60 lib/tickethub/supplier/message.rb
tickethub-0.3.59 lib/tickethub/supplier/message.rb
tickethub-0.3.58 lib/tickethub/supplier/message.rb
tickethub-0.3.57 lib/tickethub/supplier/message.rb
tickethub-0.3.56 lib/tickethub/supplier/message.rb
tickethub-0.3.55 lib/tickethub/supplier/message.rb
tickethub-0.3.54 lib/tickethub/supplier/message.rb
tickethub-0.3.53 lib/tickethub/supplier/message.rb
tickethub-0.3.52 lib/tickethub/supplier/message.rb
tickethub-0.3.51 lib/tickethub/supplier/message.rb
tickethub-0.3.50 lib/tickethub/supplier/message.rb
tickethub-0.3.49 lib/tickethub/supplier/message.rb
tickethub-0.3.47 lib/tickethub/supplier/message.rb
tickethub-0.3.46 lib/tickethub/supplier/message.rb