Sha256: 9fd00f31bcf59eece12a875054cbde561adcb2479fbc8d6ad7fd7f1cfcf0e2dd

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

module F5
  module Icontrol
    class RAPI
      class Resource
        def initialize(args, credentials)
          @args = args
          @credentials = credentials
        end

        def method_missing(method, *args, &block)
          if @args.key? method.to_s
            return @args[method.to_s]
          end

          potential_collection = "#{method}Reference"
          if @args.key? potential_collection
            link = @args[potential_collection]["link"]
            link.sub! %r{^https?://[A-Za-z0-9\-._]+/}, ""
            return F5::Icontrol::RAPI.new(link, @credentials)
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
f5-icontrol-0.3.7 lib/f5/icontrol/rapi/resource.rb
f5-icontrol-0.3.6 lib/f5/icontrol/rapi/resource.rb