Class: Api::Callrail
- Inherits:
-
Object
- Object
- Api::Callrail
- Includes:
- Singleton
- Defined in:
- app/services/api/callrail.rb
Constant Summary collapse
- API_KEY =
Heatwave::Configuration.fetch(:callrail, :api_key)
- 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.
5 6 7 |
# File 'app/services/api/callrail.rb', line 5 def client @client end |
Class Method Details
.calls_summary(date_range) ⇒ Object
21 22 23 |
# File 'app/services/api/callrail.rb', line 21 def self.calls_summary(date_range) response = client.get("#{hostname}/v3/a/#{ACCOUNT_ID}/calls/summary.json?date_range=#{date_range}").parse end |
.client ⇒ Object
13 14 15 |
# File 'app/services/api/callrail.rb', line 13 def self.client instance.client end |
.hostname ⇒ Object
17 18 19 |
# File 'app/services/api/callrail.rb', line 17 def self.hostname Heatwave::Configuration.fetch(:callrail, :hostname) end |
.list_all_calls(per_page = 100, page = 1, date_range = 'yesterday') ⇒ Object
25 26 27 28 |
# File 'app/services/api/callrail.rb', line 25 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" response = client.get("#{hostname}/v3/a/#{ACCOUNT_ID}/calls.json?date_range=#{date_range}&per_page=#{per_page}&page=#{page}&fields=#{fields}").parse end |