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/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/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: Auth, BaseRecord, Configuration, Connection, InvalidTokenError, ModuleBuilder, OauthCallbackServer, RecordInvalid, RecordNotFound, Response, StringUtils, ValidationError, ZohoAPIError
Constant Summary
collapse
- VERSION =
'0.3.0'
Class Method Summary
collapse
Class Method Details
.access_token? ⇒ Boolean
55
56
57
58
59
|
# File 'lib/zoho_hub.rb', line 55
def access_token?
return false unless connection
connection.access_token?
end
|
.configuration ⇒ Object
24
25
26
|
# File 'lib/zoho_hub.rb', line 24
def configuration
@configuration ||= Configuration.new
end
|
28
29
30
|
# File 'lib/zoho_hub.rb', line 28
def configure
yield(configuration)
end
|
.connection ⇒ Object
45
46
47
|
# File 'lib/zoho_hub.rb', line 45
def connection
@connection
end
|
.on_refresh(&block) ⇒ Object
Callback for when the token is refreshed.
33
34
35
|
# File 'lib/zoho_hub.rb', line 33
def on_refresh(&block)
@connection.on_refresh_cb = block
end
|
.refresh_token? ⇒ Boolean
49
50
51
52
53
|
# File 'lib/zoho_hub.rb', line 49
def refresh_token?
return false unless connection
connection.refresh_token?
end
|
.root ⇒ Object
20
21
22
|
# File 'lib/zoho_hub.rb', line 20
def root
File.expand_path(File.join(__dir__, '..'))
end
|
.setup_connection(params = {}) ⇒ Object
37
38
39
40
41
42
43
|
# File 'lib/zoho_hub.rb', line 37
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
|