Sha256: 9491ef8f77114f83424789dde7b41d7623cf04badb374475fa2400c096d19e1b

Contents?: true

Size: 517 Bytes

Versions: 10

Compression:

Stored size: 517 Bytes

Contents

module Vhx
  module HelperMethods
    def get_klass
      if self.is_a?(Class)
        self.to_s.split("::").last
      else
        self.class.to_s.split("::").last
      end
    end

    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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vhx-ruby-0.0.12 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.10 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.9 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.8 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.7 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.6 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.5 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.4 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.3 lib/vhx/utilities/vhx_helper.rb
vhx-ruby-0.0.2 lib/vhx/utilities/vhx_helper.rb