Sha256: 1bccdfa405971c056d41634fe8b692ae81d548f24eb49ae49585fa0734719144

Contents?: true

Size: 972 Bytes

Versions: 31

Compression:

Stored size: 972 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, options = {}, params = {}) {
      case attributes['object']
        when 'Booking'  then Supplier::Booking.call(endpoint, attributes, options, params)
        when 'Customer' then Supplier::Customer.call(endpoint, attributes, options, params)
        when 'Order'    then Supplier::Order.call(endpoint, attributes, options, params)
        when 'Reseller' then Supplier::Reseller.call(endpoint, attributes, options, params)
      end
    }

    attribute :created_at, type: :datetime

    collection :replies, Supplier::Message
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
tickethub-0.3.100 lib/tickethub/supplier/message.rb
tickethub-0.3.99 lib/tickethub/supplier/message.rb
tickethub-0.3.98 lib/tickethub/supplier/message.rb
tickethub-0.3.97 lib/tickethub/supplier/message.rb
tickethub-0.3.96 lib/tickethub/supplier/message.rb
tickethub-0.3.95 lib/tickethub/supplier/message.rb
tickethub-0.3.94 lib/tickethub/supplier/message.rb
tickethub-0.3.93 lib/tickethub/supplier/message.rb
tickethub-0.3.92 lib/tickethub/supplier/message.rb
tickethub-0.3.91 lib/tickethub/supplier/message.rb
tickethub-0.3.90 lib/tickethub/supplier/message.rb
tickethub-0.3.89 lib/tickethub/supplier/message.rb
tickethub-0.3.88 lib/tickethub/supplier/message.rb
tickethub-0.3.87 lib/tickethub/supplier/message.rb
tickethub-0.3.86 lib/tickethub/supplier/message.rb
tickethub-0.3.85 lib/tickethub/supplier/message.rb
tickethub-0.3.84 lib/tickethub/supplier/message.rb
tickethub-0.3.82 lib/tickethub/supplier/message.rb
tickethub-0.3.81 lib/tickethub/supplier/message.rb
tickethub-0.3.80 lib/tickethub/supplier/message.rb