lib/easypost/report.rb in easypost-2.7.0 vs lib/easypost/report.rb in easypost-2.7.1
- old
+ new
@@ -8,14 +8,18 @@
response, api_key = EasyPost.request(:post, url, api_key, params)
return Util.convert_to_easypost_object(response, api_key)
end
def self.retrieve(params, api_key=nil)
- url = "#{self.url}/#{params[:type]}/#{params[:id]}"
- obj_id = params[:id].split("_")[0]
+ id = if params.is_a?(String)
+ params
+ else
+ params[:id]
+ end
- response, api_key = EasyPost.request(:get, url, api_key, params)
- return EasyPost::Util::convert_to_easypost_object(response, api_key) if response
+ instance = self.new(id, api_key)
+ instance.refresh
+ return instance
end
def self.all(filters={}, api_key=nil)
url = "#{self.url}/#{filters[:type]}"