Class: Api::Callrail
- Inherits:
-
Object
- Object
- Api::Callrail
- Includes:
- Singleton
- Defined in:
- app/services/api/callrail.rb
Overview
Service object: callrail.
Constant Summary collapse
- API_KEY =
Key used for api.
Heatwave::Configuration.fetch(:callrail, :api_key)
- ACCOUNT_ID =
Account id.
Heatwave::Configuration.fetch(:callrail, :account_id)
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Class Method Summary collapse
- .calls_summary(date_range) ⇒ Object
- .client ⇒ Object
- .hostname ⇒ Object
- .list_all_calls(per_page = 100, page = 1, date_range = 'yesterday') ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Callrail
constructor
A new instance of Callrail.
Constructor Details
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
7 8 9 |
# File 'app/services/api/callrail.rb', line 7 def client @client end |
Class Method Details
.calls_summary(date_range) ⇒ Object
26 27 28 |
# File 'app/services/api/callrail.rb', line 26 def self.calls_summary(date_range) client.get("#{hostname}/v3/a/#{ACCOUNT_ID}/calls/summary.json?date_range=#{date_range}").parse end |
.client ⇒ Object
18 19 20 |
# File 'app/services/api/callrail.rb', line 18 def self.client instance.client end |
.hostname ⇒ Object
22 23 24 |
# File 'app/services/api/callrail.rb', line 22 def self.hostname Heatwave::Configuration.fetch(:callrail, :hostname) end |
.list_all_calls(per_page = 100, page = 1, date_range = 'yesterday') ⇒ Object
30 31 32 33 |
# File 'app/services/api/callrail.rb', line 30 def self.list_all_calls(per_page = 100, page = 1, date_range = 'yesterday') fields = "campaign,prior_calls,keywords,medium,gclid,referring_url,landing_page_url,last_requested_url,referrer_domain" client.get("#{hostname}/v3/a/#{ACCOUNT_ID}/calls.json?date_range=#{date_range}&per_page=#{per_page}&page=#{page}&fields=#{fields}").parse end |