Class: Jbr::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/jbr/resource.rb

Overview

What every Jobber resource shares: the node Jobber answered with, the credentials it was read through, and what a list of them was asked and narrowed to.

Direct Known Subclasses

Account, Client, Invoice, Job, Jobs, LineItem, Property, Quote, Request, Visit, Visits

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oauth: nil, node: {}, includes: {}, filter: nil) ⇒ Resource

Returns a new instance of Resource.

Parameters:

  • oauth (OAuth) (defaults to: nil)

    the credentials to reach Jobber with, where reaching it is needed.

  • node (Hash) (defaults to: {})

    the record as Jobber answered it.

  • includes (Hash) (defaults to: {})

    what a list was asked to bring back beside its records.

  • filter (Hash) (defaults to: nil)

    what a list was narrowed to, in the shape Jobber filters by.



9
10
11
12
13
14
15
# File 'lib/jbr/resource.rb', line 9

def initialize(oauth: nil, node: {}, includes: {}, filter: nil)
  @oauth = oauth
  @node = node
  @id = node['id']
  @includes = includes
  @filter = filter
end

Instance Attribute Details

#idString? (readonly)

Returns the Jobber ID, from the node it came in or once one was created.

Returns:

  • (String, nil)

    the Jobber ID, from the node it came in or once one was created.



18
19
20
# File 'lib/jbr/resource.rb', line 18

def id
  @id
end