Class: AdManagerApi::Api

Inherits:
AdsCommon::Api
  • Object
show all
Defined in:
lib/ad_manager_api.rb

Overview

Wrapper class that serves as the main point of access for all the API usage.

Holds all the services, as well as login credentials.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provided_config = nil) ⇒ Api

Constructor for API.



41
42
43
44
45
# File 'lib/ad_manager_api.rb', line 41

def initialize(provided_config = nil)
  super(provided_config)
  @credential_handler = AdManagerApi::CredentialHandler.new(@config)
  @utils_reporter = AdManagerApi::UtilsReporter.new(@credential_handler)
end

Instance Attribute Details

#utils_reporterObject (readonly)

Returns the value of attribute utils_reporter.



38
39
40
# File 'lib/ad_manager_api.rb', line 38

def utils_reporter
  @utils_reporter
end

Instance Method Details

#api_configObject

Getter for the API service configurations.



48
49
50
# File 'lib/ad_manager_api.rb', line 48

def api_config
  AdManagerApi::ApiConfig
end

#date(*args) ⇒ Object

Returns an instance of AdManagerDate.



67
68
69
# File 'lib/ad_manager_api.rb', line 67

def date(*args)
  return AdManagerApi::AdManagerDate.new(self, *args)
end

#datetime(*args) ⇒ Object

Returns an instance of AdManagerDateTime.



77
78
79
# File 'lib/ad_manager_api.rb', line 77

def datetime(*args)
  return AdManagerApi::AdManagerDateTime.new(self, *args)
end

#new_report_statement_builder(&block) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/ad_manager_api.rb', line 57

def new_report_statement_builder(&block)
  statement = AdManagerApi::StatementBuilder.new(self) do |sb|
    sb.limit = nil
    sb.offset = nil
  end
  statement.configure(&block)
  return statement
end

#new_statement_builder(&block) ⇒ Object

Returns an instance of StatementBuilder object.



53
54
55
# File 'lib/ad_manager_api.rb', line 53

def new_statement_builder(&block)
  return AdManagerApi::StatementBuilder.new(self, &block)
end

#now(*args) ⇒ Object

Returns an instance of AdManagerDateTime representing the current time.



82
83
84
# File 'lib/ad_manager_api.rb', line 82

def now(*args)
  return AdManagerApi::AdManagerDateTime.now(self, *args)
end

#today(*args) ⇒ Object

Returns an instance of AdManagerDate representing the current day.



72
73
74
# File 'lib/ad_manager_api.rb', line 72

def today(*args)
  return AdManagerApi::AdManagerDate.today(self, *args)
end

#utc(*args) ⇒ Object

Returns an instance of AdManagerDateTime in the UTC timezone.



87
88
89
# File 'lib/ad_manager_api.rb', line 87

def utc(*args)
  return AdManagerApi::AdManagerDateTime.utc(self, *args)
end