class Rsbe::Client::Provider

Public Class Methods

all_attrs() click to toggle source
# File lib/rsbe/client/provider.rb, line 26
def self.all_attrs
  self.rw_attrs + self.ro_attrs
end
base_path() click to toggle source
Calls superclass method Rsbe::Client::Base::base_path
# File lib/rsbe/client/provider.rb, line 7
def self.base_path
  super + '/providers'
end
new(vals = {}) click to toggle source
Calls superclass method Rsbe::Client::Base::new
# File lib/rsbe/client/provider.rb, line 36
def initialize(vals = {})
  raise ArgumentError.new("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/provider.rb, line 22
def self.ro_attrs
  [:created_at, :updated_at, :lock_version]
end
rw_attrs() click to toggle source

implementation objectives:

  • expose attributes via standard setter/getter methods

  • create getters for all Read-Only (RO) attributes

  • create setters only for Read/Write (RW) attributes

  • use hash for internal representation to simplify passing data back and forth to back end app

# File lib/rsbe/client/provider.rb, line 18
def self.rw_attrs
  [:id, :name]
end