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.25 lib/tickethub/supplier/message.rb
tickethub-0.3.24 lib/tickethub/supplier/message.rb
tickethub-0.3.23 lib/tickethub/supplier/message.rb
tickethub-0.3.22 lib/tickethub/supplier/message.rb
tickethub-0.3.21 lib/tickethub/supplier/message.rb
tickethub-0.3.20 lib/tickethub/supplier/message.rb
tickethub-0.3.18 lib/tickethub/supplier/message.rb
tickethub-0.3.17 lib/tickethub/supplier/message.rb
tickethub-0.3.16 lib/tickethub/supplier/message.rb
tickethub-0.3.15 lib/tickethub/supplier/message.rb
tickethub-0.3.14 lib/tickethub/supplier/message.rb
tickethub-0.3.13 lib/tickethub/supplier/message.rb
tickethub-0.3.12 lib/tickethub/supplier/message.rb
tickethub-0.3.11 lib/tickethub/supplier/message.rb
tickethub-0.3.9 lib/tickethub/supplier/message.rb