module Vhx::HelperMethods

Public Instance Methods

get_hypermedia(identifier, klass = nil) click to toggle source
# File lib/vhx/utilities/vhx_helper.rb, line 11
def get_hypermedia(identifier, klass = nil)
  if identifier.class.to_s.match(/Integer|Fixnum/)
    klass ||= get_klass
    return Vhx.client.api_base_url + '/' + klass.downcase + 's' + '/' + identifier.to_s #This url is based purely on VHX's API convention (not nested).
  end

  identifier
end
get_klass() click to toggle source
# File lib/vhx/utilities/vhx_helper.rb, line 3
def get_klass
  if self.is_a?(Class)
    self.to_s.split("::").last
  else
    self.class.to_s.split("::").last
  end
end