class ApRubySdk::Collection

Attributes

items[RW]
pagination[RW]

Public Class Methods

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

Public Instance Methods

attributes=(attributes) click to toggle source
# File lib/ap_ruby_sdk/collection.rb, line 14
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
pagination=(pagination) click to toggle source
# File lib/ap_ruby_sdk/collection.rb, line 6
def pagination=(pagination)
  @pagination = Pagination.new(pagination)
end
to_json() click to toggle source
# File lib/ap_ruby_sdk/collection.rb, line 27
def to_json
  hash = {}
  instance_variables.each { |var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
  hash.to_json
end