wowza_rest 0.2.4 → 0.2.5
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 +4 -4
- data/lib/wowza_rest/core_ext/string/inflections.rb +5 -0
- data/lib/wowza_rest/data/base.rb +1 -14
- data/lib/wowza_rest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89eb5684e859dcfbe05bdcdade2bdc22f519f42e
|
4
|
+
data.tar.gz: 23afe1384d9dbabf0342f0fe64c9c9a9db8da6df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ae3e10d7f7bb531facddad25571d4bfc06ef2dbc96035b5561a6a89f2495746f9f97b8c1823438c4935b9823effa8ab2ca4f30c4c68295ab7ed9b9b0ea412be
|
7
|
+
data.tar.gz: 0231303f151fcdbef558660d6fcf235de5f059371cab70ce839334fe3b6bfbc1907e7b54a57aae0533665c4adb09c764d7f1a479a211f022bcc505dea6b0258b
|
@@ -2,11 +2,16 @@ module WowzaRest
|
|
2
2
|
module CoreExt
|
3
3
|
module String
|
4
4
|
module Inflections
|
5
|
+
# its mainly used when converting json attrs to getters/setters methods
|
6
|
+
# wowza rest api responses sometimes have attributes that contains dots
|
7
|
+
# and this causes problems when trying to convert it to a method
|
8
|
+
# thats why i have to replace all dots with underscores
|
5
9
|
def underscore
|
6
10
|
gsub(/::/, '/')
|
7
11
|
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
8
12
|
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
9
13
|
.tr('-', '_')
|
14
|
+
.tr('.', '_')
|
10
15
|
.downcase
|
11
16
|
end
|
12
17
|
|
data/lib/wowza_rest/data/base.rb
CHANGED
@@ -7,25 +7,12 @@ module WowzaRest
|
|
7
7
|
|
8
8
|
def setup_attributes(attrs)
|
9
9
|
attrs.each do |k, v|
|
10
|
-
|
11
|
-
define_attribute_setter(k.to_s.underscore)
|
10
|
+
singleton_class.send(:attr_accessor, k.to_s.underscore)
|
12
11
|
define_key_getter(k.to_s)
|
13
12
|
instance_variable_set("@#{k.to_s.underscore}", v)
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
17
|
-
def define_attribute_getter(attr_name)
|
18
|
-
define_singleton_method(attr_name.to_s) do
|
19
|
-
instance_variable_get("@#{attr_name}")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def define_attribute_setter(attr_name)
|
24
|
-
define_singleton_method("#{attr_name}=") do |value|
|
25
|
-
instance_variable_set("@#{attr_name}", value)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
16
|
def define_key_getter(key)
|
30
17
|
define_singleton_method("#{key.underscore}_key") do
|
31
18
|
key.to_s
|
data/lib/wowza_rest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wowza_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hazem Taha
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|