lib/kentaa/api/resources/action.rb in kentaa-api-0.7.2 vs lib/kentaa/api/resources/action.rb in kentaa-api-0.8.0
- old
+ new
@@ -143,11 +143,11 @@
def end_date
Time.parse(data[:end_date]) if data[:end_date]
end
def activity
- @activity ||= Kentaa::Api::Resources::Activity.new(data[:activity]) if data[:activity]
+ @activity ||= Kentaa::Api::Resources::Activity.new(config, data: data[:activity]) if data[:activity]
end
def previous_participations
data[:previous_participations]
end
@@ -159,15 +159,19 @@
def donate_url
data[:donate_url]
end
def registration_fee
- @registration_fee ||= Kentaa::Api::Resources::RegistrationFee.new(data[:registration_fee])
+ @registration_fee ||= Kentaa::Api::Resources::RegistrationFee.new(data[:registration_fee]) if data[:registration_fee]
end
+ def ticket
+ @ticket ||= Kentaa::Api::Resources::Ticket.new(data[:ticket]) if data[:ticket]
+ end
+
def location
- @location ||= Kentaa::Api::Resources::Location.new(data[:location])
+ @location ||= Kentaa::Api::Resources::Location.new(data[:location]) if data[:location]
end
def photos
@photos ||= begin
photos = []
@@ -238,9 +242,13 @@
@donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Donation, endpoint_path: "/actions/#{id}/donations")
end
def manual_donations
@manual_donations ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::ManualDonation, endpoint_path: "/actions/#{id}/manual-donations")
+ end
+
+ def orders
+ @orders ||= Kentaa::Api::Resources::List.new(config, resource_class: Kentaa::Api::Resources::Order, endpoint_path: "/actions/#{id}/orders")
end
def performances(options = {})
@performances ||= Kentaa::Api::Resources::List.new(config, options.merge(resource_class: Kentaa::Api::Resources::Performance, endpoint_path: "/actions/#{id}/performances"))
end