Sha256: e7e105abb3163637f03d9a54f596c63a492ad6544676301d4b19ca012cbd7f4d

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

module Nusii
  module ApiOperations
    class Create < Base

      attr_reader :resource_class, :resource

      def initialize resource_class, resource
        @resource_class = resource_class
        @resource       = resource
      end

    private

      def response
        @response ||= connection.post resource_path, resource.save_params.to_json
      end

      def build_ok_response
        builder = Utils::JsonApiBuilder.new(parsed_body['data'], parsed_body['included'])
        builder.call
      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/create.rb