class MdNotes::Client

md_notes client class.

Attributes

config[R]

Public Class Methods

new(timeout: 60, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put], environment: Environment::PRODUCTION, o_auth_client_id: 'TODO: Replace', o_auth_client_secret: 'TODO: Replace', o_auth_username: 'TODO: Replace', o_auth_password: 'TODO: Replace', o_auth_token: nil, config: nil) click to toggle source
# File lib/md_notes/client.rb, line 34
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
               backoff_factor: 2,
               retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
               retry_methods: %i[get put],
               environment: Environment::PRODUCTION,
               o_auth_client_id: 'TODO: Replace',
               o_auth_client_secret: 'TODO: Replace',
               o_auth_username: 'TODO: Replace',
               o_auth_password: 'TODO: Replace', o_auth_token: nil,
               config: nil)
  @config = if config.nil?
              Configuration.new(timeout: timeout, max_retries: max_retries,
                                retry_interval: retry_interval,
                                backoff_factor: backoff_factor,
                                retry_statuses: retry_statuses,
                                retry_methods: retry_methods,
                                environment: environment,
                                o_auth_client_id: o_auth_client_id,
                                o_auth_client_secret: o_auth_client_secret,
                                o_auth_username: o_auth_username,
                                o_auth_password: o_auth_password,
                                o_auth_token: o_auth_token)
            else
              config
            end
end

Public Instance Methods

auth() click to toggle source

Returns the authentication class for easy access.

# File lib/md_notes/client.rb, line 12
def auth
  OAuth2
end
o_auth_authorization() click to toggle source

Access to o_auth_authorization controller. @return [OAuthAuthorizationController] Returns the controller instance.

# File lib/md_notes/client.rb, line 30
def o_auth_authorization
  @o_auth_authorization ||= OAuthAuthorizationController.new config
end
service() click to toggle source

Access to service controller. @return [ServiceController] Returns the controller instance.

# File lib/md_notes/client.rb, line 18
def service
  @service ||= ServiceController.new config
end
user() click to toggle source

Access to user controller. @return [UserController] Returns the controller instance.

# File lib/md_notes/client.rb, line 24
def user
  @user ||= UserController.new config
end