condo 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1827a85ce98d40fd5de3f69857aeaa3944f29d3
4
- data.tar.gz: f55839e3df14e84e133d949c101598283341ab0b
3
+ metadata.gz: 8ee92183ae24774b0f9c5fda025f9632bb3560e7
4
+ data.tar.gz: f589c67b56e83ff7252f06bad73ec7067e6ecf3e
5
5
  SHA512:
6
- metadata.gz: 56bdd19a5ccc8c1873038c60d37d373a62a6ec19d5617bae731fa9f2e5b24a0319fc1e902742dbc5db35b756eae9571e892f3d8c6842bea2d6cd2cc72ed30e9b
7
- data.tar.gz: 6ecd0f2805ef502c2114c2049b271aded858eb811fb19968d8f9a2a0bdbffe393b4d99fe7caecd7d8c103adefb7aac96f84ef650ac9f9d0a6fd3371a6031d8e2
6
+ metadata.gz: 9fe6c8701d1cb6ddcfc2e6ecd48c9f0dd9a7290fb651af2bac719f264cd91f55ed94496329d12920df90c5583dba7b5fafa28f9818d1e6229273b9f9520b54b0
7
+ data.tar.gz: c8eb497535c733525785e9d1b2705af97bfcc1646a205f154a63a6636c3f65acd578d54c3b9241e954332f173a4b32df64fe1edb294d4437df359fbcad108f9f
@@ -1,17 +1,13 @@
1
- require 'singleton'
2
-
3
1
 
4
2
  module Condo
5
-
6
3
  class Configuration
7
- include Singleton
8
-
9
-
10
4
  @@callbacks = {
5
+ # Must be defined by the including class:
6
+ #:resident_id => proc
7
+ #:bucket_name => proc
8
+ #:upload_complete => proc
9
+ #:destroy_upload => proc
11
10
  #
12
- #:resident_id # Must be defined by the including class
13
- #
14
- :bucket_name => proc {"#{Rails.application.class.parent_name}#{instance_eval @@callbacks[:resident_id]}"},
15
11
  :object_key => proc { |upload|
16
12
  if upload[:file_path]
17
13
  upload[:file_path] + upload[:file_name]
@@ -42,8 +38,6 @@ module Condo
42
38
  # upload will only be present if it already exists
43
39
  config.residencies[0]
44
40
  }
45
- #:upload_complete # Must be defined by the including class
46
- #:destroy_upload # the actual delete should be done by the application
47
41
  }
48
42
 
49
43
  def self.callbacks
@@ -66,7 +66,7 @@ class Condo::Strata::OpenStackSwift
66
66
  end
67
67
 
68
68
 
69
- def allow_cors(domains = 'http://localhost:3000', options_age = 10, headers = 'etag, x-object-manifest, content-type, accept, origin, x-requested-with')
69
+ def allow_cors(domains = 'http://localhost:9000', options_age = 10, headers = 'etag, content-type, accept, origin, x-requested-with')
70
70
  fog_connection.request(
71
71
  :expects => [201, 202, 204],
72
72
  :method => 'POST',
@@ -152,29 +152,28 @@ class Condo::Strata::OpenStackSwift
152
152
 
153
153
  request = {}
154
154
  if options[:part] == 'finish'
155
- =begin
156
- Dynamic large object now have to be created on the server...
157
- This is how that was done. We now use Static Large Objects that can be created client side
158
-
159
- key = CGI::escape options[:object_key]
160
-
161
- # Send the commitment request
162
- fog_connection.request(
163
- :expects => [200, 201],
164
- :method => 'PUT',
165
- :headers => {
166
- 'X-Object-Manifest' => "#{CGI::escape options[:bucket_name]}/#{key}/p"
167
- },
168
- path: "#{CGI::escape options[:bucket_name]}/#{key}"
169
- )
170
-
171
- return {}
172
- =end
173
-
174
- options[:object_options][:headers]['ETag'] = options[:file_id] if options[:file_id].present?
175
- options[:object_options][:headers]['Content-Type'] = 'application/json'
176
- options[:object_key] = CGI::escape(options[:object_key])
177
- request[:signature] = sign_request(options, '&multipart-manifest=put')
155
+ # Dynamic large object now have to be created on the server...
156
+ # Static Large Objects could be created client side.
157
+ if @options[:use_static_large_objects]
158
+ options[:object_options][:headers]['ETag'] = options[:file_id] if options[:file_id].present?
159
+ options[:object_options][:headers]['Content-Type'] = 'text/plain'
160
+ options[:object_key] = CGI::escape(options[:object_key])
161
+ request[:signature] = sign_request(options, 'multipart-manifest=put&')
162
+ else
163
+ key = CGI::escape options[:object_key]
164
+
165
+ # Send the commitment request
166
+ fog_connection.request(
167
+ :expects => [200, 201],
168
+ :method => 'PUT',
169
+ :headers => {
170
+ 'X-Object-Manifest' => "#{CGI::escape options[:bucket_name]}/#{key}/p"
171
+ },
172
+ path: "#{CGI::escape options[:bucket_name]}/#{key}"
173
+ )
174
+
175
+ return {}
176
+ end
178
177
  else
179
178
  # Send the part upload request
180
179
  options[:object_options][:headers]['ETag'] = options[:file_id] if options[:file_id].present? && options[:object_options][:headers]['ETag'].nil?
@@ -235,7 +234,7 @@ This is how that was done. We now use Static Large Objects that can be created c
235
234
  # Finish building the request
236
235
  return {
237
236
  :verb => options[:object_options][:verb].to_s.upcase,
238
- :url => "#{options[:http_only] ? 'http' : 'https'}://#{@options[:location]}#{url}?temp_url_sig=#{signature}&temp_url_expires=#{options[:object_options][:expires]}#{param}",
237
+ :url => "#{options[:http_only] ? 'http' : 'https'}://#{@options[:location]}#{url}?#{param}temp_url_sig=#{signature}&temp_url_expires=#{options[:object_options][:expires]}",
239
238
  :headers => options[:object_options][:headers]
240
239
  }
241
240
  end
data/lib/condo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Condo
2
- VERSION = "2.0.1"
2
+ VERSION = "2.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: condo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails