zype 0.8.0 → 0.9.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: '09cfcc47b3341133014a7a429983075668b0fa5aa494ae7b362e00c2317752ef'
4
- data.tar.gz: 9d920a6dd3db7abe303a097e758778c724f12f5273c15527f4125dba33c7019f
3
+ metadata.gz: ab3c94af764d2e6fb176468ba82d20ef9aea562b891680c9b396b1d19c534a42
4
+ data.tar.gz: bcbd485d8cbda10523f6f6ee1d86154ef39a818276c8e5354819c0dfc50e9d3a
5
5
  SHA512:
6
- metadata.gz: 77d68d2dde62271fc59abc8519392401e5f6bc70814824395cb302250b6c36e845476b4a313b0d29bfa55ca7b7994932eae7569caaf975c946ec3e8ee72271f1
7
- data.tar.gz: 554d1bc2bdfa914881e75fa66d862e4dbdf3b9ba0c3bd17e7e6f6387cd464db052a6fcc4ce4b15818dee4c5f74ee6ba49b850713dc641f3e0858e371a4afa578
6
+ metadata.gz: c61cea2c251745b4b66dd5ff2def3caf1157f40fd97897c3b0012469458979dd1c31d5b1633e107ecf9abc4c057b2d65a9e9ec26e8319ae949d75144b9c7f2cb
7
+ data.tar.gz: f9c145409a5e6f2cb38f51e57717076a91cc9db19cea3557492dcad551d4b884ad1163dd1f216228c6031af884e0fc0e6962a5d399e79bdca61dd3330e4ae91d
@@ -5,7 +5,7 @@ module Zype
5
5
  class InvalidKey < StandardError; end
6
6
 
7
7
  def initialize(auth_method='api_key')
8
- @client = Client.new(auth_method)
8
+ @client = client_class.new(auth_method)
9
9
  @path = generate_path
10
10
  end
11
11
 
@@ -56,7 +56,7 @@ module Zype
56
56
  def auth=(auth_method)
57
57
  raise InvalidKey unless ACCEPTED_KEYS.include?(auth_method.to_sym)
58
58
 
59
- @client = Client.new(auth_method)
59
+ @client = client_class.new(auth_method)
60
60
  end
61
61
 
62
62
  private
@@ -65,5 +65,9 @@ module Zype
65
65
  split = self.class.name.split(/(?=[A-Z])/)
66
66
  split[1..split.length].join('_').downcase
67
67
  end
68
+
69
+ def client_class
70
+ Zype::ApiClient
71
+ end
68
72
  end
69
73
  end
@@ -0,0 +1,8 @@
1
+ module Zype
2
+ class ApiClient < Zype::Client
3
+ def initialize(auth_method = 'api_key')
4
+ @headers = { 'Content-Type' => 'application/json' }.merge(authentication(auth_method))
5
+ self.class.base_uri Zype.configuration.host
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Zype
2
+ class PlayerClient < Zype::Client
3
+ def initialize(auth_method = 'api_key')
4
+ @headers = { 'Content-Type' => 'application/json' }.merge(authentication(auth_method))
5
+ self.class.base_uri Zype.configuration.player_host
6
+ end
7
+ end
8
+ end
data/lib/zype/client.rb CHANGED
@@ -29,11 +29,6 @@ module Zype
29
29
  end
30
30
  end
31
31
 
32
- def initialize(auth_method='api_key')
33
- @headers = { "Content-Type" => "application/json" }.merge(authentication(auth_method))
34
- self.class.base_uri Zype.configuration.host
35
- end
36
-
37
32
  def get(path:, params: {})
38
33
  self.class.get(path, { query: params, headers: headers })
39
34
  end
@@ -1,11 +1,12 @@
1
1
  module Zype
2
2
  class Configuration
3
- attr_accessor :api_key, :host, :app_key
3
+ attr_accessor :api_key, :host, :player_host, :app_key
4
4
 
5
5
  def initialize
6
6
  @api_key = nil
7
7
  @app_key = nil
8
- @host = 'api.zype.com'
8
+ @host = 'https://api.zype.com'
9
+ @player_host = 'https://player.zype.com'
9
10
  end
10
11
  end
11
12
  end
@@ -0,0 +1,20 @@
1
+ module Zype
2
+ # This class does not support all, create, update or delete.
3
+ # To use this class, you must set Zype.configuration.player_host.
4
+ # Read more at https://docs.zype.com/v1.0/reference#live-manifests
5
+ #
6
+ # @since 0.9.0
7
+ class LiveManifests < Zype::BaseModel
8
+ %i[all create update delete].each do |mtd|
9
+ send(:define_method, mtd) do
10
+ raise NoMethodError
11
+ end
12
+ end
13
+
14
+ private
15
+
16
+ def path
17
+ @path = 'live/manifest'
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ module Zype
2
+ # This class does not support all, create, update or delete.
3
+ # To use this class, you must set Zype.configuration.player_host.
4
+ # Read more at https://docs.zype.com/v1.0/reference#vod-manifests
5
+ #
6
+ # @since 0.9.0
7
+ class Manifests < Zype::BaseModel
8
+ %i[all create update delete].each do |mtd|
9
+ send(:define_method, mtd) do
10
+ raise NoMethodError
11
+ end
12
+ end
13
+
14
+ # Returns contents of the manifest file.
15
+ #
16
+ # @param id [String] the ID of the video
17
+ # @return [String] contents of the m3u8 manifest file
18
+ def find(id:)
19
+ client.execute(method: :get, path: "/manifest/#{id}.m3u8")
20
+ end
21
+
22
+ private
23
+
24
+ def path
25
+ @path = 'manifest'
26
+ end
27
+
28
+ def client_class
29
+ Zype::PlayerClient
30
+ end
31
+ end
32
+ end
data/lib/zype.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'httparty'
2
2
  require './lib/zype/configuration.rb'
3
3
  require './lib/zype/client.rb'
4
+ require './lib/zype/client/player_client.rb'
5
+ require './lib/zype/client/api_client.rb'
4
6
  require './lib/zype/base_model.rb'
5
7
  Dir[File.join(__dir__, '../lib/zype/models', '*.rb')].each { |file| require file }
6
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zype
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zype
@@ -61,6 +61,8 @@ files:
61
61
  - lib/zype.rb
62
62
  - lib/zype/base_model.rb
63
63
  - lib/zype/client.rb
64
+ - lib/zype/client/api_client.rb
65
+ - lib/zype/client/player_client.rb
64
66
  - lib/zype/configuration.rb
65
67
  - lib/zype/models/apps.rb
66
68
  - lib/zype/models/categories.rb
@@ -68,6 +70,8 @@ files:
68
70
  - lib/zype/models/devices.rb
69
71
  - lib/zype/models/encoders.rb
70
72
  - lib/zype/models/live_events.rb
73
+ - lib/zype/models/live_manifests.rb
74
+ - lib/zype/models/manifests.rb
71
75
  - lib/zype/models/playlists.rb
72
76
  - lib/zype/models/program_guides.rb
73
77
  - lib/zype/models/subtitle_playlists.rb