class Lurch::URIBuilder
Attributes
inflector[R]
Public Class Methods
new(inflector)
click to toggle source
# File lib/lurch/uri_builder.rb, line 3 def initialize(inflector) @inflector = inflector end
Public Instance Methods
relationship_uri(type, id, relationship_key)
click to toggle source
# File lib/lurch/uri_builder.rb, line 21 def relationship_uri(type, id, relationship_key) resource = inflector.encode_type(type) relationship = inflector.encode_key(relationship_key) uri = ::URI.parse("#{resource}/#{id}/relationships/#{relationship}") uri.to_s end
resource_uri(type, id, query = "")
click to toggle source
# File lib/lurch/uri_builder.rb, line 14 def resource_uri(type, id, query = "") resource = inflector.encode_type(type) uri = ::URI.parse("#{resource}/#{id}") uri.query = query unless query.empty? uri.to_s end
resources_uri(type, query = "")
click to toggle source
# File lib/lurch/uri_builder.rb, line 7 def resources_uri(type, query = "") resource = inflector.encode_type(type) uri = ::URI.parse(resource) uri.query = query unless query.empty? uri.to_s end