blitline 2.4.0 → 2.5.0

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
  SHA1:
3
- metadata.gz: f189b41c83e0e7e5abb833e0613587a917561858
4
- data.tar.gz: 9862a959e48b6865456fabebb9cdf73a41e5d22d
3
+ metadata.gz: b7bfcc452de6885cad8b160ad5e54dbd16da71e2
4
+ data.tar.gz: 6d97c5a427fb194b611d6d3de8790d151d94babc
5
5
  SHA512:
6
- metadata.gz: b705a7bc023ead88874a856bf07d0c2b1c2bc2e91814263a74aa9a6eeaf64ac5df19a26e0a7493049c3e96c722b136169873dd6fe1ed8e8d97594e14c60069e9
7
- data.tar.gz: 9fac9adbb5e2b29ca67a2e8ab061d612013cacfd1f3fbd1561d4f4a9d2bc133a7ef6f1ced86d5c9d14919c80766d4685f2d8f37d0e0f554839476f85e301565a
6
+ metadata.gz: e0ad45e759a6daa7fdc635d798204ae0ddf50d9ea137affbbd811f25d2280619b1f92c8023638e478b03a571a23beeff38e9f77ad20df9685259deb866d18c54
7
+ data.tar.gz: 6c30a4e39a28cc1f81d43f983f09c7f0a1bbc0153ca8fbab707b556e23501cbc810f40c45a733482676c0eb10b8aa6d7cd3fa136a9b895c3202716de86df3c45
data/README.md CHANGED
@@ -53,7 +53,7 @@ This JSON contains:
53
53
 
54
54
  - Any error information that may have happened with the submit
55
55
  - A list of images
56
- - Each image has an `image_indentifier`, which is the `image_identifier` you used in the `save` params.
56
+ - Each image has an `image_identifier`, which is the `image_identifier` you used in the `save` params.
57
57
  - Each image also has an `s3_url` which is the final destination of the image (once it is done processing).
58
58
 
59
59
  ### Important! ###
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.0
1
+ 2.5.0
data/blitline.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: blitline 2.4.0 ruby lib
5
+ # stub: blitline 2.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "blitline"
9
- s.version = "2.4.0"
9
+ s.version = "2.5.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Blitline LLC"]
14
- s.date = "2014-04-02"
14
+ s.date = "2015-03-12"
15
15
  s.description = "The blitline gems provides a simple easy wrapper to the Blitline.com web api"
16
16
  s.email = "support@blitline.com"
17
17
  s.extra_rdoc_files = [
@@ -40,7 +40,7 @@ Gem::Specification.new do |s|
40
40
  ]
41
41
  s.homepage = "http://github.com/blitline-dev/blitline"
42
42
  s.licenses = ["MIT"]
43
- s.rubygems_version = "2.2.0"
43
+ s.rubygems_version = "2.4.5"
44
44
  s.summary = "Blitline provides simple image processing in the cloud"
45
45
 
46
46
  if s.respond_to? :specification_version then
data/lib/blitline.rb CHANGED
@@ -51,15 +51,25 @@ class Blitline
51
51
  def post_jobs
52
52
  validate
53
53
  result = Blitline::HttpPoster.post("http://#{@domain}.blitline.com/job", { :json => MultiJson.dump(@jobs)})
54
+ if result.is_a?(Hash)
55
+ json_result = result
56
+ else
57
+ json_result = MultiJson.load(result)
58
+ end
54
59
  @jobs = [] # clear jobs
55
- return MultiJson.load(result)
60
+ return json_result
56
61
  end
57
62
 
58
63
  def post_job_and_wait_for_poll
59
64
  validate
60
65
  raise "'post_job_with_poll' requires that there is only 1 job to submit" unless @jobs.length==1
61
66
  result = Blitline::HttpPoster.post("http://#{@domain}.blitline.com/job", { :json => MultiJson.dump(@jobs)})
62
- json_result = MultiJson.load(result)
67
+ if result.is_a?(Hash)
68
+ json_result = result
69
+ else
70
+ json_result = MultiJson.load(result)
71
+ end
72
+
63
73
  raise "Error posting job: #{result.to_s}" if result["error"]
64
74
  job_id = json_result["results"][0]["job_id"]
65
75
  return poll_job(job_id)
@@ -69,8 +79,12 @@ class Blitline
69
79
  raise "Invalid 'job_id'" unless job_id && job_id.length > 0
70
80
  url = "/listen/#{job_id}"
71
81
  response = Net::HTTP.get('cache.blitline.com', url)
