efexen/messenger_platform

View on GitHub
lib/messenger_platform/attachment.rb

Summary

Maintainability
A
0 mins
Test Coverage
class MessengerPlatform::Attachment

  VALID_TYPES = %w(image video audio)

  attr_reader :url, :type

  def initialize(hash)
    @url = hash[:url]
    @type = hash[:type]
  end

  VALID_TYPES.each do |valid_type|
    define_method "#{valid_type}?" do
      type == valid_type
    end
  end

end