Module: Restforce

Defined in:
lib/restforce.rb,
lib/restforce/mash.rb,
lib/restforce/client.rb,
lib/restforce/config.rb,
lib/restforce/sobject.rb,
lib/restforce/version.rb,
lib/restforce/document.rb,
lib/restforce/file_part.rb,
lib/restforce/attachment.rb,
lib/restforce/collection.rb,
lib/restforce/error_code.rb,
lib/restforce/middleware.rb,
lib/restforce/data/client.rb,
lib/restforce/concerns/api.rb,
lib/restforce/concerns/base.rb,
lib/restforce/concerns/verbs.rb,
lib/restforce/signed_request.rb,
lib/restforce/tooling/client.rb,
lib/restforce/abstract_client.rb,
lib/restforce/concerns/canvas.rb,
lib/restforce/middleware/gzip.rb,
lib/restforce/concerns/caching.rb,
lib/restforce/middleware/logger.rb,
lib/restforce/concerns/batch_api.rb,
lib/restforce/concerns/picklists.rb,
lib/restforce/concerns/streaming.rb,
lib/restforce/middleware/caching.rb,
lib/restforce/middleware/mashify.rb,
lib/restforce/concerns/connection.rb,
lib/restforce/middleware/multipart.rb,
lib/restforce/concerns/composite_api.rb,
lib/restforce/middleware/raise_error.rb,
lib/restforce/concerns/authentication.rb,
lib/restforce/middleware/instance_url.rb,
lib/restforce/middleware/json_request.rb,
lib/restforce/middleware/authorization.rb,
lib/restforce/middleware/json_response.rb,
lib/restforce/middleware/authentication.rb,
lib/restforce/middleware/custom_headers.rb,
lib/restforce/middleware/authentication/token.rb,
lib/restforce/middleware/authentication/password.rb,
lib/restforce/middleware/authentication/jwt_bearer.rb,
lib/restforce/middleware/authentication/client_credential.rb

Defined Under Namespace

Modules: Concerns, CoreExtensions, Data, ErrorCode, Tooling Classes: AbstractClient, Attachment, Collection, Configuration, Document, Mash, Middleware, SObject, SignedRequest

Constant Summary collapse

Error =
Class.new(StandardError)
ServerError =
Class.new(Error)
AuthenticationError =
Class.new(Error)
UnauthorizedError =
Class.new(Faraday::ClientError)
APIVersionError =
Class.new(Error)
BatchAPIError =
Class.new(Error)
NotFoundError =

Inherit from Faraday::ResourceNotFound for backwards-compatibility Consumers of this library that rescue and handle Faraday::ResourceNotFound can continue to do so.

Class.new(Faraday::ResourceNotFound)
ResponseError =

Inherit from Faraday::ClientError for backwards-compatibility Consumers of this library that rescue and handle Faraday::ClientError can continue to do so.

Class.new(Faraday::ClientError)
CompositeAPIError =
Class.new(ResponseError)
MatchesMultipleError =
Class.new(ResponseError)
EntityTooLargeError =
Class.new(ResponseError)
Client =
Data::Client
VERSION =
'7.3.0'
FilePart =

Handle pre-1.0 versions of faraday

Faraday::UploadIO
UploadIO =

Deprecated

Faraday::UploadIO

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.log(message) ⇒ Object



35
36
37
38
39
# File 'lib/restforce/config.rb', line 35

def log(message)
  return unless Restforce.log?

  configuration.logger.send(configuration.log_level, message)
end

Class Method Details

.configurationObject

Returns the current Configuration

Example

Restforce.configuration.username = "username"
Restforce.configuration.password = "password"


15
16
17
# File 'lib/restforce/config.rb', line 15

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields the Configuration

Example

Restforce.configure do |config|
  config.username = "username"
  config.password = "password"
end

Yields:



27
28
29
# File 'lib/restforce/config.rb', line 27

def configure
  yield configuration
end

.dataObject



78
79
80
# File 'lib/restforce.rb', line 78

def data(...)
  Restforce::Data::Client.new(...)
end

.decode_signed_request(*args) ⇒ Object

Helper for decoding signed requests.



87
88
89
# File 'lib/restforce.rb', line 87

def decode_signed_request(*args)
  SignedRequest.decode(*args)
end

.log?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/restforce/config.rb', line 31

def log?
  @log ||= false
end

.newObject

Alias for Restforce::Data::Client.new

Shamelessly pulled from github.com/pengwynn/octokit/blob/master/lib/octokit.rb



74
75
76
# File 'lib/restforce.rb', line 74

def new(...)
  data(...)
end

.toolingObject



82
83
84
# File 'lib/restforce.rb', line 82

def tooling(...)
  Restforce::Tooling::Client.new(...)
end