module Croods::Resource::Attributes

Public Instance Methods

attribute_names() click to toggle source
# File lib/croods/resource/attributes.rb, line 46
def attribute_names
  attributes.map { |key, _| key }
end
attributes() click to toggle source
# File lib/croods/resource/attributes.rb, line 42
def attributes
  merged_attributes(self, model.columns_hash)
end
definitions() click to toggle source
# File lib/croods/resource/attributes.rb, line 50
def definitions
  attributes
    .merge(request_instance.additional_attributes)
    .merge(response_instance.additional_attributes)
end
merged_attributes(type, hash = nil) click to toggle source
# File lib/croods/resource/attributes.rb, line 28
def merged_attributes(type, hash = nil)
  (hash || attributes)
    .merge(type.additional_attributes)
    .reject { |name| type.ignored_attributes.include?(name) }
end
request(&block) click to toggle source
# File lib/croods/resource/attributes.rb, line 12
def request(&block)
  request_instance.instance_eval(&block)
end
request_attributes() click to toggle source
# File lib/croods/resource/attributes.rb, line 34
def request_attributes
  merged_attributes(request_instance)
end
request_instance() click to toggle source
# File lib/croods/resource/attributes.rb, line 20
def request_instance
  @request_instance ||= Request.new(ignore_user: user_is_the_owner?)
end
response(&block) click to toggle source
# File lib/croods/resource/attributes.rb, line 16
def response(&block)
  response_instance.instance_eval(&block)
end
response_attributes() click to toggle source
# File lib/croods/resource/attributes.rb, line 38
def response_attributes
  merged_attributes(response_instance)
end
response_instance() click to toggle source
# File lib/croods/resource/attributes.rb, line 24
def response_instance
  @response_instance ||= Response.new
end