Sha256: 09fac02f05a162298c060e65c7c1f288ea3674b7dc30ec48109979f4d32dc852

Contents?: true

Size: 753 Bytes

Versions: 1

Compression:

Stored size: 753 Bytes

Contents

module Nusii
  module ApiOperations
    class Show < Base

      attr_reader :resource_class, :resource_id, :options

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

    private

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

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

      def resource_path
        (resource_class.respond_to?(:resource_path) && resource_class.resource_path) ||
        "/api/v2/#{resource_url_string}/#{resource_id}"
      end


    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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