miasma-aws 0.1.0 → 0.1.2

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: a3f6e18c7aa052992e9ffd65f0ce75d61b428704
4
- data.tar.gz: ed79d1ba6dd4b90239b86a526a68e1d8946c01d1
3
+ metadata.gz: 4c0c6ca7e79700a4062548c7c16393c315346b15
4
+ data.tar.gz: ac667b1d7c150e6f601aabd4dc5fbf0bc4c234bc
5
5
  SHA512:
6
- metadata.gz: 79dbeffe45430e68c1e8af17988428e96e01a0e49345ac0ab1bb259ae021e86bfc2f19d8a0ed05b509281d74a3398861ad3fc55236a097852fe8c129c5d880f3
7
- data.tar.gz: ebdaebefc0b15e64cb0609f0da662e7ea56c49cb2d837c4a6ae2228ef1763244160a0b55b466ef6f403e475f60dde534fc860883d4fab45ce314be07520c63ff
6
+ metadata.gz: 07cfe373155d1416623386a7447661b6f1a65de1e8c0fc00d33a9329906f3775374786e129ad6207a1ad633dc144a99eb12e393ed68eb02c1bfe6e247615a992
7
+ data.tar.gz: df3a5cb492b0fd378af53baaa32e3008eef47541f915c60feda39e21e8359196bcee1e223b4cb8c14d1976062fa929e920de48b28f5d5320b9a6844ebb5e4e91
data/CHANGELOG.md CHANGED
@@ -1,2 +1,6 @@
1
+ ## v0.1.2
2
+ * Migrate spec coverage
3
+ * Update storage behavior to use streamable helper
4
+
1
5
  ## v0.1.0
2
6
  * Initial release
@@ -262,11 +262,13 @@ module Miasma
262
262
  )
263
263
  file.etag = result.get(:body, 'CompleteMultipartUploadResult', 'ETag')
264
264
  else
265
- if(file.attributes[:body].is_a?(IO) || file.attributes[:body].is_a?(StringIO))
265
+ if(file.attributes[:body].respond_to?(:readpartial))
266
266
  args[:headers]['Content-Length'] = file.body.size.to_s
267
267
  file.body.rewind
268
- args[:body] = file.body.read
268
+ args[:body] = file.body.readpartial(file.body.size)
269
269
  file.body.rewind
270
+ else
271
+ args[:headers]['Content-Length'] = 0
270
272
  end
271
273
  result = request(
272
274
  args.merge(
@@ -354,6 +356,7 @@ module Miasma
354
356
  # @param file [Models::Storage::File]
355
357
  # @return [IO, HTTP::Response::Body]
356
358
  def file_body(file)
359
+ file_content = nil
357
360
  if(file.persisted?)
358
361
  result = request(
359
362
  :path => file_path(file),
@@ -363,19 +366,20 @@ module Miasma
363
366
  content = result[:body]
364
367
  begin
365
368
  if(content.is_a?(String))
366
- StringIO.new(content)
369
+ file_content = StringIO.new(content)
367
370
  else
368
371
  if(content.respond_to?(:stream!))
369
372
  content.stream!
370
373
  end
371
- content
374
+ file_content = content
372
375
  end
373
376
  rescue HTTP::StateError
374
- StringIO.new(content.to_s)
377
+ file_content = StringIO.new(content.to_s)
375
378
  end
376
379
  else
377
- StringIO.new('')
380
+ file_content = StringIO.new('')
378
381
  end
382
+ File::Streamable.new(file_content)
379
383
  end
380
384
 
381
385
  # Simple callback to allow request option adjustments prior to
@@ -30,7 +30,7 @@ module Miasma
30
30
  list << content
31
31
  end
32
32
  set = result.get(*result_key.slice(0, 3))
33
- if(set && set['NextToken'])
33
+ if(set.is_a?(Hash) && set['NextToken'])
34
34
  list += all_result_pages(set['NextToken'], *result_key, &block)
35
35
  end
36
36
  list.compact
@@ -196,7 +196,7 @@ module Miasma
196
196
  def generate_signature(http_method, path, opts)
197
197
  to_sign = [
198
198
  algorithm,
199
- AwsApiCore.time_iso8601,
199
+ opts.to_smash.fetch(:headers, 'X-Amz-Date', AwsApiCore.time_iso8601),
200
200
  credential_scope,
201
201
  hashed_canonical_request(
202
202
  can_req = build_canonical_request(http_method, path, opts)
@@ -1,4 +1,4 @@
1
1
  module MiasmaAws
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.1.0')
3
+ VERSION = Gem::Version.new('0.1.2')
4
4
  end
data/miasma-aws.gemspec CHANGED
@@ -10,6 +10,11 @@ Gem::Specification.new do |s|
10
10
  s.description = 'Smoggy AWS API'
11
11
  s.license = 'Apache 2.0'
12
12
  s.require_path = 'lib'
13
- s.add_dependency 'miasma'
13
+ s.add_development_dependency 'miasma', '>= 0.2.12'
14
+ s.add_development_dependency 'pry'
15
+ s.add_development_dependency 'minitest'
16
+ s.add_development_dependency 'vcr'
17
+ s.add_development_dependency 'webmock'
18
+ s.add_development_dependency 'psych', '>= 2.0.8'
14
19
  s.files = Dir['lib/**/*'] + %w(miasma-aws.gemspec README.md CHANGELOG.md LICENSE)
15
20
  end
metadata CHANGED
@@ -1,29 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miasma-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-05 00:00:00.000000000 Z
11
+ date: 2015-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: miasma
15
15
  requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.12
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.12
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: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
16
51
  requirements:
17
52
  - - ">="
18
53
  - !ruby/object:Gem::Version
19
54
  version: '0'
20
- type: :runtime
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
21
77
  prerelease: false
22
78
  version_requirements: !ruby/object:Gem::Requirement
23
79
  requirements:
24
80
  - - ">="
25
81
  - !ruby/object:Gem::Version
26
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: psych
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 2.0.8
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 2.0.8
27
97
  description: Smoggy AWS API
28
98
  email: code@chrisroberts.org
29
99
  executables: []