class Bitmovin::Webhooks::WebhookSignature

Attributes

key[RW]
type[RW]

Public Class Methods

new(hash = {}) click to toggle source
# File lib/bitmovin/webhooks/webhook_signature.rb, line 3
def initialize(hash = {})
  @errors = []
  hash.each do |name, value|
    instance_variable_set("@#{ActiveSupport::Inflector.underscore(name)}", value)
  end
end

Public Instance Methods

errors() click to toggle source
# File lib/bitmovin/webhooks/webhook_signature.rb, line 21
def errors
  @errors
end
invalid?() click to toggle source
# File lib/bitmovin/webhooks/webhook_signature.rb, line 17
def invalid?
  !valid?
end
to_json(args) click to toggle source
# File lib/bitmovin/webhooks/webhook_signature.rb, line 25
def to_json(args)
  collect_attributes.to_json(args)
end
valid?() click to toggle source
# File lib/bitmovin/webhooks/webhook_signature.rb, line 12
def valid?
  validate!
  @errors.empty?
end

Private Instance Methods

collect_attributes() click to toggle source
# File lib/bitmovin/webhooks/webhook_signature.rb, line 31
def collect_attributes
  val = Hash.new
  [:type, :key].each do |name|
    json_name = ActiveSupport::Inflector.camelize(name.to_s, false)
    val[json_name] = instance_variable_get("@#{name}")
  end
  val
end
validate!() click to toggle source
# File lib/bitmovin/webhooks/webhook_signature.rb, line 40
def validate!
  @errors << "type cannot be blank" if @type.blank?
  @errors << "key cannot be blank" if @key.blank?
end