anaconda 1.0.3 → 1.0.4

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: ee4ffc83e23081c0ec4b6d113ade0f8d4cf29ee5
4
- data.tar.gz: 2cedf6106ce7add799fa92cedc853aca72fec6d9
3
+ metadata.gz: 7212d183f2965554be4f43394ea2dc65b396500b
4
+ data.tar.gz: bb52c4c5f4c1dd7ded8004f825a43de5eb460c1d
5
5
  SHA512:
6
- metadata.gz: 1ed1a97fbb2cc1c39151f68d871411288b967c4cb055b35e7daf6277621407a6a1e99a5aaf063f29b9a38e61462c072bf2f4fdc0fac99acb9caea4d32ec5eb8d
7
- data.tar.gz: 3e323b34bcf69aeef2eeea9a71a24c0e959cfa7b590f41aba72a7f76703c9c1a49f897268b977e9b819adbbe5bca97239ac0f3c6d5c8af9087de514368a9ce9e
6
+ metadata.gz: 80631dfd8a009772117b8fcd33aaa89b20fa0fe2f8ec82be36ec8378222f6f7baa723cddeaca084e22c87627f674937ef78400cfb6749e68d44a74701fd50dc2
7
+ data.tar.gz: 5ea78f6fbc7867a8722780bdc76c5143865de7430f30b3e651917e8fa68fb476de0d34fe71ac451ce976252c65260662299c4b0018ca68b1f96411eb502b15b7
@@ -202,6 +202,9 @@ If you return false to the following events it will prevent the default behavior
202
202
  From version 1.0.0 on we have used [Semantic Versioning](http://semver.org/).
203
203
 
204
204
  ## Changelog
205
+ * 1.0.4
206
+ * Add `anaconda_form_data_for()` and `anaconda_form_data_for_all_columns` instance methods that return the raw data needed to upload to AWS
207
+
205
208
  * 1.0.3
206
209
  * Properly define dependencies so they are included
207
210
  * Add support for non US Standard region buckets. See new `aws_endpoint` option in the config
@@ -33,7 +33,7 @@ module Anaconda
33
33
  yield self
34
34
 
35
35
  @@aws[:aws_endpoint] = "s3.amazonaws.com/#{@@aws[:aws_bucket]}" unless @@aws[:aws_endpoint].present?
36
- @@aws[:path_style] = !@@aws[:aws_endpoint].starts_with?(@@aws[:aws_bucket])
36
+ @@aws[:path_style] = !@@aws[:aws_endpoint].starts_with?(@@aws[:aws_bucket])
37
37
  end
38
38
 
39
39
  def self.js_file_types
@@ -86,6 +86,29 @@ module Anaconda
86
86
  end
87
87
  end
88
88
 
89
+ def anaconda_form_data_for_all_columns
90
+ form_data = {}
91
+ self.anaconda_columns.each do |column|
92
+ form_data[column.to_sym] = anaconda_form_data_for column
93
+ end
94
+ form_data
95
+ end
96
+
97
+ def anaconda_form_data_for( anaconda_column )
98
+ if self.anaconda_columns.include? anaconda_column.to_sym
99
+
100
+ options = self.class.anaconda_options[anaconda_column.to_sym].dup
101
+
102
+ options[:base_key] = self.send(options[:base_key].to_s) if options[:base_key].kind_of? Symbol
103
+ uploader = Anaconda::S3Uploader.new(options)
104
+ fields = uploader.fields
105
+ fields[:post_url] = uploader.url
106
+ fields
107
+ else
108
+ raise "#{anaconda_column} not configured for anaconda. Misspelling or did you forget to add the anaconda_for call for this field?"
109
+ end
110
+ end
111
+
89
112
  private
90
113
  def anaconda_url(column_name, *args)
91
114
  return nil unless send("#{column_name}_file_path").present?
@@ -1,5 +1,5 @@
1
1
  module Anaconda
2
2
  module Rails
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anaconda
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben McFadden