Class: OpenTox::Feature

Inherits:
OpenTox show all
Defined in:
lib/opentox-ruby-api-wrapper.rb

Instance Attribute Summary

Attributes inherited from OpenTox

#uri

Instance Method Summary collapse

Methods inherited from OpenTox

#destroy, #finished?, #name, #uri_escape

Constructor Details

#initialize(params) ⇒ Feature

Initialize with :uri => uri, or :name => name, :values => hash_of_property_names_and_values



76
77
78
79
80
81
82
83
84
85
# File 'lib/opentox-ruby-api-wrapper.rb', line 76

def initialize(params)
  if params[:uri]
    @uri = params[:uri].to_s
  else
    @uri = ENV['OPENTOX_FEATURE'] + uri_escape(params[:name]) 
    params[:values].each do |k,v|
      @uri += '/' + k.to_s + '/' + v.to_s
    end
  end
end

Instance Method Details

#value(property) ⇒ Object

Get the value of a property



88
89
90
# File 'lib/opentox-ruby-api-wrapper.rb', line 88

def value(property)
  RestClient.get @uri + '/' + property
end