Module: Vhx::HelperMethods
- Included in:
- VhxObject
- Defined in:
- lib/vhx/utilities/vhx_helper.rb
Instance Method Summary collapse
Instance Method Details
#get_hypermedia(identifier, klass = nil) ⇒ Object
11 12 13 14 15 16 17 18 |
# 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 ⇒ Object
3 4 5 6 7 8 9 |
# 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 |