Class: CustomerioAPI::TrackV1Client
- Inherits:
-
Object
- Object
- CustomerioAPI::TrackV1Client
- Defined in:
- lib/customerio_api/track_v1_client.rb
Constant Summary collapse
- BASE_URL =
'https://track.customer.io/api/v1/'
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#site_id ⇒ Object
readonly
Returns the value of attribute site_id.
-
#track_api_key ⇒ Object
readonly
Returns the value of attribute track_api_key.
Instance Method Summary collapse
- #connection ⇒ Object
- #customer_event ⇒ Object
-
#initialize(site_id:, track_api_key:, adapter: Faraday.default_adapter) ⇒ TrackV1Client
constructor
A new instance of TrackV1Client.
Constructor Details
#initialize(site_id:, track_api_key:, adapter: Faraday.default_adapter) ⇒ TrackV1Client
Returns a new instance of TrackV1Client.
10 11 12 13 14 |
# File 'lib/customerio_api/track_v1_client.rb', line 10 def initialize(site_id:, track_api_key:, adapter: Faraday.default_adapter) @site_id = site_id @track_api_key = track_api_key @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
8 9 10 |
# File 'lib/customerio_api/track_v1_client.rb', line 8 def adapter @adapter end |
#site_id ⇒ Object (readonly)
Returns the value of attribute site_id.
8 9 10 |
# File 'lib/customerio_api/track_v1_client.rb', line 8 def site_id @site_id end |
#track_api_key ⇒ Object (readonly)
Returns the value of attribute track_api_key.
8 9 10 |
# File 'lib/customerio_api/track_v1_client.rb', line 8 def track_api_key @track_api_key end |
Instance Method Details
#connection ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/customerio_api/track_v1_client.rb', line 20 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = BASE_URL conn.request :json conn.response :json, content_type: 'application/json' conn.adapter adapter conn.request :authorization, :basic, site_id, track_api_key end end |
#customer_event ⇒ Object
16 17 18 |
# File 'lib/customerio_api/track_v1_client.rb', line 16 def customer_event CustomerEventResource.new(self) end |