cnvrtr 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
 
2
+
2
3
  begin
3
4
  require 'bones'
4
5
  rescue LoadError
@@ -7,6 +8,7 @@ end
7
8
 
8
9
  ensure_in_path 'lib'
9
10
  require 'cnvrtr'
11
+ ENV['VERSION'] = Cnvrtr::VERSION
10
12
 
11
13
  task :default => 'test:run'
12
14
  task 'gem:release' => 'test:run'
Binary file
@@ -2,20 +2,43 @@
2
2
  # require 'right_aws'
3
3
  module Cnvrtr
4
4
  module Helpers
5
- def link_to_cnvrtr(title, href=nil, opts={}, cnvrtr_opts={})
5
+ private
6
+ # :width => 50, :height => 50, :format => 'png',
7
+ # :filter => [:thumb => {:background => '#000'}, :polaroid => {:rotate => 15}]
8
+ def parse(obj)
9
+ return obj if obj.is_a?(String)
10
+ raise "Invalid Format" unless obj.is_a?(Hash) && obj[:format]
11
+ obj.stringify_keys!
12
+ base = (obj[:width] && obj[:height]) ? "#{obj[:width]}x#{obj[:height]}" : ""
13
+ if obj[:filter]
14
+ base += "_thumb" if obj[:filter][:thumb]
15
+ base += "_polaroid" if obj[:filter][:polaroid]
16
+ end
17
+ base = "base" if base.blank?
18
+ "#{base}.#{obj[:format]}"
19
+ end
20
+
21
+ public
22
+ def link_to_cnvrtr(title, href=nil, opts={}, cnvrtr_opts={})
6
23
  href = title if href.nil?
7
24
  #options = params.extract_options!.symbolize_keys
8
25
  #options[:controller] = self
9
26
  raise "Invalid usage." unless href.is_a?(String)
10
27
  link_to(title,url_for_cnvrtr(href,cnvrtr_opts),opts)
11
28
  end
12
- def url_for_cnvrtr(href,cnvrtr_opts={})
29
+
30
+ # url_for_cnvrtr(original_asset_url, shortcut_string)
31
+ # or
32
+ # url_for_cnvrtr(original_asset_url, opts = {})
33
+ def url_for_cnvrtr(*params)
34
+ href = params.first
13
35
  document = CGI.escape(href)
36
+ opts_as_string = parse(params.second)
14
37
  # server = RightAws::S3Interface.new(cnvrtr_opts[:access_id], cnvrtr_opts[:secret_id],cnvrtr_opts)
15
38
  # req = server.generate_rest_request('GET',{:url=>document})
16
39
  # raise req[:request].path
17
40
  # req[:request].path
18
- "http://vrt.cc/public/#{document}/cached.swf?sig=XXX"
41
+ "http://vrt.cc/public/#{document}/#{opts_as_string}?sig=XXX"
19
42
  end
20
43
  =begin
21
44
  Copying S3's operation for presigned URLs...
data/lib/cnvrtr.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  module Cnvrtr
3
3
 
4
4
  # :stopdoc:
5
- VERSION = '1.0.0'
5
+ VERSION = '1.0.1'
6
6
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
7
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
8
  # :startdoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cnvrtr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ELC Technologies