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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65a8e4ab4dfd79cbad952a5f13cc50f9476e3870
4
- data.tar.gz: c9bd9f01cea009299c0102f95045f74aa1cf5af0
3
+ metadata.gz: be8ffbc653473d190204430846905e63553041f3
4
+ data.tar.gz: 7d1ccf696f9838056cbf4392947ea7c63067fdf8
5
5
  SHA512:
6
- metadata.gz: 0d5d71e6b3120da4aaa013224c5c9806092ac432a78d4463a1e82ce3cc862f0e30e2ce6e77160f4f11d6c22fbdb28db416dd611ffc77aa9fe11f046e401fc22a
7
- data.tar.gz: 01d8f4ef0f6e1c7eff061f11e808604bac039415a6464fb800968848687df143d16c49d7a8584c24577dfd87edc7fbbbc61a583b1bce7893b79399c23009f808
6
+ metadata.gz: f6d90db9b1b272874158a4c7fcc20e6e15b03544c0c2f4f9a10cb7991f63aa5ec1de6943fcca20102ecb3f8c42f4654c58ab06f07d8ad9f57670502ee710260e
7
+ data.tar.gz: 3f2420d63bfba34d7d6eebf536db3b49b4ea805faa344a3f66883629fc8b659e35d13ef1d628990c897ddc4b36d55706ed123506a9052140ee97c37b07817a1e
@@ -22,6 +22,7 @@ class Jani::FromJson::Builder
22
22
  m.postroll_banner = new_postroll_banner
23
23
  m.strips = new_strips
24
24
  m.tracking_events = new_tracking_events
25
+ m.conversion_status = hashed_data["conversion_status"]
25
26
  end
26
27
  end
27
28
 
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Jani
2
2
  module FromJson
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  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
+
@@ -17,6 +17,7 @@ RSpec.describe Jani::FromJson::Builder do
17
17
  expect(movie.frame_height).to eq 360
18
18
  expect(movie.fps).to eq 13
19
19
  expect(movie.pixel_ratio).to eq 2
20
+ expect(movie.conversion_status).to eq Jani::FromJson::Movie::CONVERTED_STATUS
20
21
  end
21
22
  end
22
23
 
@@ -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.3
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-10 00:00:00.000000000 Z
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