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 the paging that every list of them arrives in.

Direct Known Subclasses

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oauth: nil, node: {}, includes: {}) ⇒ 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.



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

def initialize(oauth: nil, node: {}, includes: {})
  @oauth = oauth
  @node = node
  @id = node['id']
  @includes = includes
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.



16
17
18
# File 'lib/jbr/resource.rb', line 16

def id
  @id
end