class Rsbe::Client::Collection
Class simplifies interaction with RSBE Partner
resources
Public Class Methods
all()
click to toggle source
# File lib/rsbe/client/collection.rb, line 7 def self.all emsg = 'Method not supported. Access via Rsbe::Client::Partner#collections' fail Rsbe::Client::MethodNotImplementedError, emsg end
all_attrs()
click to toggle source
# File lib/rsbe/client/collection.rb, line 24 def self.all_attrs rw_attrs + ro_attrs end
base_path()
click to toggle source
Calls superclass method
Rsbe::Client::Base::base_path
# File lib/rsbe/client/collection.rb, line 12 def self.base_path super + '/colls' end
new(vals = {})
click to toggle source
Calls superclass method
Rsbe::Client::Base::new
# File lib/rsbe/client/collection.rb, line 61 def initialize(vals = {}) fail(ArgumentError, 'Constructor requires a Hash') unless vals.is_a?(Hash) super() @hash = {} @response = nil # initialize local hash with incoming values, restrict to RW attrs self.class.rw_attrs.each { |x| @hash[x] = (vals[x] || vals[x.to_s]) } end
ro_attrs()
click to toggle source
# File lib/rsbe/client/collection.rb, line 20 def self.ro_attrs [:created_at, :updated_at, :lock_version] end
rw_attrs()
click to toggle source
# File lib/rsbe/client/collection.rb, line 16 def self.rw_attrs [:id, :code, :partner_id, :coll_type, :quota, :name, :rel_path] end
Public Instance Methods
create_path()
click to toggle source
# File lib/rsbe/client/collection.rb, line 71 def create_path fail 'partner_id not initialized!' unless partner_id Rsbe::Client::Partner.item_path(partner_id) end
ses()
click to toggle source
# File lib/rsbe/client/collection.rb, line 76 def ses fail 'Error getting source entities' unless get_children('ses') JSON.parse(@response.body).collect do |json_hash| Rsbe::Client::Se.new(json_hash) end end