lib/ecoportal/api/v1/people.rb in ecoportal-api-0.1.1 vs lib/ecoportal/api/v1/people.rb in ecoportal-api-0.1.2
- old
+ new
@@ -1,10 +1,11 @@
require 'ecoportal/api/common/doc_helpers'
module Ecoportal
module API
class V1
class People
+ include Enumerable
include Common::DocHelpers
attr_reader :client
def initialize(client)
@client = client
@@ -22,12 +23,12 @@
page += 1
end
self
end
- def get(id)
- response = @client.get("/people/"+CGI::escape(id))
+ def get(doc)
+ response = @client.get("/people/"+CGI::escape(get_id(doc)))
Common::WrappedResponse.new(response, person_class)
end
def get_all(params: {})
each(params).to_a
@@ -59,9 +60,13 @@
end
def delete(doc)
id = get_id(doc)
@client.delete("/people/"+CGI::escape(id))
+ end
+
+ def new
+ person_class.new
end
private
def person_class