Class: LoopsRails::Client
- Inherits:
-
Object
- Object
- LoopsRails::Client
- Defined in:
- lib/loops_rails/client.rb
Constant Summary collapse
- BASE_URL =
'https://app.loops.so/api/v1/'
Instance Method Summary collapse
- #api_key ⇒ Object
- #contacts ⇒ Object
- #custom_fields ⇒ Object
- #events ⇒ Object
-
#initialize(api_key = LoopsRails.configuration.api_key) ⇒ Client
constructor
A new instance of Client.
- #lists ⇒ Object
- #transactional_emails ⇒ Object
Constructor Details
#initialize(api_key = LoopsRails.configuration.api_key) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 |
# File 'lib/loops_rails/client.rb', line 5 def initialize(api_key = LoopsRails.configuration.api_key) @api_key = api_key @conn = Faraday.new(url: BASE_URL) do |faraday| faraday.request :url_encoded faraday.adapter Faraday.default_adapter faraday.headers['Authorization'] = "Bearer #{@api_key}" faraday.headers['Content-Type'] = 'application/json' end end |
Instance Method Details
#api_key ⇒ Object
15 16 17 |
# File 'lib/loops_rails/client.rb', line 15 def api_key @api_key_endpoint ||= ApiKey.new(@conn) end |
#contacts ⇒ Object
19 20 21 |
# File 'lib/loops_rails/client.rb', line 19 def contacts @contacts ||= Contacts.new(@conn) end |
#custom_fields ⇒ Object
23 24 25 |
# File 'lib/loops_rails/client.rb', line 23 def custom_fields @custom_fields ||= CustomFields.new(@conn) end |
#events ⇒ Object
31 32 33 |
# File 'lib/loops_rails/client.rb', line 31 def events @events ||= Events.new(@conn) end |
#lists ⇒ Object
27 28 29 |
# File 'lib/loops_rails/client.rb', line 27 def lists @lists ||= Lists.new(@conn) end |
#transactional_emails ⇒ Object
35 36 37 |
# File 'lib/loops_rails/client.rb', line 35 def transactional_emails @transactional_emails ||= TransactionalEmails.new(@conn) end |