Sha256: 1a2572b7b876511444ad4f03b4118f14f216108ac35ca01c5b64b24669950bec

Contents?: true

Size: 730 Bytes

Versions: 1

Compression:

Stored size: 730 Bytes

Contents

module Nusii
  module ApiOperations
    class Index < Base

      attr_reader :resource_class, :options

      def initialize resource_class, options={}
        @resource_class = resource_class
        @options        = options
      end

    private

      def response
        @response ||= connection.get resource_path, options
      end

      def build_ok_response
        ResponseObject.new(resources, meta, resource_class)
      end

      def resources
        builder = Utils::JsonApiBuilder.new(parsed_body['data'], parsed_body['included'])
        builder.call
      end

      def meta
        parsed_body['meta']
      end

      def resource_path
        "/api/v2/#{resource_url_string}"
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nusii-0.1.1 lib/nusii/api_operations/index.rb