class ApRubySdk::BaseModel

Attributes

created[RW]
id[RW]
mode[RW]
updated[RW]

Public Class Methods

new(attributes={}) click to toggle source
# File lib/ap_ruby_sdk/base_model.rb, line 8
def initialize(attributes={})
  self.attributes = attributes
end

Public Instance Methods

attributes=(attributes) click to toggle source
# File lib/ap_ruby_sdk/base_model.rb, line 12
def attributes=(attributes)
  if attributes.respond_to?(:each)
    attributes.each do |key, value|
      writer = (key == 'type' ? 'kind=' : "#{key}=")
      if respond_to?(writer)
        send(writer, value)
      end
    end
  else
    attributes
  end
end
to_json() click to toggle source
# File lib/ap_ruby_sdk/base_model.rb, line 25
def to_json
  hash = {}
  instance_variables.each { |var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
  hash.to_json
end