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/configuration.rb,
lib/zoho_hub/records/quote.rb,
lib/zoho_hub/records/funder.rb,
lib/zoho_hub/records/account.rb,
lib/zoho_hub/records/contact.rb,
lib/zoho_hub/records/product.rb,
lib/zoho_hub/records/campaign.rb,
lib/zoho_hub/records/potential.rb,
lib/zoho_hub/records/base_record.rb

Defined Under Namespace

Classes: Account, Auth, BaseRecord, Campaign, Configuration, Connection, Contact, InvalidTokenError, Potential, Product, Quote, RecordInvalid, RecordNotFound, Response, Vendor, ZohoAPIError

Constant Summary collapse

VERSION =
'0.1.8'

Class Method Summary collapse

Class Method Details

.access_token?Boolean

Returns:

  • (Boolean)


48
49
50
51
52
# File 'lib/zoho_hub.rb', line 48

def access_token?
  return false unless connection.present?

  connection.access_token?
end

.configurationObject



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

def configuration
  @configuration ||= Configuration.new
end

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

Yields:



54
55
56
# File 'lib/zoho_hub.rb', line 54

def configure
  yield(configuration)
end

.connectionObject



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

def connection
  @connection
end

.on_refresh(&block) ⇒ Object



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

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

.refresh_token?Boolean

Returns:

  • (Boolean)


42
43
44
45
46
# File 'lib/zoho_hub.rb', line 42

def refresh_token?
  return false unless connection.present?

  connection.refresh_token?
end

.setup_connection(params = {}) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/zoho_hub.rb', line 34

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

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

  @connection = Connection.new(connection_params)
end