Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove necessity of valid resource to concat urls

  • Loading branch information...
commit 04fecc036c0c9f2f432735631f3bde73a02333b1 1 parent 4dabd15
@theganyo authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/usergrid/extensions/response.rb
View
15 lib/usergrid/extensions/response.rb
@@ -28,7 +28,7 @@ def entities_data
entities_data = data['entities'] || data['data'] || data['messages'] || data['list']
raise "unable to determine entities from: #{data}" unless entities_data.is_a?(Array)
entities_data.each do |e|
- e['uri'] = resource.concat_urls(data['uri'], e['uuid']) if e.is_a?(Hash) && e['uuid']
+ e['uri'] = concat_urls(data['uri'], e['uuid']) if e.is_a?(Hash) && e['uuid']
end
@entities_data = entities_data
end
@@ -64,5 +64,18 @@ def entity_data
def entity
Usergrid::Entity.new entity_data['uri'], resource.api_url, resource.options, self
end
+
+ protected
+
+ def concat_urls(url, suburl) # :nodoc:
+ url = url.to_s
+ suburl = suburl.to_s
+ if url.slice(-1, 1) == '/' or suburl.slice(0, 1) == '/'
+ url + suburl
+ else
+ "#{url}/#{suburl}"
+ end
+ end
+
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.