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
.configuration ⇒ Object
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
|
26
27
28
|
# File 'lib/i_contact.rb', line 26
def configure(&block)
@configuration = IContact::Configuration.new(&block) if block_given?
end
|
.connection ⇒ Object
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 => ,
:ssl => {:verify => true}}) do |builder|
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(with_account_and_folder = true)
base_url = "https://#{host}/icp/"
if with_account_and_folder
base_url += "a/#{configuration.account_id}/c/#{configuration.client_folder_id}/"
end
base_url
end
|