lib/smartsheet/client.rb in smartsheet-1.0.0.beta.2 vs lib/smartsheet/client.rb in smartsheet-1.0.0

- old
+ new

@@ -23,26 +23,87 @@ require 'smartsheet/endpoints/webhooks/webhooks' require 'smartsheet/endpoints/workspaces/workspaces' module Smartsheet + # The entry point to the SDK. API endpoint categories are accessed through this object's readable + # attributes. + # + # @!attribute [r] contacts + # @return [Contacts] + # @!attribute [r] favorites + # @return [Favorites] + # @!attribute [r] folders + # @return [Folders] + # @!attribute [r] groups + # @return [Groups] + # @!attribute [r] home + # @return [Home] + # @!attribute [r] reports + # @return [Reports] + # @!attribute [r] search + # @return [Search] + # @!attribute [r] server_info + # @return [ServerInfo] + # @!attribute [r] sheets + # @return [Sheets] + # @!attribute [r] sights + # @return [Sights] + # @!attribute [r] templates + # @return [Templates] + # @!attribute [r] token + # @return [Token] + # @!attribute [r] update_requests + # @return [UpdateRequests] + # @!attribute [r] users + # @return [Users] + # @!attribute [r] webhooks + # @return [Webhooks] + # @!attribute [r] workspaces + # @return [Workspaces] class Client include GeneralRequest include Smartsheet::Constants attr_reader :contacts, :favorites, :folders, :groups, :home, :reports, :search, :server_info, :sheets, :sights, :templates, :token, :update_requests, :users, :webhooks, :workspaces + # @param token [String] access token for the API; if nil or empty, uses environment variable + # `SMARTSHEET_ACCESS_TOKEN` + # @param logger [Logger] a logger to which request and response info will be recorded + # @param log_full_body [Boolean] when true, request and response bodies will not be truncated in + # the logs + # @param json_output [Boolean] when true, endpoints return raw JSON strings instead of hashes + # @param assume_user [String] the email address of the user to impersonate; only available for + # admin roles + # @param max_retry_time [Fixnum] overrides the maximum number of seconds during which eligible + # errors will be retried + # @param backoff_method [Proc] overrides the backoff calculation method, accepting the index of + # the current retry attempt (0-based) and returning the number of seconds to wait before + # retrying the call again, or `:stop` to halt retrying and return the latest error. + # + # Example - Wait 1 second before the first retry, 2 seconds before + # the second, and so on: + # ```ruby + # ->(x){ x + 1 } + # ``` + # + # Example - Try twice, then halt: + # ```ruby + # ->(x){ if x < 2 then x + 1 else :stop end } + # ``` + # @param base_url [String] overrides the base URL used when constructing API calls; for example, + # the default takes the form of `https://api.smartsheet.com/2.0` def initialize( token: nil, - assume_user: nil, + logger: nil, + log_full_body: false, json_output: false, + assume_user: nil, max_retry_time: nil, backoff_method: nil, - logger: nil, - log_full_body: false, base_url: API_URL ) request_logger = logger ? @@ -72,10 +133,9 @@ response_client, base_url, assume_user: assume_user, logger: request_logger ) - build_categories end def inspect methods = (self.public_methods - Object.methods)