blitline 1.2.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +9 -24
- data/VERSION +1 -1
- data/blitline.gemspec +2 -2
- data/lib/blitline/function.rb +2 -2
- data/lib/blitline/s3_destination.rb +4 -2
- data/lib/blitline/save.rb +2 -2
- data/test/test_service.rb +13 -0
- metadata +13 -13
data/README.rdoc
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
Getting Started
|
2
|
+
|
2
3
|
You must first have a Blitline.com account to successfully use the gem. You can obtain one (free) by going to http://www.blitline.com
|
3
4
|
|
4
5
|
Once you have your account, you will need to find you ACCOUNT_ID which you can get by logging in and clicking on the *Account* tab.
|
@@ -14,10 +15,11 @@ or...if you have a Gemfile
|
|
14
15
|
|
15
16
|
Once the gem is installed, you can start a Rails console and try the following:
|
16
17
|
|
17
|
-
$
|
18
|
-
$ job = Blitline::Job.new("http://www.google.com/logos/2011/yokoyama11-hp.jpg") #My source file to manipulate
|
18
|
+
$ job = Blitline::Job.new("http://www.google.com/logos/2011/yokoyama11-hp.jpg") # My source file to manipulate
|
19
19
|
$ job.application_id = "ACCOUNT_ID" # This ACCOUNT_ID needs to be your account ID from Blitline which you got from Blitline.com above
|
20
|
-
$ job.add_function("blur", {radius
|
20
|
+
$ blur_function = job.add_function("blur", {:radius => 1}) # Add a blur function
|
21
|
+
$ blur_function.add_save("my_first_image") # Adds a save function (which takes a string parameter which is what the image is identified as on callback/polling)
|
22
|
+
$ blitline_service = Blitline.new
|
21
23
|
$ blitline_service.jobs << job # Push job into service
|
22
24
|
$ blitline_service.post_jobs
|
23
25
|
|
@@ -25,27 +27,10 @@ And you will get JSON back describing where the resulting image will be located
|
|
25
27
|
There are many more things you can do with images (including pushing them to your own S3 buckets).
|
26
28
|
|
27
29
|
|
28
|
-
You can find documentation about Blitline.com and it's services by following the links
|
29
|
-
|
30
|
+
You can find documentation about Blitline.com and it's services by following the links below
|
30
31
|
Further reading:
|
31
32
|
|
32
|
-
* (
|
33
|
-
*
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
== Contributing to blitline
|
38
|
-
|
39
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
40
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
41
|
-
* Fork the project
|
42
|
-
* Start a feature/bugfix branch
|
43
|
-
* Commit and push until you are happy with your contribution
|
44
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
45
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
46
|
-
|
47
|
-
== Copyright
|
33
|
+
* [Quickstart](http://www.blitline.com/docs/quickstart)
|
34
|
+
* [Blitline Blog](http://blitline.tumblr.com)
|
48
35
|
|
49
|
-
Copyright (c) 2011 developer blitline. See LICENSE.txt for
|
50
|
-
further details.
|
51
36
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
data/blitline.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "blitline"
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Blitline LLC"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-05-21"
|
13
13
|
s.description = "The blitline gems provides a simple easy wrapper to the Blitline.com web api"
|
14
14
|
s.email = "support@blitline.com"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/blitline/function.rb
CHANGED
@@ -9,10 +9,10 @@ class Blitline
|
|
9
9
|
@functions = []
|
10
10
|
end
|
11
11
|
|
12
|
-
def add_save(image_identifier, s3_key = nil, s3_bucket = nil)
|
12
|
+
def add_save(image_identifier, s3_key = nil, s3_bucket = nil, headers = {})
|
13
13
|
save = Blitline::Save.new(image_identifier)
|
14
14
|
if s3_key && s3_bucket
|
15
|
-
save.add_s3_destination(s3_key, s3_bucket)
|
15
|
+
save.add_s3_destination(s3_key, s3_bucket, headers)
|
16
16
|
end
|
17
17
|
@save = save
|
18
18
|
end
|
@@ -1,16 +1,18 @@
|
|
1
1
|
class Blitline
|
2
2
|
class S3Destination
|
3
3
|
include AttributeJsonizer
|
4
|
-
attr_accessor :key, :bucket
|
4
|
+
attr_accessor :key, :bucket, :headers
|
5
5
|
|
6
|
-
def initialize(key, bucket)
|
6
|
+
def initialize(key, bucket, headers = {})
|
7
7
|
@key = key
|
8
8
|
@bucket = bucket
|
9
|
+
@headers = headers
|
9
10
|
end
|
10
11
|
|
11
12
|
def validate
|
12
13
|
raise "S3Destination must have a key" if @key.nil?
|
13
14
|
raise "S3Destination must have a bucket" if @bucket.nil?
|
15
|
+
raise "S3Destination headers must be a hash" if @headers && !@headers.is_a?(Hash)
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
data/lib/blitline/save.rb
CHANGED
@@ -7,8 +7,8 @@ class Blitline
|
|
7
7
|
@image_identifier = image_identifier
|
8
8
|
end
|
9
9
|
|
10
|
-
def add_s3_destination(key, bucket)
|
11
|
-
@s3_destination = Blitline::S3Destination.new(key, bucket)
|
10
|
+
def add_s3_destination(key, bucket, headers = {})
|
11
|
+
@s3_destination = Blitline::S3Destination.new(key, bucket, headers)
|
12
12
|
end
|
13
13
|
|
14
14
|
def validate
|
data/test/test_service.rb
CHANGED
@@ -16,6 +16,19 @@ class TestService < Test::Unit::TestCase
|
|
16
16
|
assert(returned_values['results'][0]['images'].length > 0, "No images returned")
|
17
17
|
end
|
18
18
|
|
19
|
+
should "be able to commit a simple job to service with s3 headers" do
|
20
|
+
blitline = Blitline.new
|
21
|
+
job = Blitline::Job.new(SAMPLE_IMAGE_SRC)
|
22
|
+
job.application_id = ENV['BLITLINE_APPLICATION_ID']
|
23
|
+
function = job.add_function("blur", nil, "my_image")
|
24
|
+
function.add_save("my_image", "grumpy_squirrel/frame2.jpg", "bltemp", { "x-amz-meta-foo" => "bar", "x-amz-meta-baz" => "qux"})
|
25
|
+
blitline.jobs << job
|
26
|
+
returned_values = blitline.post_jobs
|
27
|
+
puts "----", returned_values.inspect
|
28
|
+
assert(returned_values.length > 0, "No results returned")
|
29
|
+
assert(returned_values['results'][0]['images'].length > 0, "No images returned")
|
30
|
+
end
|
31
|
+
|
19
32
|
should "be able to commit a job with multiple embedded functions" do
|
20
33
|
blitline = Blitline.new
|
21
34
|
job = Blitline::Job.new(SAMPLE_IMAGE_SRC)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blitline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: yajl-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &28053880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *28053880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &28053400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *28053400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &28052920 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *28052920
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &28052440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.6.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *28052440
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rcov
|
60
|
-
requirement: &
|
60
|
+
requirement: &28051960 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *28051960
|
69
69
|
description: The blitline gems provides a simple easy wrapper to the Blitline.com
|
70
70
|
web api
|
71
71
|
email: support@blitline.com
|
@@ -108,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
segments:
|
110
110
|
- 0
|
111
|
-
hash:
|
111
|
+
hash: 4503351451323380360
|
112
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
113
|
none: false
|
114
114
|
requirements:
|