Class: OneSignal::Responses::BaseResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/onesignal/responses/base_response.rb

Direct Known Subclasses

CsvExport, Notification, Player

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ BaseResponse

Returns a new instance of BaseResponse.



6
7
8
9
10
11
12
13
14
15
# 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