Sha256: 9174b52fea956618bd08a838095816ef8b8186d5b7e852dd0a869fe29301f7f6

Contents?: true

Size: 1.13 KB

Versions: 12

Compression:

Stored size: 1.13 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

  private

    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

12 entries across 12 versions & 1 rubygems

Version Path
stealth-1.0.4 spec/support/sample_messages.rb
stealth-1.0.3 spec/support/sample_messages.rb
stealth-1.0.2 spec/support/sample_messages.rb
stealth-1.0.1 spec/support/sample_messages.rb
stealth-1.0.0 spec/support/sample_messages.rb
stealth-1.0.0.rc1 spec/support/sample_messages.rb
stealth-1.0.0.pre2 spec/support/sample_messages.rb
stealth-1.0.0.pre1 spec/support/sample_messages.rb
stealth-0.10.6 spec/support/sample_messages.rb
stealth-0.10.5 spec/support/sample_messages.rb
stealth-0.10.4 spec/support/sample_messages.rb
stealth-0.10.3 spec/support/sample_messages.rb