Module: Restforce

Includes:
CoreExtensions
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/middleware/raise_error.rb,
lib/restforce/concerns/authentication.rb,
lib/restforce/middleware/instance_url.rb,
lib/restforce/middleware/authorization.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

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)
MatchesMultipleError =
Class.new(ResponseError)
EntityTooLargeError =
Class.new(ResponseError)
Client =
Data::Client
VERSION =
'5.0.6'
FilePart =

Handle pre-1.0 versions of faraday

Faraday::UploadIO
UploadIO =

Deprecated

Faraday::UploadIO

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from CoreExtensions

#tap

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

.data(*args, &block) ⇒ Object


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

def data(*args, &block)
  Restforce::Data::Client.new(*args, &block)
end

.decode_signed_request(*args) ⇒ Object

Helper for decoding signed requests.


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

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

.new(*args, &block) ⇒ Object

Alias for Restforce::Data::Client.new

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


70
71
72
# File 'lib/restforce.rb', line 70

def new(*args, &block)
  data(*args, &block)
end

.tooling(*args, &block) ⇒ Object


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

def tooling(*args, &block)
  Restforce::Tooling::Client.new(*args, &block)
end