Sha256: e0d364d788b342984200ae35a06937e5bfdad99332ca95a468ce9eaf587a6f80
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
class OEHClient::Meta::Entity ### ### ------------- Constants ### ### ### ------------- Attributes ### attr_accessor :space # The configured OEHClient::Config::Space object that represents the OEH workspace ### ### ------------- Class Methods ### def self.create() end # def self.create def self.fetch(space, entity_type) url = "#{OEHClient::Helper::Request::ONE_PROTOCOL}#{space.host}#{OEHClient::Helper::Request::THUNDERHEAD_DOMAIN}/one/services/api/#{entity_type.downcase.pluralize}" header = (!space.cookies.nil? ? {:cookies => space.cookies}.merge!(OEHClient::Helper::Request.default_JSON_header()) : OEHClient::Helper::Request.default_JSON_header()) response = OEHClient.get(url, nil, :header => header) end ### ### ------------- Instance Methods ### # add_attribute dynamically creates an attr_accessor for the passed key_value pair either # as a simple value attribute or as an instance of another Node class def add_attribute(name, value) # generate a ruby-friendly attribute accessor based on the name of the # structure attribute accessor_name = name.underscore accessor_name.gsub!(/( )/, '_') if (accessor_name.match(/\s/)) # create the accessor in the current class and set the value based on the type # of object that represents the value self.class.send(:attr_accessor, accessor_name) instance_variable_set("@#{accessor_name}", (value.kind_of?(Hash) ? OEHClient::Data::Node.new(value) : value)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
oeh-client-0.2.2 | lib/oehclient/meta/entity.rb |