Class: VistarClient::Client
- Inherits:
-
Object
- Object
- VistarClient::Client
- Includes:
- API::AdServing, API::CreativeCaching, API::UnifiedServing
- Defined in:
- lib/vistar_client/client.rb
Overview
The main client class for interacting with the Vistar Media API.
This class serves as the primary entry point for all API operations. It delegates to specialized API modules for different endpoint groups.
Constant Summary collapse
- DEFAULT_API_BASE_URL =
Default API base URL for Vistar Media
'https://api.vistarmedia.com'- DEFAULT_TIMEOUT =
Default timeout for HTTP requests in seconds
10
Instance Attribute Summary collapse
-
#api_base_url ⇒ String
readonly
The base URL for the API.
-
#api_key ⇒ String
readonly
The API key for authentication.
-
#network_id ⇒ String
readonly
The network ID.
-
#timeout ⇒ Integer
readonly
The timeout for HTTP requests in seconds.
Instance Method Summary collapse
-
#initialize(api_key:, network_id:, api_base_url: DEFAULT_API_BASE_URL, timeout: DEFAULT_TIMEOUT) ⇒ Client
constructor
Initialize a new Vistar Media API client.
Methods included from API::UnifiedServing
#get_loop, #submit_loop_tracking
Methods included from API::CreativeCaching
Methods included from API::AdServing
#request_ad, #submit_proof_of_play
Constructor Details
#initialize(api_key:, network_id:, api_base_url: DEFAULT_API_BASE_URL, timeout: DEFAULT_TIMEOUT) ⇒ Client
Initialize a new Vistar Media API client.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/vistar_client/client.rb', line 64 def initialize(api_key:, network_id:, api_base_url: DEFAULT_API_BASE_URL, timeout: DEFAULT_TIMEOUT) validate_credentials!(api_key, network_id) @api_key = api_key @network_id = network_id @api_base_url = api_base_url @timeout = timeout @connection = Connection.new( api_key: api_key, api_base_url: api_base_url, timeout: timeout ) end |
Instance Attribute Details
#api_base_url ⇒ String (readonly)
Returns the base URL for the API.
45 46 47 |
# File 'lib/vistar_client/client.rb', line 45 def api_base_url @api_base_url end |
#api_key ⇒ String (readonly)
Returns the API key for authentication.
39 40 41 |
# File 'lib/vistar_client/client.rb', line 39 def api_key @api_key end |
#network_id ⇒ String (readonly)
Returns the network ID.
42 43 44 |
# File 'lib/vistar_client/client.rb', line 42 def network_id @network_id end |
#timeout ⇒ Integer (readonly)
Returns the timeout for HTTP requests in seconds.
48 49 50 |
# File 'lib/vistar_client/client.rb', line 48 def timeout @timeout end |