Class: SoapyBing::Ads::Reports::Base
- Inherits:
-
Object
- Object
- SoapyBing::Ads::Reports::Base
- Includes:
- Helpers::ClassName
- Defined in:
- lib/soapy_bing/ads/reports/base.rb
Direct Known Subclasses
Defined Under Namespace
Classes: UnknownParserError
Constant Summary collapse
- DEFAULT_REPORT_SETTINGS =
{ format: 'Csv', language: 'English', name: 'MyReport', aggregation: 'HourOfDay', columns: %w(TimePeriod CampaignName Impressions Clicks Spend CampaignId) }.freeze
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#oauth_credentials ⇒ Object
readonly
Returns the value of attribute oauth_credentials.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(options) ⇒ Base
constructor
A new instance of Base.
- #rows ⇒ Object
Methods included from Helpers::ClassName
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
21 22 23 24 25 |
# File 'lib/soapy_bing/ads/reports/base.rb', line 21 def initialize() @oauth_credentials = .fetch(:oauth_credentials) @account = .fetch(:account) @settings = OpenStruct.new(DEFAULT_REPORT_SETTINGS.merge(.fetch(:settings, {}))) end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
19 20 21 |
# File 'lib/soapy_bing/ads/reports/base.rb', line 19 def account @account end |
#oauth_credentials ⇒ Object (readonly)
Returns the value of attribute oauth_credentials.
19 20 21 |
# File 'lib/soapy_bing/ads/reports/base.rb', line 19 def oauth_credentials @oauth_credentials end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
19 20 21 |
# File 'lib/soapy_bing/ads/reports/base.rb', line 19 def settings @settings end |
Instance Method Details
#rows ⇒ Object
27 28 29 |
# File 'lib/soapy_bing/ads/reports/base.rb', line 27 def rows @rows ||= parser_class.new(Helpers::ZipDownloader.new(download_url).read).rows end |