Class: BingAdsApi::ReportRequest
- Inherits:
-
DataObject
- Object
- DataObject
- BingAdsApi::ReportRequest
- Defined in:
- lib/bing-ads-api/data/report_request.rb
Overview
Public : Defines the base object for all report requests. Do not instantiate this object. Instead, you may instantiate one of the following report request objects which derives from this object to request a report.
Reference: msdn.microsoft.com/en-us/library/bing-ads-reporting-bing-ads-reportrequest.aspx
- Author
Direct Known Subclasses
Constant Summary collapse
- FORMATS =
Valid Formats for reports
BingAdsApi::Config.instance. reporting_constants['format']
- LANGUAGES =
Valid languages for reports
BingAdsApi::Config.instance. reporting_constants['language']
- REQUEST_STATUS =
Valid report request status for reports
BingAdsApi::Config.instance. reporting_constants['request_status_type']
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
-
#language ⇒ Object
Returns the value of attribute language.
-
#report_name ⇒ Object
Returns the value of attribute report_name.
-
#return_only_complete_data ⇒ Object
Returns the value of attribute return_only_complete_data.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ReportRequest
constructor
Public : Constructor.
-
#to_hash(keys_case = :underscore) ⇒ Object
- Public
-
Returns this object as a Hash for SOAP Requests .
Methods inherited from DataObject
Methods included from SOAPHasheable
#date_to_hash, #get_attribute_key, #normalize_hash_keys, #object_to_hash
Constructor Details
#initialize(attributes = {}) ⇒ ReportRequest
Public : Constructor. Adds validations to format and language attributes
- Author
Parameters
attributes - Hash with Report request parameters
35 36 37 38 39 40 |
# File 'lib/bing-ads-api/data/report_request.rb', line 35 def initialize(attributes={}) raise Exception.new("Invalid format '#{attributes[:format]}'") if !valid_format(attributes[:format]) raise Exception.new("Invalid language '#{attributes[:language]}'") if !valid_language(attributes[:language]) super(attributes) self.return_only_complete_data = attributes[:return_only_complete_data] || false end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
27 28 29 |
# File 'lib/bing-ads-api/data/report_request.rb', line 27 def format @format end |
#language ⇒ Object
Returns the value of attribute language.
27 28 29 |
# File 'lib/bing-ads-api/data/report_request.rb', line 27 def language @language end |
#report_name ⇒ Object
Returns the value of attribute report_name.
27 28 29 |
# File 'lib/bing-ads-api/data/report_request.rb', line 27 def report_name @report_name end |
#return_only_complete_data ⇒ Object
Returns the value of attribute return_only_complete_data.
27 28 29 |
# File 'lib/bing-ads-api/data/report_request.rb', line 27 def return_only_complete_data @return_only_complete_data 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
report_request.to_hash(:camelcase)
# => {"Format"=>"Xml", "Language"=>"English", "ReportName"=>"My Report", "ReturnOnlyCompleteData"=>true}
- Returns
-
Hash
58 59 60 61 62 63 |
# File 'lib/bing-ads-api/data/report_request.rb', line 58 def to_hash(keys_case = :underscore) hash = super(keys_case) hash[get_attribute_key('format', keys_case)] = FORMATS[self.format.to_s] hash[get_attribute_key('language', keys_case)] = LANGUAGES[self.language.to_s] return hash end |