Sha256: 5527db72a8d6ba8bf442e4c87cc6914f683bd7eabf2bbf25ac9f70a86fc0f319

Contents?: true

Size: 1.32 KB

Versions: 16

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/string/inflections'

require 'zoho_hub/version'
require 'zoho_hub/auth'
require 'zoho_hub/configuration'
require 'zoho_hub/connection'
require 'zoho_hub/errors'
require 'zoho_hub/records/contact'
require 'zoho_hub/records/potential'
require 'zoho_hub/records/campaign'
require 'zoho_hub/records/account'
require 'zoho_hub/records/quote'
require 'zoho_hub/records/vendor'
require 'zoho_hub/records/product'
require 'zoho_hub/records/attachment'
require 'zoho_hub/records/credit_score'
require 'zoho_hub/records/adverse_criteria'

module ZohoHub
  module_function

  def configuration
    @configuration ||= Configuration.new
  end

  def connection
    @connection
  end

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

  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

  def refresh_token?
    return false unless connection.present?

    connection.refresh_token?
  end

  def access_token?
    return false unless connection.present?

    connection.access_token?
  end

  def configure
    yield(configuration)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
zoho_hub-0.1.42 lib/zoho_hub.rb
zoho_hub-0.1.41 lib/zoho_hub.rb
zoho_hub-0.1.40 lib/zoho_hub.rb
zoho_hub-0.1.39 lib/zoho_hub.rb
zoho_hub-0.1.38 lib/zoho_hub.rb
zoho_hub-0.1.37 lib/zoho_hub.rb
zoho_hub-0.1.36 lib/zoho_hub.rb
zoho_hub-0.1.35 lib/zoho_hub.rb
zoho_hub-0.1.34 lib/zoho_hub.rb
zoho_hub-0.1.33 lib/zoho_hub.rb
zoho_hub-0.1.32 lib/zoho_hub.rb
zoho_hub-0.1.30 lib/zoho_hub.rb
zoho_hub-0.1.29 lib/zoho_hub.rb
zoho_hub-0.1.28 lib/zoho_hub.rb
zoho_hub-0.1.27 lib/zoho_hub.rb
zoho_hub-0.1.26 lib/zoho_hub.rb