lib/intercom/api_operations/load.rb in intercom-2.5.4 vs lib/intercom/api_operations/load.rb in intercom-3.0.0b1

- old
+ new

@@ -1,16 +1,16 @@ module Intercom module ApiOperations module Load - def load - collection_name = Utils.resource_class_to_collection_name(self.class) - if id - response = Intercom.get("/#{collection_name}/#{id}", {}) + def load(object) + collection_name = Utils.resource_class_to_collection_name(collection_class) + if object.id + response = @client.get("/#{collection_name}/#{object.id}", {}) else - raise "Cannot load #{self.class} as it does not have a valid id." + raise "Cannot load #{collection_class} as it does not have a valid id." end raise Intercom::HttpError.new('Http Error - No response entity returned') unless response - from_response(response) + object.from_response(response) end end end end