zype 0.16.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4afccc340e62d6947fec19080637ec27f6f501a7a96bd0c84dc20e1716a7769
4
- data.tar.gz: 4db536c7d6e31f47f919ac694eb16f190a724c79de8e904c8d092473d42e7a5f
3
+ metadata.gz: 27b72e9b7862c10fded9d1cf4aa57c0687bd511053dbecebf3363c064227baef
4
+ data.tar.gz: b5bd51a277e029f6540a4f348b0d7f4200320afb2cfa301cd29a03e0e8597a4b
5
5
  SHA512:
6
- metadata.gz: 65698edb8e1682f56f5022768e6645ea761e9fc5ba89c16a1aa564775946b258f513456e34fa441014e08f229f320fda121b9978c66fc0ae25eee0063b1c2228
7
- data.tar.gz: 2d31a179e13e46eb12b95d21cf654398b98781f85249ff6100727b7373e6c5c10efc9b7c74ba11c0c42cabd2c19e6739cd1e2085079b96c6397a71b0960645b2
6
+ metadata.gz: 4c4007e71f908355a5ec2de9009eaa44ab6d0a7d61cf5499ee9216b459719c0b301113d933f8e4bf6fbd985a536a3b290c435f7d6340a204f64941538e09512d
7
+ data.tar.gz: 0f124c89a3cd8b988fe5aa1a8d971102910b537349e45129221a50b2853881b184e50b68bcc1da15bea2a4cca73f79718f7405d2e3895d74bbf6d28c05d830fc
data/lib/zype/client.rb CHANGED
@@ -18,31 +18,30 @@ module Zype
18
18
  500 => ServerError
19
19
  }.freeze
20
20
 
21
- # Automatically converts all files in lib/zype/models to be used as methods
21
+ # Converts all files in lib/zype/models to be used as methods
22
22
  class << self
23
- Dir["lib/zype/models/*.rb"].each do |file|
24
- model = file[/.*\/(.*?).rb$/, 1]
23
+ Models::LIST.each do |model|
25
24
  define_method model do
26
- constant = model.split("_").map { |s| s.capitalize }.join("")
25
+ constant = model.split('_').map(&:capitalize).join('')
27
26
  Module.const_get("Zype::#{constant}").new
28
27
  end
29
28
  end
30
29
  end
31
30
 
32
31
  def get(path:, params: {})
33
- self.class.get(path, { query: params, headers: headers })
32
+ self.class.get(path, query: params, headers: headers)
34
33
  end
35
34
 
36
35
  def post(path:, params: {})
37
- self.class.post(path, { query: params, headers: headers })
36
+ self.class.post(path, query: params, headers: headers)
38
37
  end
39
38
 
40
39
  def put(path:, params: {})
41
- self.class.put(path, { query: params, headers: headers })
40
+ self.class.put(path, query: params, headers: headers)
42
41
  end
43
42
 
44
43
  def delete(path:, params: _)
45
- self.class.delete(path, { headers: headers })
44
+ self.class.delete(path, headers: headers)
46
45
  end
47
46
 
48
47
  def execute(method:, path:, params: {})
@@ -50,7 +49,7 @@ module Zype
50
49
  raise NoApiKey if Zype.configuration.app_key.to_s.empty?
51
50
  end
52
51
 
53
- resp = self.send(method, path: path, params: params)
52
+ resp = send(method, path: path, params: params)
54
53
  if resp.success?
55
54
  resp['response'].nil? ? resp.parsed_response : resp['response']
56
55
  else
@@ -0,0 +1,10 @@
1
+ module Zype
2
+ class Models
3
+ # Have to list out available methods instead of using Dir
4
+ LIST = %w[apps categories category_content_rules consumers device_categories devices encoders geo_ip live_events
5
+ live_manifests manifests pin plans players playlist_content_rules playlist_entitlements playlists
6
+ program_guides segments subscriptions subtitle_playlists subtitles transactions users video_content_rules
7
+ video_entitlements video_imports video_sources videos
8
+ ].freeze
9
+ end
10
+ end
data/lib/zype.rb CHANGED
@@ -1,9 +1,11 @@
1
1
  require 'httparty'
2
- require './lib/zype/configuration.rb'
3
- require './lib/zype/client.rb'
4
- require './lib/zype/client/player_client.rb'
5
- require './lib/zype/client/api_client.rb'
6
- require './lib/zype/base_model.rb'
2
+ require 'zype/configuration.rb'
3
+ require 'zype/models.rb'
4
+ require 'zype/client.rb'
5
+ require 'zype/client/player_client.rb'
6
+ require 'zype/client/api_client.rb'
7
+ require 'zype/base_model.rb'
8
+
7
9
  Dir[File.join(__dir__, '../lib/zype/models/base', '*.rb')].each { |file| require file }
8
10
  Dir[File.join(__dir__, '../lib/zype/models', '*.rb')].each { |file| require file }
9
11
 
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.16.0
4
+ version: 0.16.1
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-06 00:00:00.000000000 Z
11
+ date: 2018-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -64,6 +64,7 @@ files:
64
64
  - lib/zype/client/api_client.rb
65
65
  - lib/zype/client/player_client.rb
66
66
  - lib/zype/configuration.rb
67
+ - lib/zype/models.rb
67
68
  - lib/zype/models/apps.rb
68
69
  - lib/zype/models/base/categories.rb
69
70
  - lib/zype/models/base/consumers.rb