Sha256: 266ac8bf7b5a07afb7663c216169bd9e4c4e0ea0601e71c1abbf550d8edd23b0

Contents?: true

Size: 1.07 KB

Versions: 17

Compression:

Stored size: 1.07 KB

Contents

# coding: utf-8
# frozen_string_literal: true

class SampleMessage

  def initialize(service:)
    @service = service
    @base_message = Stealth::ServiceMessage.new(service: @service)
    @base_message.sender_id = sender_id
    @base_message.timestamp = timestamp
    @base_message
  end

  def message_with_text
    @base_message.message = message
    @base_message
  end

  def message_with_payload
    @base_message.payload = payload
    @base_message
  end

  def message_with_location
    @base_message.location = location
    @base_message
  end

  def message_with_attachments
    @base_message.attachments = attachments
    @base_message
  end

  def sender_id
    if @service == 'twilio'
      '+15554561212'
    else
      "8b3e0a3c-62f1-401e-8b0f-615c9d256b1f"
    end
  end

  def timestamp
    Time.now
  end

  def message
    "Hello World!"
  end

  def payload
    "some_payload"
  end

  def location
    { lat: '42.323724' , lng: '-83.047543' }
  end

  def attachments
    [ { type: 'image', url: 'https://domain.none/image.jpg' } ]
  end

  def referral
    {}
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
stealth-2.0.0.beta7 spec/support/sample_messages.rb
stealth-2.0.0.beta6 spec/support/sample_messages.rb
stealth-2.0.0.beta5 spec/support/sample_messages.rb
stealth-2.0.0.beta4 spec/support/sample_messages.rb
stealth-2.0.0.beta3 spec/support/sample_messages.rb
stealth-2.0.0.beta2 spec/support/sample_messages.rb
stealth-2.0.0.beta1 spec/support/sample_messages.rb
stealth-1.1.6 spec/support/sample_messages.rb
stealth-1.1.5 spec/support/sample_messages.rb
stealth-1.1.4 spec/support/sample_messages.rb
stealth-1.1.3 spec/support/sample_messages.rb
stealth-1.1.2 spec/support/sample_messages.rb
stealth-1.1.1 spec/support/sample_messages.rb
stealth-1.1.0 spec/support/sample_messages.rb
stealth-1.1.0.rc3 spec/support/sample_messages.rb
stealth-1.1.0.rc2 spec/support/sample_messages.rb
stealth-1.1.0.rc1 spec/support/sample_messages.rb