Sha256: 1daf220b9f7c8605f5e7bb7b2c32ff3396d8280c0e4527617441e86647c43e61

Contents?: true

Size: 761 Bytes

Versions: 3

Compression:

Stored size: 761 Bytes

Contents

module RestApi
  # An object which can return info about the REST API
  class Info < RestApi::Base
    include RestApi::Cacheable

    self.element_name = 'api'
    allow_anonymous
    singleton

    self.format = Class.new(OpenshiftJsonFormat) do
      def decode(json)
        ActiveSupport::JSON.decode(json)
      end
    end.new

    schema do
      string :version, :status
    end
    has_many :supported_api_versions, :class_name => 'string'
    has_one :data, :class_name => 'rest_api/base/attribute_hash'

    def url
      self.class.site
    end
    def link(name)
      URI.parse(data[name]['href']) if data[name]
    end
    def required_params(name)
      data[name]['required_params'] if data[name]
    end

    cache_find_method :one
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openshift-origin-console-1.3.4 app/models/rest_api/info.rb
openshift-origin-console-1.3.3 app/models/rest_api/info.rb
openshift-origin-console-1.3.2 app/models/rest_api/info.rb