Module: ZohoHub

Defined in:
lib/zoho_hub.rb,
lib/zoho_hub/auth.rb,
lib/zoho_hub/errors.rb,
lib/zoho_hub/version.rb,
lib/zoho_hub/response.rb,
lib/zoho_hub/connection.rb,
lib/zoho_hub/base_record.rb,
lib/zoho_hub/string_utils.rb,
lib/zoho_hub/configuration.rb,
lib/zoho_hub/notifications.rb,
lib/zoho_hub/settings/field.rb,
lib/zoho_hub/settings/module.rb,
lib/zoho_hub/with_attributes.rb,
lib/zoho_hub/with_connection.rb,
lib/zoho_hub/cli/read_modules.rb,
lib/zoho_hub/with_validations.rb,
lib/zoho_hub/modules/attachment.rb,
lib/zoho_hub/cli/callback_server.rb,
lib/zoho_hub/oauth_callback_server.rb,
lib/zoho_hub/reflection/module_builder.rb,
lib/zoho_hub/validations/base_validation.rb,
lib/zoho_hub/validations/validate_length.rb,
lib/zoho_hub/validations/validate_picklist.rb

Defined Under Namespace

Modules: Cli, Settings, Validations, WithAttributes, WithConnection, WithValidations Classes: Attachment, Auth, BaseRecord, Configuration, Connection, InternalError, InvalidModule, InvalidTokenError, MandatoryNotFound, ModuleBuilder, NoPermission, Notifications, OauthCallbackServer, RecordInBlueprint, RecordInvalid, RecordNotFound, Response, StringUtils, ValidationError, ZohoAPIError

Constant Summary collapse

VERSION =
'0.4.2'

Class Method Summary collapse

Class Method Details

.access_token?Boolean

Returns:

  • (Boolean)


57
58
59
60
61
# File 'lib/zoho_hub.rb', line 57

def access_token?
  return false unless connection

  connection.access_token?
end

.configurationObject



26
27
28
# File 'lib/zoho_hub.rb', line 26

def configuration
  @configuration ||= Configuration.new
end

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

Yields:



30
31
32
# File 'lib/zoho_hub.rb', line 30

def configure
  yield(configuration)
end

.connectionObject



47
48
49
# File 'lib/zoho_hub.rb', line 47

def connection
  @connection
end

.on_refresh(&block) ⇒ Object

Callback for when the token is refreshed.



35
36
37
# File 'lib/zoho_hub.rb', line 35

def on_refresh(&block)
  @connection.on_refresh_cb = block
end

.refresh_token?Boolean

Returns:

  • (Boolean)


51
52
53
54
55
# File 'lib/zoho_hub.rb', line 51

def refresh_token?
  return false unless connection

  connection.refresh_token?
end

.rootObject



22
23
24
# File 'lib/zoho_hub.rb', line 22

def root
  File.expand_path(File.join(__dir__, '..'))
end

.setup_connection(params = {}) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/zoho_hub.rb', line 39

def setup_connection(params = {})
  raise "ERROR: #{params[:error]}" if params[:error]

  connection_params = params.dup.slice(:access_token, :expires_in, :api_domain, :refresh_token)

  @connection = Connection.new(**connection_params)
end