zype 0.14.0 → 0.15.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: e6aa476ba1a7c66b8b862c0d8b0c4188b284f456867a8d27f1fd8dca67c9acf5
4
- data.tar.gz: 4c62eaddf5f63790de3d4fddd58abc7fa5cadf948e913864131dbd7c4de58a44
3
+ metadata.gz: 7cf3e8bab00adde7d7df2a29e8fe5a4a137e1d40da387980e60a1ca7f936f975
4
+ data.tar.gz: 5c10d9d038c052871c85b7e616ba3d0d2e77ec55065f2463aa343a5510fcd79e
5
5
  SHA512:
6
- metadata.gz: 84a8db7a16bcae3e26763bd099bd4c38fd9d94c8a86c4d6b0a9da3ba80fd080f3763c0518f15a2f277b8fcb0946b36b6eba9f5a3b013220ffec56fac88da60e9
7
- data.tar.gz: 527240894196c6be30a830e876e6b9c73be1c495fd5c695e0923a6dafc2a28c65d0dec8ff424b50f8d93a59e4fa9d38480a51986c2ae6b846207c55edcf81848
6
+ metadata.gz: 7c856392db6e1eec43f4c7cdedc4d1bcbf666868e3ecd56591e1cf035bd913e2701882c79c2f0e6e56215205b902961b9d2d2b5b88cc15cffc879027b8779748
7
+ data.tar.gz: 743bfadd075b9249f18b15d89ec6e7277f2d9df0fe7d032df45f94452c7f06e4117ed3526947100b5f729f1de23b0b63f1cbb6f316f04adebd3bce73fbe6df6c
@@ -0,0 +1,50 @@
1
+ module Zype
2
+ module Base
3
+ # Any consumer nested routes will inherit from this class
4
+ class Consumers < Zype::BaseModel
5
+ # Returns all objects for given class
6
+ #
7
+ # @param consumer_id [String] the ID of the consumer
8
+ # @return [Array<Hash>] the objects returned from the API
9
+ def all(consumer_id:)
10
+ client.execute(method: :get, path: "/consumers/#{consumer_id}/#{path}")
11
+ end
12
+
13
+ # Returns object matching ID
14
+ #
15
+ # @param consumer_id [String] the ID of the consumer
16
+ # @param id [String] the ID of the object
17
+ # @return [Hash] the object returned from the API
18
+ def find(consumer_id:, id:)
19
+ client.execute(method: :get, path: "/consumers/#{consumer_id}/#{path}/#{id}")
20
+ end
21
+
22
+ # Creates a new object via the API.
23
+ #
24
+ # @param consumer_id [String] ID of the consumer to assign to the object
25
+ # @param params [Hash] the properties of the object
26
+ # @return [Hash] the newly created object
27
+ def create(consumer_id:, params:)
28
+ client.execute(method: :post, path: "/consumers/#{consumer_id}/#{path}", params: params)
29
+ end
30
+
31
+ # Updates an existing object via the API
32
+ #
33
+ # @param consumer_id [String] the ID of the consumer
34
+ # @param params [Hash] the properties to be updated
35
+ # @return [Hash] the updated object
36
+ def update(consumer_id:, id:, params:)
37
+ client.execute(method: :put, path: "/consumers/#{consumer_id}/#{path}/#{id}", params: params)
38
+ end
39
+
40
+ # Deletes an existing object via the API
41
+ #
42
+ # @param consumer_id [String] the ID of the consumer
43
+ # @param id [String] the ID of the object
44
+ # @return [Hash] the deleted object
45
+ def delete(consumer_id:, id:)
46
+ client.execute(method: :delete, path: "/consumers/#{consumer_id}/#{path}/#{id}")
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,15 @@
1
+ module Zype
2
+ # Read more at https://docs.zype.com/v1.0/reference#consumers
3
+ #
4
+ # @since 0.15.0
5
+ class Consumers < Zype::BaseModel
6
+ # Initiate consumer forgot password flow.
7
+ # Consumer will receive forgot password email.
8
+ #
9
+ # @param email [String] email of the consumer
10
+ # @return [Hash] the consumer returned from the API
11
+ def forgot_password(email:)
12
+ client.execute(method: :put, path: "/#{path}/forgot_password", params: { email: email })
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,33 @@
1
+ module Zype
2
+ # Read more at https://docs.zype.com/v1.0/reference#device-linking
3
+ #
4
+ # @since 0.15.0
5
+ class Pin < Zype::BaseModel
6
+ # Retrieve the pin for the device
7
+ #
8
+ # @param linked_device_id [String]
9
+ # @return [Hash] the device pin
10
+ def status(linked_device_id:)
11
+ client.execute(method: :get, path: '/pin/status', params: { linked_device_id: linked_device_id })
12
+ end
13
+
14
+ # Create the device pin
15
+ #
16
+ # @param linked_device_id [String]
17
+ # @return [Hash] the device pin
18
+ def acquire(linked_device_id:)
19
+ client.execute(method: :post, path: '/pin/acquire', params: { linked_device_id: linked_device_id })
20
+ end
21
+
22
+ #
23
+ # @return [Hash] the consumer
24
+ def link(consumer_id:, pin:)
25
+ client.execute(method: :put, path: '/pin/link', params: { consumer_id: consumer_id, pin: pin })
26
+ end
27
+
28
+ # @return [Hash] the consumer
29
+ def unlink(consumer_id:, pin:)
30
+ client.execute(method: :put, path: '/pin/unlink', params: { consumer_id: consumer_id, pin: pin })
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,13 @@
1
+ module Zype
2
+ # Read more at https://docs.zype.com/v1.0/reference#playlist-entitlements
3
+ #
4
+ # @since 0.15.0
5
+ class PlaylistEntitlements < Zype::Base::Consumers
6
+
7
+ private
8
+
9
+ def path
10
+ @path = 'playlists'
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ module Zype
2
+ # Read more at https://docs.zype.com/v1.0/reference#video-entitlements
3
+ #
4
+ # @since 0.15.0
5
+ class VideoEntitlements < Zype::Base::Consumers
6
+ # Checks if the consumer is entitled to watch the video
7
+ #
8
+ # @param video_id [String] ID of the video
9
+ # @param access_token [String] Access token used to identify the consumer
10
+ # @return Hash
11
+ def entitled(video_id:, access_token:)
12
+ client.execute(method: :get, path: "/videos/#{video_id}/entitled", params: { access_token: access_token })
13
+ end
14
+
15
+ def path
16
+ @path = 'videos'
17
+ end
18
+ end
19
+ 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.14.0
4
+ version: 0.15.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-01 00:00:00.000000000 Z
11
+ date: 2018-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -66,10 +66,12 @@ files:
66
66
  - lib/zype/configuration.rb
