Sha256: ca262e94e92fe53007c199c668e25cc4a5824ece1ce5ad01f8dfd9ba863f95be

Contents?: true

Size: 623 Bytes

Versions: 1

Compression:

Stored size: 623 Bytes

Contents

module Nusii
  module ApiOperations
    class Update < Base

      attr_reader :resource_class, :resource

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

    private

      def response
        @response ||= connection.put 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}/#{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/update.rb