Class: Jbr::Mock::OAuth

Inherits:
OAuth
  • Object
show all
Defined in:
lib/jbr/mock/oauth.rb

Overview

Credentials that answer from Jbr.mock instead of Jobber.

Constant Summary

Constants inherited from OAuth

OAuth::DISCONNECT_MUTATION

Instance Attribute Summary

Attributes inherited from OAuth

#access_token, #account_id, #expires_at, #invalid_at, #refresh_token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OAuth

client_id, client_secret, #clients, create, #initialize, #query

Constructor Details

This class inherits a constructor from Jbr::OAuth

Class Method Details

.post(_) ⇒ Hash

Returns canned credentials, unless the app asked for a refusal.

Returns:

  • (Hash)

    canned credentials, unless the app asked for a refusal.

Raises:



16
17
18
19
20
# File 'lib/jbr/mock/oauth.rb', line 16

def self.post(_)
  raise Error, Jbr.mock.oauth_error if Jbr.mock.oauth_error

  { access_token: 'mock-token', refresh_token: 'mock-token', expires_at: (Time.now + 3600) }
end

Instance Method Details

#accountObject



9
# File 'lib/jbr/mock/oauth.rb', line 9

def  = Mock::Account.new oauth: self

#deleteObject

Revoking a mocked token asks nobody.



13
# File 'lib/jbr/mock/oauth.rb', line 13

def delete; end

#invoicesObject

The mocked resources these credentials read and write.



5
# File 'lib/jbr/mock/oauth.rb', line 5

def invoices = Mock::Invoice.new(oauth: self)

#jobsObject



6
# File 'lib/jbr/mock/oauth.rb', line 6

def jobs = Mock::Job.new(oauth: self)

#quotesObject



7
# File 'lib/jbr/mock/oauth.rb', line 7

def quotes = Mock::Quote.new(oauth: self)

#requestsObject



8
# File 'lib/jbr/mock/oauth.rb', line 8

def requests = Mock::Request.new(oauth: self)

#visitsObject



10
# File 'lib/jbr/mock/oauth.rb', line 10

def visits = Mock::Visit.new(oauth: self)