jani-from_json 0.0.3 → 0.0.4
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/jani/from_json/builder.rb +1 -0
- data/lib/jani/from_json/movie.rb +26 -1
- data/lib/jani/from_json/version.rb +1 -1
- data/spec/factories/movies.rb +17 -0
- data/spec/jani/from_json/builder_spec.rb +1 -0
- data/spec/jani/from_json/movie_spec.rb +31 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be8ffbc653473d190204430846905e63553041f3
|
4
|
+
data.tar.gz: 7d1ccf696f9838056cbf4392947ea7c63067fdf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6d90db9b1b272874158a4c7fcc20e6e15b03544c0c2f4f9a10cb7991f63aa5ec1de6943fcca20102ecb3f8c42f4654c58ab06f07d8ad9f57670502ee710260e
|
7
|
+
data.tar.gz: 3f2420d63bfba34d7d6eebf536db3b49b4ea805faa344a3f66883629fc8b659e35d13ef1d628990c897ddc4b36d55706ed123506a9052140ee97c37b07817a1e
|
data/lib/jani/from_json/movie.rb
CHANGED
@@ -7,10 +7,35 @@ class Jani::FromJson::Movie
|
|
7
7
|
:loading_banner,
|
8
8
|
:postroll_banner,
|
9
9
|
:strips,
|
10
|
-
:tracking_events
|
10
|
+
:tracking_events,
|
11
|
+
:conversion_status
|
12
|
+
|
13
|
+
CONVERTED_STATUS = "converted"
|
14
|
+
CONVERTING_STATUS = "converting"
|
15
|
+
ERROR_STATUS = "error"
|
11
16
|
|
12
17
|
def initialize
|
13
18
|
@strips = []
|
14
19
|
@tracking_events =[]
|
15
20
|
end
|
21
|
+
|
22
|
+
def display_height
|
23
|
+
frame_height / pixel_ratio
|
24
|
+
end
|
25
|
+
|
26
|
+
def display_width
|
27
|
+
frame_width / pixel_ratio
|
28
|
+
end
|
29
|
+
|
30
|
+
def ready?
|
31
|
+
conversion_status == CONVERTED_STATUS
|
32
|
+
end
|
33
|
+
|
34
|
+
def error?
|
35
|
+
conversion_status == ERROR_STATUS
|
36
|
+
end
|
37
|
+
|
38
|
+
def converting?
|
39
|
+
conversion_status == CONVERTING_STATUS
|
40
|
+
end
|
16
41
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "jani/from_json/movie"
|
2
|
+
|
3
|
+
FactoryGirl.define do
|
4
|
+
factory :movie, class: Jani::FromJson::Movie do
|
5
|
+
uuid "cfcce0c6-e046-429f-89c0-8a24202ecf89"
|
6
|
+
frame_height 360
|
7
|
+
frame_width 640
|
8
|
+
fps 13
|
9
|
+
pixel_ratio 2
|
10
|
+
loading_banner nil
|
11
|
+
postroll_banner nil
|
12
|
+
strips []
|
13
|
+
tracking_events []
|
14
|
+
conversion_status Jani::FromJson::Movie::CONVERTED_STATUS
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "jani/from_json/movie"
|
3
|
+
|
4
|
+
RSpec.describe Jani::FromJson::Movie do
|
5
|
+
let(:movie) { build(:movie) }
|
6
|
+
|
7
|
+
describe "display size" do
|
8
|
+
it "returns display size not pixel size" do
|
9
|
+
expect(movie.display_width).to eq 320
|
10
|
+
expect(movie.display_height).to eq 180
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "statuses" do
|
15
|
+
subject { movie }
|
16
|
+
|
17
|
+
context "when converted" do
|
18
|
+
it { is_expected.to be_ready }
|
19
|
+
end
|
20
|
+
|
21
|
+
context "when error" do
|
22
|
+
before { movie.conversion_status = Jani::FromJson::Movie::ERROR_STATUS }
|
23
|
+
it { is_expected.to be_error }
|
24
|
+
end
|
25
|
+
|
26
|
+
context "when converting" do
|
27
|
+
before { movie.conversion_status = Jani::FromJson::Movie::CONVERTING_STATUS }
|
28
|
+
it { is_expected.to be_converting }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jani-from_json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ohno Shin'ichi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -119,8 +119,10 @@ files:
|
|
119
119
|
- lib/jani/from_json/tracking_event.rb
|
120
120
|
- lib/jani/from_json/version.rb
|
121
121
|
- spec/factories/builders.rb
|
122
|
+
- spec/factories/movies.rb
|
122
123
|
- spec/jani/from_json/builder_spec.rb
|
123
124
|
- spec/jani/from_json/from_json_spec.rb
|
125
|
+
- spec/jani/from_json/movie_spec.rb
|
124
126
|
- spec/spec_helper.rb
|
125
127
|
homepage: ''
|
126
128
|
licenses:
|
@@ -148,6 +150,8 @@ specification_version: 4
|
|
148
150
|
summary: Convert JSON data into jani structured movie object.
|
149
151
|
test_files:
|
150
152
|
- spec/factories/builders.rb
|
153
|
+
- spec/factories/movies.rb
|
151
154
|
- spec/jani/from_json/builder_spec.rb
|
152
155
|
- spec/jani/from_json/from_json_spec.rb
|
156
|
+
- spec/jani/from_json/movie_spec.rb
|
153
157
|
- spec/spec_helper.rb
|