zype 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 57fe0dfb7717b479c07e248e6f8f8d207fd6bf912d268b7fb962326ab6a09d20
4
- data.tar.gz: 3ce711104f8a2ca52919b1f25e4f229b831c0b69e0e7b8f2e832380932631509
3
+ metadata.gz: f6a83161353227a70c18cd571b23126a7490f0631d3ed5e9423f6ff1b7b90be9
4
+ data.tar.gz: 2d12bfb3aca2159aca259896183ae92e606c59441eb17d99929bde81d0c47f0f
5
5
  SHA512:
6
- metadata.gz: 76401b9bc09baba4c972939a115dd74aeca7749681b8fefb9c6ee5fb619207777aff832b5bcedb937fe3b6a31fff5b87e22c2a7e331f440385238ecbca083a4a
7
- data.tar.gz: 3ae653edf12bec378b0d3532ffd3ab4444e1152d4a1c38e72505bd5602badb8ccb490dafb65aa94039d3b6d3836d882ff506a38fb42426ccb44098d53e511a19
6
+ metadata.gz: 8b452cedd9e87bb8b109ab688c06c8945254553d21629d4c37c14cb3df21a6237b72b749c0ff8c2413921899dec88e54ac8fb649d444deb975d2183c20c4858f
7
+ data.tar.gz: b73930a2877257e6be4a37dac95e31417438265e0b4018c1f1e1506790d14fa453e9ba6ffdafcf755ceaeaba1217cf511865c84bbc919a2c6693f54bea2386b1
@@ -5,6 +5,7 @@ require 'zype/client.rb'
5
5
  require 'zype/client/player_client.rb'
6
6
  require 'zype/client/api_client.rb'
7
7
  require 'zype/client/login_client.rb'
8
+ require 'zype/client/analytics_client.rb'
8
9
  require 'zype/base_model.rb'
9
10
 
10
11
  Dir[File.join(__dir__, '../lib/zype/models/base', '*.rb')].each { |file| require file }
@@ -0,0 +1,13 @@
1
+ module Zype
2
+ class AnalyticsClient < Zype::Client
3
+ def initialize(auth_method = 'api_key')
4
+ @headers = { 'Content-Type' => 'application/json' }
5
+ self.class.base_uri Zype.configuration.analytics_host
6
+ end
7
+
8
+ def get(path:, params:)
9
+ params.merge!(api_key: Zype.configuration.api_key)
10
+ super(path: path, params: params)
11
+ end
12
+ end
13
+ end
@@ -1,6 +1,6 @@
1
1
  module Zype
2
2
  class Configuration
3
- attr_accessor :api_key, :host, :player_host, :login_host, :app_key
3
+ attr_accessor :api_key, :host, :player_host, :login_host, :analytics_host, :app_key
4
4
 
5
5
  def initialize
6
6
  @api_key = nil
@@ -8,6 +8,7 @@ module Zype
8
8
  @host = 'https://api.zype.com'
9
9
  @player_host = 'https://player.zype.com'
10
10
  @login_host = 'https://login.zype.com'
11
+ @analytics_host = 'https://analytics.zype.com/v2'
11
12
  end
12
13
  end
13
14
  end
@@ -1,7 +1,7 @@
1
1
  module Zype
2
2
  class Models
3
3
  # Have to list out available methods instead of using Dir
4
- LIST = %w[ad_tags apps categories category_content_rules consumers device_categories devices encoders geo_ip live_events
4
+ LIST = %w[ad_tags apps analytics categories category_content_rules consumers device_categories devices encoders geo_ip live_events
5
5
  live_manifests manifests oauth pin plans players playlist_content_rules playlist_entitlements playlists
6
6
  program_guides redemption_codes revenue_models segments subscriptions subtitle_playlists subtitles
7
7
  transactions users video_content_rules video_entitlements videos video_favorites video_imports video_sources
@@ -0,0 +1,36 @@
1
+ module Zype
2
+ # This class only supports stream_hours
3
+ # Read more at https://docs.zype.com/v1.0/reference#stream-hours
4
+ #
5
+ # @since 0.20.0
6
+ class Analytics < BaseModel
7
+ # Returns all objects for given class
8
+ #
9
+ # @example params object might look like:
10
+ # params = {
11
+ # filters: {
12
+ # start_date_gte: "2018-08-12 10:00",
13
+ # start_date_lte: "2018-08-13"
14
+ # },
15
+ # group_by: ['video_id']
16
+ # },
17
+ # view_mode: 'detailed'
18
+ # }
19
+ # @param params [Hash] the metadata to filter objects by
20
+ # @return [Hash] "data" will be the key, pointing to an array
21
+ # @example
22
+ # # Return value
23
+ # {
24
+ # "data" => []
25
+ # }
26
+ def stream_hours(params: {})
27
+ client.execute(method: :get, path: '/stream_hours', params: params)
28
+ end
29
+
30
+ private
31
+
32
+ def client_class
33
+ Zype::AnalyticsClient
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zype
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zype
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-15 00:00:00.000000000 Z
11
+ date: 2018-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -61,12 +61,14 @@ files:
61
61
  - lib/zype.rb
62
62
  - lib/zype/base_model.rb
63
63
  - lib/zype/client.rb
64
+ - lib/zype/client/analytics_client.rb
64
65
  - lib/zype/client/api_client.rb
65
66
  - lib/zype/client/login_client.rb
66
67
  - lib/zype/client/player_client.rb
67
68
  - lib/zype/configuration.rb
68
69
  - lib/zype/models.rb
69
70
  - lib/zype/models/ad_tags.rb
71
+ - lib/zype/models/analytics.rb
70
72
  - lib/zype/models/apps.rb
71
73
  - lib/zype/models/base/categories.rb
72
74
  - lib/zype/models/base/consumers.rb