Class: BingAdsApi::PerformanceReportRequest
- Inherits:
-
ReportRequest
- Object
- DataObject
- ReportRequest
- BingAdsApi::PerformanceReportRequest
- Defined in:
- lib/bing-ads-api/data/reporting/performance_report_request.rb
Overview
Public : Defines the base class for ‘performance report requests’. Do not instantiate this object. Instead, use BingAdsApi::AccountPerformanceReportRequest, BingAdsApi::CampaignPerformanceReportRequest, BingAdsApi::AdGroupPerformanceReportRequest or BingAdsApi::AdPerformanceReportRequest
Reference: msdn.microsoft.com/en-us/library/bing-ads-reporting-bing-ads-reportrequest.aspx
- Author
Direct Known Subclasses
AccountPerformanceReportRequest, CampaignPerformanceReportRequest
Constant Summary collapse
- AGGREGATIONS =
Valid aggregations for reports
BingAdsApi::Config.instance. reporting_constants['aggregation']
Constants included from Helpers::FilterHelper
Helpers::FilterHelper::FILTERS_CRITERIA
Constants included from Helpers::TimeHelper
Helpers::TimeHelper::TIME_PERIODS
Constants inherited from ReportRequest
ReportRequest::FORMATS, ReportRequest::LANGUAGES, ReportRequest::REQUEST_STATUS
Instance Attribute Summary collapse
-
#aggregation ⇒ Object
Returns the value of attribute aggregation.
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#scope ⇒ Object
Returns the value of attribute scope.
-
#time ⇒ Object
Returns the value of attribute time.
Attributes inherited from ReportRequest
#format, #language, #report_name, #return_only_complete_data
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ PerformanceReportRequest
constructor
Public : Constructor.
-
#to_hash(keys_case = :underscore) ⇒ Object
- Public
-
Returns this object as a Hash for SOAP Requests .
Methods included from Helpers::FilterHelper
#filter_to_hash, #solve_filter_value, #valid_filter, #valid_filter_value
Methods included from SOAPHasheable
#date_to_hash, #get_attribute_key, #normalize_hash_keys, #object_to_hash
Methods included from Helpers::ColumnHelper
#columns_to_hash, #valid_columns
Methods included from Helpers::TimeHelper
Methods inherited from DataObject
Constructor Details
#initialize(attributes = {}) ⇒ PerformanceReportRequest
Public : Constructor. Adds validations to aggregations and time
- Author
Parameters
attributes - Hash with Performance report request
41 42 43 44 45 |
# File 'lib/bing-ads-api/data/reporting/performance_report_request.rb', line 41 def initialize(attributes={}) raise Exception.new("Invalid aggregation '#{attributes[:aggregation]}'") if !valid_aggregation(attributes[:aggregation]) raise Exception.new("Invalid time") if !valid_time(attributes[:time]) super(attributes) end |
Instance Attribute Details
#aggregation ⇒ Object
Returns the value of attribute aggregation.
31 32 33 |
# File 'lib/bing-ads-api/data/reporting/performance_report_request.rb', line 31 def aggregation @aggregation end |
#columns ⇒ Object
Returns the value of attribute columns.
31 32 33 |
# File 'lib/bing-ads-api/data/reporting/performance_report_request.rb', line 31 def columns @columns end |
#filter ⇒ Object
Returns the value of attribute filter.
31 32 33 |
# File 'lib/bing-ads-api/data/reporting/performance_report_request.rb', line 31 def filter @filter end |
#scope ⇒ Object
Returns the value of attribute scope.
31 32 33 |
# File 'lib/bing-ads-api/data/reporting/performance_report_request.rb', line 31 def scope @scope end |
#time ⇒ Object
Returns the value of attribute time.
31 32 33 |
# File 'lib/bing-ads-api/data/reporting/performance_report_request.rb', line 31 def time @time end |
Instance Method Details
#to_hash(keys_case = :underscore) ⇒ Object
- Public
-
Returns this object as a Hash for SOAP Requests
- Author
Parameters
-
keys_case
- specifies the case for the hash keys
keys_case
-
:camelcase - CamelCase
-
:underscore - underscore_case
Examples
performance_report_request.to_hash(:camelcase)
# => {"Format"=>"Xml", "Language"=>"English", "ReportName"=>"My Report", "Aggregation"=>"Hourly", "Time"=>"Today", "ReturnOnlyCompleteData"=>false}
- Returns
-
Hash
63 64 65 66 67 68 |
# File 'lib/bing-ads-api/data/reporting/performance_report_request.rb', line 63 def to_hash(keys_case = :underscore) hash = super(keys_case) hash[get_attribute_key('aggregation', keys_case)] = AGGREGATIONS[self.aggregation.to_s] hash[get_attribute_key('time', keys_case)] = time_to_hash(keys_case) return hash end |