wes-data-api 4.4.0 → 4.5.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 +4 -4
- data/lib/wes/data/api/brand_user.rb +31 -0
- data/lib/wes/data/api/configuration.rb +1 -1
- data/lib/wes/data/api/model/brand_user.rb +20 -0
- data/lib/wes/data/api/model/video.rb +34 -0
- data/lib/wes/data/api/routes.rb +14 -13
- data/lib/wes/data/api.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f94f4d3ef30177c2c73c99a6eac23d02b5d5dbd
|
4
|
+
data.tar.gz: 4d60e0e3b484699c9a6a0507ea639630a5a85b86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 804404336bf089b5e9330c1baf7fd2b54b8dad120966fd961c32aa971b9c341df1d96e6b49a94b182e5ae20a7a8ccbdef95ec88f9b150e558baec32fbee0c371
|
7
|
+
data.tar.gz: 7987296d3a0b47696440276b6ae86caa393a09ca886f325066c203bb722a41f7ee77bababbf1881cf30d95dbb3c2b477d5f99acd1b0aa069f742917bd0e2c193
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "wes/data/api/base"
|
2
|
+
require "wes/data/api/model/brand_user"
|
3
|
+
|
4
|
+
module Wes
|
5
|
+
module Data
|
6
|
+
module API
|
7
|
+
class BrandUser
|
8
|
+
class << self
|
9
|
+
include Base
|
10
|
+
|
11
|
+
def create(data)
|
12
|
+
attributes = client.post(routes.brand_user, data).first
|
13
|
+
attributes.nil? ? nil : model_klass.new(attributes)
|
14
|
+
end
|
15
|
+
|
16
|
+
def find(_key, value)
|
17
|
+
route = [routes.brand_user, value].join("/")
|
18
|
+
attributes = client.get(route).first
|
19
|
+
attributes.nil? ? nil : model_klass.new(attributes)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def model_klass
|
25
|
+
Wes::Data::API::Model::BrandUser
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "wes/data/api/model/base"
|
2
|
+
|
3
|
+
module Wes
|
4
|
+
module Data
|
5
|
+
module API
|
6
|
+
module Model
|
7
|
+
class BrandUser < Base
|
8
|
+
def update(changes)
|
9
|
+
route = [routes.brand_user, id].join("/")
|
10
|
+
attributes = client.put(
|
11
|
+
route, attributes.to_h.merge(changes)
|
12
|
+
).first
|
13
|
+
|
14
|
+
self
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -9,6 +9,18 @@ module Wes
|
|
9
9
|
update(:caption => edit)
|
10
10
|
end
|
11
11
|
|
12
|
+
def thumbnail
|
13
|
+
@thumbnail_state ||= video_state("gif", "_00001.png")
|
14
|
+
end
|
15
|
+
|
16
|
+
def web_format
|
17
|
+
@web_state ||= video_state("mp4", ".mp4")
|
18
|
+
end
|
19
|
+
|
20
|
+
def gif
|
21
|
+
@gif_state ||= video_state("gif", ".gif")
|
22
|
+
end
|
23
|
+
|
12
24
|
private
|
13
25
|
|
14
26
|
def update(changes)
|
@@ -19,6 +31,28 @@ module Wes
|
|
19
31
|
|
20
32
|
self
|
21
33
|
end
|
34
|
+
|
35
|
+
def video_state(type, suffix)
|
36
|
+
route = [routes.video, id, "state", type].join("/")
|
37
|
+
video_state = client.get(route).first
|
38
|
+
video_transcoded?(video_state) ? generate_filename(suffix) : nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def video_transcoded?(video_state)
|
42
|
+
video_state && video_state.state == "complete"
|
43
|
+
end
|
44
|
+
|
45
|
+
def generate_filename(suffix)
|
46
|
+
"#{filename_hash}/#{filename_suffix}#{suffix}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def filename_hash
|
50
|
+
filename.split(".").first
|
51
|
+
end
|
52
|
+
|
53
|
+
def filename_suffix
|
54
|
+
configuration.transcoded_video_filename_suffix
|
55
|
+
end
|
22
56
|
end
|
23
57
|
end
|
24
58
|
end
|
data/lib/wes/data/api/routes.rb
CHANGED
@@ -5,19 +5,20 @@ module Wes
|
|
5
5
|
class << self
|
6
6
|
def hash
|
7
7
|
OpenStruct.new(
|
8
|
-
:billing
|
9
|
-
:brand
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
8
|
+
:billing => "billing",
|
9
|
+
:brand => "brand",
|
10
|
+
:brand_user => "brand-user",
|
11
|
+
:brands => "brands",
|
12
|
+
:challenge => "challenge",
|
13
|
+
:challenges => "challenges",
|
14
|
+
:collectives => "collectives",
|
15
|
+
:creator_user => "creator-user",
|
16
|
+
:rewards => "rewards",
|
17
|
+
:submission => "submission",
|
18
|
+
:submissions => "submissions",
|
19
|
+
:users => "users",
|
20
|
+
:video => "video",
|
21
|
+
:videos => "videos"
|
21
22
|
)
|
22
23
|
end
|
23
24
|
end
|
data/lib/wes/data/api.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wes-data-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/wes/data/api/base.rb
|
121
121
|
- lib/wes/data/api/billing.rb
|
122
122
|
- lib/wes/data/api/brand.rb
|
123
|
+
- lib/wes/data/api/brand_user.rb
|
123
124
|
- lib/wes/data/api/challenge.rb
|
124
125
|
- lib/wes/data/api/client.rb
|
125
126
|
- lib/wes/data/api/collective.rb
|
@@ -129,6 +130,7 @@ files:
|
|
129
130
|
- lib/wes/data/api/model/base.rb
|
130
131
|
- lib/wes/data/api/model/billing.rb
|
131
132
|
- lib/wes/data/api/model/brand.rb
|
133
|
+
- lib/wes/data/api/model/brand_user.rb
|
132
134
|
- lib/wes/data/api/model/challenge.rb
|
133
135
|
- lib/wes/data/api/model/challenge_reward.rb
|
134
136
|
- lib/wes/data/api/model/collective.rb
|