class OneSignal::Responses::BaseResponse

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/onesignal/responses/base_response.rb, line 6
def initialize attributes = {}
  @attributes = attributes.deep_symbolize_keys
                          .keep_if { |k, _v| self.class::ATTRIBUTES_WHITELIST.include?(k.to_sym) }

  self.class::ATTRIBUTES_WHITELIST.each do |attribute|
    self.class.send(:define_method, attribute) do
      @attributes[attribute]
    end
  end
end