Module: IContact

Defined in:
lib/i_contact.rb,
lib/i_contact/list.rb,
lib/i_contact/model.rb,
lib/i_contact/account.rb,
lib/i_contact/contact.rb,
lib/i_contact/version.rb,
lib/i_contact/response.rb,
lib/i_contact/subscription.rb,
lib/i_contact/client_folder.rb,
lib/i_contact/configuration.rb

Defined Under Namespace

Modules: Model Classes: Account, ApiError, ClientFolder, Configuration, Contact, InvalidConfiguration, InvalidResource, List, Response, Subscription

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configurationObject



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

def configuration
  @configuration
end

.configuration=(configuration) ⇒ Object



34
35
36
# File 'lib/i_contact.rb', line 34

def configuration=(configuration)
  @configuration = configuration
end

.configure(&block) ⇒ Object



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

def configure(&block)
  @configuration = IContact::Configuration.new(&block) if block_given?
end

.connectionObject



38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/i_contact.rb', line 38

def connection
  if configuration.nil? || !configuration.valid?
    raise InvalidConfiguration
  end

  @connection ||= Faraday::Connection.new({
    :headers => headers,
    :ssl => {:verify => true}}) do |builder|

    #builder.use Faraday::Request::UrlEncoded
    builder.adapter Faraday.default_adapter
  end
end

.reset_connection!Object



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

def reset_connection!
  @connection = nil
  connection
end

.url(with_account_and_folder = true) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/i_contact.rb', line 57

def url( = true)
  base_url = "https://#{host}/icp/"
  if 
    base_url += "a/#{configuration.}/c/#{configuration.client_folder_id}/"
  end
  base_url

end