clint-upload 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0fe353f528d5270f7ad69f146ba4abc7cbb7966e
4
+ data.tar.gz: 009642dee8c09494363d08a401fc4fbccae54237
5
+ SHA512:
6
+ metadata.gz: 1bf262073a8642a3884dd9bc27d13ef88a423d067e0b01b46951df6a2a609b7c2496149cbf2c87cd984c4b7a7c1f1342c4b0e3f2e80d9b2fe01ad042d44c155a
7
+ data.tar.gz: 75b3bf4de8f1d4a3f67373e290d6813229ac9fe198c2df400659c84b4a4c043fc183299251dbf763d680d4d8464fae2a979366c4567985bf04fa0008201f4b8c
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "clint/upload"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "clint-upload"
8
+ spec.version = Clint::Upload::VERSION
9
+ spec.authors = [""]
10
+ spec.email = [""]
11
+
12
+ spec.summary = ""
13
+ spec.homepage = ""
14
+
15
+ spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{\A(clint-upload.gemspec|lib|Gemfile)}) }
16
+ spec.bindir = "exe"
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.9"
21
+ spec.add_development_dependency "pry"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+
25
+ spec.add_dependency "aws-sdk", "~> 2"
26
+ spec.add_dependency "json"
27
+ spec.add_dependency "wes-cloudkit", "~> 3"
28
+ end
@@ -0,0 +1,40 @@
1
+ require "aws-sdk-resources"
2
+ require "wes/cloudkit"
3
+
4
+ module Clint
5
+ module Upload
6
+ class SignedURL
7
+ def initialize(s3_domain:, bucket: )
8
+ @s3_domain = s3_domain
9
+ @bucket = bucket
10
+ end
11
+
12
+ def generate(key:)
13
+ signer.presigned_url(
14
+ :put_object,
15
+ :bucket => @bucket,
16
+ :key => key
17
+ )
18
+ end
19
+
20
+ private
21
+
22
+ def dev_s3
23
+ Aws::S3::Client.new(
24
+ :endpoint => @s3_domain,
25
+ :force_path_style => true
26
+ )
27
+ end
28
+
29
+ def dev_signer
30
+ Aws::S3::Presigner.new(
31
+ :client => dev_s3
32
+ )
33
+ end
34
+
35
+ def signer
36
+ @signer ||= Wes::Cloudkit.dev? ? dev_signer : Aws::S3::Presigner.new
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,5 @@
1
+ module Clint
2
+ module Upload
3
+ VERSION = "0.1.0".freeze
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clint-upload
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ''
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-06-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: aws-sdk
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '2'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: json
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: wes-cloudkit
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3'
111
+ description:
112
+ email:
113
+ - ''
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - Gemfile
119
+ - clint-upload.gemspec
120
+ - lib/clint/upload.rb
121
+ - lib/clint/upload/signed_url.rb
122
+ homepage: ''
123
+ licenses: []
124
+ metadata: {}
125
+ post_install_message:
126
+ rdoc_options: []
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ requirements: []
140
+ rubyforge_project:
141
+ rubygems_version: 2.5.1
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: ''
145
+ test_files: []