lib/pact_broker/resources/pacticipants.rb in pact_broker-0.0.5 vs lib/pact_broker/resources/pacticipants.rb in pact_broker-0.0.6
- old
+ new
@@ -1,39 +1,26 @@
-require 'webmachine'
-require 'json'
+require 'pact_broker/resources/base_resource'
-require 'pact_broker/services'
-require 'pact_broker/resources/json_resource'
-require 'pact_broker/api/representors'
-
module PactBroker
module Resources
- class Pacticipants < Webmachine::Resource
+ class Pacticipants < BaseResource
- include PactBroker::Services
- include PactBroker::Resources::PathInfo
-
def content_types_provided
[["application/hal+json", :to_json]]
end
- def handle_exception e
- PactBroker::Resources::ErrorHandler.handle_exception(e, response)
- end
-
def allowed_methods
["GET"]
end
def to_json
generate_json(pacticipant_service.find_all_pacticipants)
end
def generate_json pacticipants
- pacticipants.extend(PactBroker::Api::Representors::PacticipantCollectionRepresenter)
- pacticipants.to_json
+ PactBroker::Api::Decorators::PacticipantCollectionRepresenter.new(pacticipants, request_base_url).to_json
end
end
end