67
67
  - lib/zype/models/apps.rb
68
68
  - lib/zype/models/base/categories.rb
69
+ - lib/zype/models/base/consumers.rb
69
70
  - lib/zype/models/base/playlists.rb
70
71
  - lib/zype/models/base/videos.rb
71
72
  - lib/zype/models/categories.rb
72
73
  - lib/zype/models/category_content_rules.rb
74
+ - lib/zype/models/consumers.rb
73
75
  - lib/zype/models/device_categories.rb
74
76
  - lib/zype/models/devices.rb
75
77
  - lib/zype/models/encoders.rb
@@ -77,8 +79,10 @@ files:
77
79
  - lib/zype/models/live_events.rb
78
80
  - lib/zype/models/live_manifests.rb
79
81
  - lib/zype/models/manifests.rb
82
+ - lib/zype/models/pin.rb
80
83
  - lib/zype/models/players.rb
81
84
  - lib/zype/models/playlist_content_rules.rb
85
+ - lib/zype/models/playlist_entitlements.rb
82
86
  - lib/zype/models/playlists.rb
83
87
  - lib/zype/models/program_guides.rb
84
88
  - lib/zype/models/segments.rb
@@ -86,6 +90,7 @@ files:
86
90
  - lib/zype/models/subtitles.rb
87
91
  - lib/zype/models/users.rb
88
92
  - lib/zype/models/video_content_rules.rb
93
+ - lib/zype/models/video_entitlements.rb
89
94
  - lib/zype/models/video_imports.rb
90
95
  - lib/zype/models/video_sources.rb
91
96
  - lib/zype/models/videos.rb