Module: Jbr::Includable

Included in:
Jobs, Visits
Defined in:
lib/jbr/includable.rb

Overview

Extends a list of records with the chaining that says what to bring back beside them. Nothing extra comes back unasked: a page costs what it carries.

Instance Method Summary collapse

Instance Method Details

#includes(*names) ⇒ Resource

Returns the same list, asking Jobber for those too.

Parameters:

  • names (Array<Symbol, Hash>)

    :client, :property, or property: :client for the client whose file the place sits on.

Returns:

  • (Resource)

    the same list, asking Jobber for those too.



8
9
10
11
12
13
# File 'lib/jbr/includable.rb', line 8

def includes(*names)
  named = names.each_with_object({}) do |name, all|
    name.is_a?(Hash) ? all.merge!(name) : all[name] = nil
  end
  self.class.new oauth: @oauth, includes: @includes.merge(named)
end