Class: Grouper::Rest::Client::Resource::Stem

Inherits:
Object
  • Object
show all
Defined in:
lib/grouper-rest-client/resource.rb

Overview

TODO DRY w/ “Group” + “Subject”

Instance Method Summary collapse

Constructor Details

#initialize(resource, json) ⇒ Stem

Returns a new instance of Stem.



179
180
181
182
# File 'lib/grouper-rest-client/resource.rb', line 179

def initialize(resource, json)
  @resource = resource
  @json     = json
end

Instance Method Details

#[](key) ⇒ Object

Return attribute value for key or nil.



185
186
187
188
# File 'lib/grouper-rest-client/resource.rb', line 185

def [](key)
  return @json[key] if @json && @json.key?(key)
  return nil
end

#to_sObject



190
191
192
193
# File 'lib/grouper-rest-client/resource.rb', line 190

def to_s
  return "#{ self.class.name}: #{ @json.keys.sort.collect { |k| "#{ k }=#{ @json[k] }" }.join(', ') }" if @json
  super
end