An open API service indexing awesome lists of open source software.

https://github.com/toshimaru/brightcove-analytics-api-ruby


https://github.com/toshimaru/brightcove-analytics-api-ruby

Last synced: about 1 year ago
JSON representation

Awesome Lists containing this project

README

          

# openapi_client

OpenapiClient - the Ruby gem for the Brightcove Analytics API Reference

Reference for the Brightcove Analytics API, used to retrieve analytics data for your accounts. To test API requests, you can use our API Testing Tools.

For additional in-depth guides to features of the API, see the **[general documentation](/analytics/index.html)**.

**Base URL**: https://analytics.api.brightcove.com

This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.RubyClientCodegen

## Installation

### Build a gem

To build the Ruby code into a gem:

```shell
gem build openapi_client.gemspec
```

Then either install the gem locally:

```shell
gem install ./openapi_client-1.0.0.gem
```

(for development, run `gem install --dev ./openapi_client-1.0.0.gem` to install the development dependencies)

or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).

Finally add this to the Gemfile:

gem 'openapi_client', '~> 1.0.0'

### Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'openapi_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

### Include the Ruby code directly

Include the Ruby code directly using `-I` as follows:

```shell
ruby -Ilib script.rb
```

## Getting Started

Please follow the [installation](#installation) procedure and then run the following code:

```ruby
# Load the gem
require 'openapi_client'

# Setup authorization
OpenapiClient.configure do |config|
# Configure OAuth2 access token for authorization: BC_OAuth2
config.access_token = 'YOUR ACCESS TOKEN'
end

api_instance = OpenapiClient::AnalyticsReportApi.new
content_type = 'content_type_example' # String | Content-Type: application/json
authorization = 'authorization_example' # String | Authorization: Bearer access_token (see Getting Access Tokens)
accept_encoding = 'accept_encoding_example' # String | Accept-Encoding: gzip (optional)
accounts = 'accounts_example' # String | One or more account ids, separated by commas
dimensions = OpenapiClient::Dimensions::ACCOUNT # Dimensions | One or more dimensions to report on; see [Multiple Dimensions](/analytics/getting-started/analytics-api-overview-dimensions-fields-and-parameters.html) or which combined dimensions are supported Dimensions: - account - browser_type - city - country - date - date_hour - destination_domain - destination_path - device_os - device_manufacturer - device_type - live_stream - player - referrer_domain - region - search_terms - social_platform - source_type - video
where = OpenapiClient::LiveWhere::COUNTRY # LiveWhere | one or more 'dimension==value' pairs to filter the results; for live, the only available filters are `country`, `device-type`, and `video`
opts = {
limit: 10, # Integer | Number of items to return
offset: 10, # Integer | Number of items to skip
sort: 'video_view', # String | Field to sort results by (prefix with `-` for descending order)
fields: 'video_view, video_impression, video.name', # String | Fields to return - available fields varies according to the dimensions - see the [Overview: Analytics API](/analytics/getting-started/analytics-api-overview-dimensions-fields-and-parameters.html) for more details
from: TODO, # OneOfstringinteger | 'Start time for the period covered by the report — epoch time in milliseconds (`1535654206775`) or a date in the format `yyyy-mm-dd` (such as `2013-09-26`)'
to: TODO, # OneOfstringinteger | End time for the period covered by the report — `now` or epoch time in milliseconds (`1535654206775`) or a date in the format `yyyy-mm-dd` (such as `2013-09-26`)
format: OpenapiClient::Format::CSV, # Format | format to return the results in
reconciled: true # Boolean | if true, only reconciled data is returned; if false, only realtime data is returned; if not present, both reconciled and realtime data are returned
}

begin
#Get Analytics Report
result = api_instance.get_analytics_report(content_type, authorization, accept_encoding, accounts, dimensions, where, opts)
p result
rescue OpenapiClient::ApiError => e
puts "Exception when calling AnalyticsReportApi->get_analytics_report: #{e}"
end

```

## Documentation for API Endpoints

All URIs are relative to *https://analytics.api.brightcove.com*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*OpenapiClient::AnalyticsReportApi* | [**get_analytics_report**](docs/AnalyticsReportApi.md#get_analytics_report) | **GET** /v1/data | Get Analytics Report
*OpenapiClient::AnalyticsReportApi* | [**get_available_date_range**](docs/AnalyticsReportApi.md#get_available_date_range) | **GET** /v1/data/status | Get Available Date Range
*OpenapiClient::EngagementReportApi* | [**get_account_engagement**](docs/EngagementReportApi.md#get_account_engagement) | **GET** /v1/engagement/accounts/{account_id} | Get Account Engagement
*OpenapiClient::EngagementReportApi* | [**get_player_engagement**](docs/EngagementReportApi.md#get_player_engagement) | **GET** /v1/engagement/accounts/{account_id}/players/{player_id} | Get Player Engagement
*OpenapiClient::EngagementReportApi* | [**get_video_engagement**](docs/EngagementReportApi.md#get_video_engagement) | **GET** /v1/engagement/accounts/{account_id}/videos/{video_id} | Get Video Engagement
*OpenapiClient::LiveAnalyticsApi* | [**get_live_events**](docs/LiveAnalyticsApi.md#get_live_events) | **GET** /v1/events/accounts/{account-id} | Get Live Analytics event
*OpenapiClient::LiveAnalyticsApi* | [**get_live_time_series**](docs/LiveAnalyticsApi.md#get_live_time_series) | **GET** /v1/timeseries/accounts/{account_id} | Get Live Analytics time-series
*OpenapiClient::VideoDataApi* | [**get_alltime_video_views**](docs/VideoDataApi.md#get_alltime_video_views) | **GET** /v1/alltime/accounts/{account_id}/videos/{video_id} | Get Alltime Video Views

## Documentation for Models

- [OpenapiClient::Account](docs/Account.md)
- [OpenapiClient::Dimensions](docs/Dimensions.md)
- [OpenapiClient::Format](docs/Format.md)
- [OpenapiClient::GetAlltimeVideoViewsResponse](docs/GetAlltimeVideoViewsResponse.md)
- [OpenapiClient::GetAnalyticsReportResponse](docs/GetAnalyticsReportResponse.md)
- [OpenapiClient::GetAvailableDateRangeResponse](docs/GetAvailableDateRangeResponse.md)
- [OpenapiClient::GetEventsResponse](docs/GetEventsResponse.md)
- [OpenapiClient::GetEventsResponseData](docs/GetEventsResponseData.md)
- [OpenapiClient::GetTimeSeriesResponse](docs/GetTimeSeriesResponse.md)
- [OpenapiClient::GetVideoEngagementResponse](docs/GetVideoEngagementResponse.md)
- [OpenapiClient::Items](docs/Items.md)
- [OpenapiClient::LiveDimensions](docs/LiveDimensions.md)
- [OpenapiClient::LiveWhere](docs/LiveWhere.md)
- [OpenapiClient::Summary](docs/Summary.md)
- [OpenapiClient::Timeline](docs/Timeline.md)
- [OpenapiClient::Where](docs/Where.md)

## Documentation for Authorization

### BC_OAuth2

- **Type**: OAuth
- **Flow**: application
- **Authorization URL**:
- **Scopes**:
- video-cloud/analytics/read: Read analytics data
- video-cloud/video/read: Read video data