class Round::Base

Attributes

resource[R]

Public Class Methods

association(name, klass) click to toggle source
# File lib/round/base.rb, line 31
def self.association(name, klass)
  define_method(name) do
    Kernel.const_get(klass).new(resource: @resource.send(name), client: @client).refresh
  end
end
hash_identifier() click to toggle source
# File lib/round/base.rb, line 27
def self.hash_identifier
  "key"
end
new(resource:, client:, **kwargs) click to toggle source
# File lib/round/base.rb, line 5
def initialize(resource:, client:, **kwargs)
  @resource = resource
  @client = client
end

Public Instance Methods

hash_identifier() click to toggle source
# File lib/round/base.rb, line 23
def hash_identifier
  send :[], self.class.hash_identifier
end
method_missing(meth, *args, &block) click to toggle source
# File lib/round/base.rb, line 15
def method_missing(meth, *args, &block)
  @resource.send(meth, *args, &block)
rescue => e
  @resource.attributes.fetch(meth) do
    raise e
  end
end
refresh() click to toggle source
# File lib/round/base.rb, line 10
def refresh
  @resource = @resource.get
  self
end