lib/kentaa/api/resources/project.rb in kentaa-api-0.3.2 vs lib/kentaa/api/resources/project.rb in kentaa-api-0.4.0

- old
+ new

@@ -82,20 +82,20 @@ def donate_url data[:donate_url] end def location - @location ||= Kentaa::Api::Resources::Location.new(config, data: data[:location]) + @location ||= Kentaa::Api::Resources::Location.new(data[:location]) if data[:location] end def photos @photos ||= begin photos = [] if data[:photos] data[:photos].each do |photo| - photos << Kentaa::Api::Resources::Photo.new(config, data: photo) + photos << Kentaa::Api::Resources::Photo.new(photo) end end photos end @@ -105,11 +105,11 @@ @videos ||= begin videos = [] if data[:videos] data[:videos].each do |video| - videos << Kentaa::Api::Resources::Video.new(config, data: video) + videos << Kentaa::Api::Resources::Video.new(video) end end videos end @@ -119,32 +119,40 @@ @questions ||= begin questions = [] if data[:questions] data[:questions].each do |question| - questions << Kentaa::Api::Resources::Question.new(config, data: question) + questions << Kentaa::Api::Resources::Question.new(question) end end questions end end def consent - @consent ||= Kentaa::Api::Resources::Consent.new(config, data: data[:consent]) if data[:consent] + @consent ||= Kentaa::Api::Resources::Consent.new(data[:consent]) if data[:consent] end def contact - @contact ||= Kentaa::Api::Resources::Contact.new(config, data: data[:contact]) if data[:contact] + @contact ||= Kentaa::Api::Resources::Contact.new(data[:contact]) if data[:contact] end def external_reference data[:external_reference] end - protected + def donations + @donations ||= Kentaa::Api::Resources::Donations.new(config, project_id: id) + end - def load_resource(options) + def manual_donations + @manual_donations ||= Kentaa::Api::Resources::ManualDonations.new(config, project_id: id) + end + + private + + def load_resource request.get("/projects/#{id}", options) end end end end