blobsterix_carrierwave 1.0.6 → 1.0.10

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: ebb0630bf0bd425de38535af272fe31796eb0c5c
4
- data.tar.gz: cd5ccd61d6efb86e6f5035316391603a96c933cf
3
+ metadata.gz: fc9f5f3785c1396075e386046fe772d66e09a688
4
+ data.tar.gz: c14789b243fe645392ea0465e00b9dd162a97170
5
5
  SHA512:
6
- metadata.gz: f95e3388194701d7d07f5fedfa68c44f83e3c988ac4441c088b8606ac454664870f6bf9f944d1d3fb94302efd9f9bca978ead856c0074aa8fa826f844cb9962d
7
- data.tar.gz: 3024d10735adf3996f621da60a53074322d5377d97cc670702b7f6b1b73c3f241132d54f69474453cd81989f8a770ce7f3125a06a8738a0c8594de51c192e8e1
6
+ metadata.gz: 503df11579e24d84fbdd3bc6c0b6fc30b2dff9300d2b7d33f991cbfeccfafa9e54f4ea56f099462f514d7c6a8ba292e8bd2d5637db133e4109e483311748b9df
7
+ data.tar.gz: 7443c01e15aa47861dd51a0b7948894bde6bdc0b61a8c274c4af8dd5be236dc8fb89c3f8469a8a88e95f9f8cb645cc68ee02c32d05697ec444e3ed760c196a89
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0-p481
1
+ 2.0.0-p643
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,7 @@
1
+ = 1.0.8
2
+ * added option to pass query string parameters
3
+ = 1.0.7
4
+ * added option to generate urls for blobsterix in a protocol relative way(i.e "//" instead of "http/https://")
1
5
  = 1.0.6
2
6
  * fixing bug that caused to many processors to fire
3
7
  = 1.0.0
@@ -11,6 +11,9 @@ module BlobsterixAdhocTransforms
11
11
  @options = options || {}
12
12
  @chain=[]
13
13
 
14
+ # activate relative ssl protocoll as standard option
15
+ @options[:relative_ssl] = true unless @options.has_key?(:relative_ssl)
16
+
14
17
  #init the trafos
15
18
  (@options[:trafos] || []).each{|t|
16
19
  self.send(t[0], t[1])
@@ -27,9 +30,14 @@ module BlobsterixAdhocTransforms
27
30
  self
28
31
  end
29
32
 
33
+ def query(args={})
34
+ query_options.merge!(args)
35
+ self
36
+ end
37
+
30
38
  def url(path=nil)
31
39
  @options[:path] = path if path
32
- "#{asset_host}#{encoded_path}"
40
+ "#{asset_host}#{encoded_path}#{query_options_string}"
33
41
  end
34
42
 
35
43
  def url_s3(path=nil, use_subdomain=true)
@@ -77,6 +85,9 @@ module BlobsterixAdhocTransforms
77
85
  "http://#{@options[:host]}/#{bucket}/"
78
86
  end
79
87
  end
88
+ def http
89
+ @options[:ssl] ? "https:" : (@options[:relative_ssl] ? "" : "http:")
90
+ end
80
91
  def asset_host
81
92
 
82
93
  host = @options[:host] || ""
@@ -85,14 +96,35 @@ module BlobsterixAdhocTransforms
85
96
  else
86
97
  trafo = transform
87
98
  if trafo.length > 0
88
- "http://#{host}/blob/v#{version}/#{trafo}.#{bucket}/"
99
+ "#{http}//#{host}/blob/v#{version}/#{trafo}.#{bucket}/"
89
100
  else
90
- "http://#{host}/blob/v#{version}/#{bucket}/"
101
+ "#{http}//#{host}/blob/v#{version}/#{bucket}/"
91
102
  end
92
103
  end
93
104
 
94
105
  #"http://localhost:9000/blob/v1/#{trafo}.#{uploader.fog_directory}/"
95
106
  end
107
+ def query_options
108
+ @query||={}
109
+ end
110
+ def query_options=(opts={})
111
+ @query=opts
112
+ end
113
+ def query_options_string
114
+ if uploader.respond_to?(:force_filename)
115
+ if query_options.empty?
116
+ "?filename=#{uploader.force_filename}"
117
+ else
118
+ "?filename=#{uploader.force_filename}&#{query_options.map {|i,v| "#{i}=#{v}" }.join("&")}"
119
+ end
120
+ else
121
+ if query_options.empty?
122
+ ""
123
+ else
124
+ "?#{query_options.map {|i,v| "#{i.to_s}=#{v.to_s}" }.join("&")}"
125
+ end
126
+ end
127
+ end
96
128
  def bucket()
97
129
  if @options.has_key?(:uploader)
98
130
  @options[:uploader].fog_directory
@@ -18,6 +18,29 @@ module BlobsterixTransforms
18
18
  :args => "#{width}x#{height}"
19
19
  }
20
20
  end
21
+
22
+ # extent takes 3 params in a hash, :background, :gravity and :size
23
+ #
24
+ # size is mandatory, background
25
+ #
26
+ # @param [Hash] args
27
+ # @option args [String] :size
28
+ # @option args [String] :background (defaults to "transparent")
29
+ # @option args [String] :gravity (defaults to "center")
30
+ def extent(args)
31
+ # only allow gravity, background and size options
32
+ args.delete_if do |key, value|
33
+ !([:gravity, :background, :size].include?(key))
34
+ end
35
+ args[:gravity] = "center" unless args[:gravity]
36
+ args[:background] = "transparent" unless args[:background]
37
+ send = args.map{|key, value| "#{key}=#{value}"}.join(";") + ";"
38
+ {
39
+ :method => "extent",
40
+ :args => send
41
+ }
42
+ end
43
+
21
44
  def rotate(angle)
22
45
  {
23
46
  :method => "rotate",
@@ -25,6 +25,10 @@ class BlobsterixUploader < CarrierWave::Uploader::Base
25
25
  nil
26
26
  end
27
27
 
28
+ def query(args={})
29
+ asset_host.set_path(path).query(args)
30
+ end
31
+
28
32
  def custom
29
33
  asset_host.set_path(path).clear_trafo
30
34
  end
@@ -1,4 +1,3 @@
1
1
  module BlobsterixCarrierwave
2
- VERSION = "1.0.6"
2
+ VERSION = "1.0.10"
3
3
  end
4
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobsterix_carrierwave
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-15 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -89,4 +89,3 @@ signing_key:
89
89
  specification_version: 4
90
90
  summary: This gem is used to create a carrierwave binding to a blobsterix server
91
91
  test_files: []
92
- has_rdoc: