class OdeonApi::Resource

Private Class Methods

build_collection(response, representer) click to toggle source
# File lib/odeon_api/resource.rb, line 13
def self.build_collection(response, representer)
  response.reduce([]) do |resources, res|
    resources << new.extend(representer).from_hash(res)
  end
end
build_single_resource(response, representer) click to toggle source
# File lib/odeon_api/resource.rb, line 8
def self.build_single_resource(response, representer)
  return unless response
  new.extend(representer).from_hash(response)
end

Private Instance Methods

build_for_collection(response, representer) click to toggle source
# File lib/odeon_api/resource.rb, line 19
def build_for_collection(response, representer)
  [].extend(representer.for_collection).from_hash(response)
end