72
- json_response = MultiJson.load(response)
73
- return_results = MultiJson.load(json_response["results"])
82
+ if response.is_a?(Hash)
83
+ json_result = response
84
+ else
85
+ json_result = MultiJson.load(response)
86
+ end
87
+ return_results = json_result["results"]
74
88
 
75
89
  return return_results
76
90
  end
data/test/test_service.rb CHANGED
@@ -19,19 +19,26 @@ class TestService < Test::Unit::TestCase
19
19
  should "be able to add job via hash" do
20
20
  blitline = Blitline.new
21
21
  blitline.add_job_via_hash({
22
- "application_id"=>"#{ENV['BLITLINE_APPLICATION_ID']}",
23
- "src"=>"http://cdn.blitline.com/filters/boys.jpeg",
24
- "functions"=>[
25
- {
26
- "name"=>"resize_to_fit",
27
- "params"=>{
28
- "width"=>100
29
- },
30
- "save"=>{
31
- "image_identifier"=>"MY_CLIENT_ID"
32
- }
33
- }
34
- ]
22
+ "application_id"=> "#{ENV['BLITLINE_APPLICATION_ID']}",
23
+ "src"=> SAMPLE_IMAGE_SRC,
24
+ "src_data" => { "colorspace" => "srgb"},
25
+ "postback_url" => "http=>//YOUR_POSTBACK_URL",
26
+ "wait_retry_delay"=> 5,
27
+ "retry_postback" => true,
28
+ "get_exif" => true,
29
+ "v" => 1.20,
30
+ "functions"=> [
31
+ {
32
+ "name"=> "resize_to_fit",
33
+ "params"=> {
34
+ "width"=> 100,
35
+ "autosharpen"=> true
36
+ },
37
+ "save"=> {
38
+ "image_identifier"=> "MY_CLIENT_ID"
39
+ }
40
+ }
41
+ ]
35
42
  })
36
43
 
37
44
 
@@ -43,19 +50,23 @@ class TestService < Test::Unit::TestCase
43
50
  should "be able to add job via hash and wait for polling" do
44
51
  blitline = Blitline.new
45
52
  blitline.add_job_via_hash({
46
- "application_id"=>"#{ENV['BLITLINE_APPLICATION_ID']}",
47
- "src"=>"http://cdn.blitline.com/filters/boys.jpeg",
48
- "functions"=>[
49
- {
50
- "name"=>"resize_to_fit",
51
- "params"=>{
52
- "width"=>100
53
- },
54
- "save"=>{
55
- "image_identifier"=>"MY_CLIENT_ID"
56
- }
57
- }
58
- ]
53
+ "application_id"=> "#{ENV['BLITLINE_APPLICATION_ID']}",
54
+ "src"=> SAMPLE_IMAGE_SRC,
55
+ "src_data" => { "colorspace" => "srgb"},
56
+ "get_exif" => true,
57
+ "v" => 1.20,
58
+ "functions"=> [
59
+ {
60
+ "name"=> "resize_to_fit",
61
+ "params"=> {
62
+ "width"=> 100,
63
+ "autosharpen"=> true
64
+ },
65
+ "save"=> {
66
+ "image_identifier"=> "MY_CLIENT_ID"
67
+ }
68
+ }
69
+ ]
59
70
  })
60
71
 
61
72
 
@@ -68,7 +79,7 @@ class TestService < Test::Unit::TestCase
68
79
  blitline = Blitline.new
69
80
  blitline.add_job_via_hash({
70
81
  "application_id"=>"#{ENV['BLITLINE_APPLICATION_ID']}",
71
- "src"=>"http://cdn.blitline.com/filters/boys.jpeg",
82
+ "src"=>SAMPLE_IMAGE_SRC,
72
83
  "functions"=>[
73
84
  {
74
85
  "name"=>"resize_to_fit",
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blitline
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blitline LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2015-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: shoulda
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jeweler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: The blitline gems provides a simple easy wrapper to the Blitline.com
@@ -61,7 +61,7 @@ extra_rdoc_files:
61
61
  - LICENSE.txt
62
62
  - README.md
63
63
  files:
64
- - .document
64
+ - ".document"
65
65
  - Gemfile
66
66
  - Gemfile.lock
67
67
  - LICENSE.txt
@@ -89,17 +89,17 @@ require_paths:
89
89
  - lib
90
90
  required_ruby_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - '>='
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - '>='
97
+ - - ">="
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.2.0
102
+ rubygems_version: 2.4.5
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Blitline provides simple image processing in the cloud