awsraw 0.1.7 → 0.1.8

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.
data/README.md CHANGED
@@ -18,6 +18,22 @@ directly is very nice, instead of having to dig deep into a higher-level
18
18
  library to figure out how they've mapped that new feature into their
19
19
  terminology and API.
20
20
 
21
+ ## Configuration
22
+
23
+ If you need to override the AWS hostname for development/testing purposes, you can do so as follows:
24
+
25
+ ```ruby
26
+ require 'awsraw/s3/client'
27
+
28
+ # Assuming we have a fake S3 service listening on `fake.s3.dev`
29
+ AWSRaw::S3.configure do |config|
30
+ config.host = 'fake.s3.dev'
31
+ config.regional_hosts = {
32
+ 'ap-southeast-2' => 'fake.s3.dev'
33
+ }
34
+ end
35
+ ```
36
+
21
37
  ## Usage
22
38
 
23
39
  ### S3
data/awsraw.gemspec CHANGED
@@ -5,8 +5,8 @@ require "awsraw/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "awsraw"
7
7
  s.version = Awsraw::VERSION
8
- s.authors = ["Pete Yandell", "David Goodlad", "Jack 'chendo' Chen"]
9
- s.email = ["pete@notahat.com", "david@goodlad.net", "gems.awsraw@chen.do"]
8
+ s.authors = ["Pete Yandell", "David Goodlad", "Jack 'chendo' Chen", "Warren Seen"]
9
+ s.email = ["pete@notahat.com", "david@goodlad.net", "gems.awsraw@chen.do", "warren@warrenseen.com"]
10
10
  s.license = 'MIT'
11
11
  s.homepage = "http://github.com/envato/awsraw"
12
12
  s.summary = %q{Minimal AWS client}
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require 'awsraw/s3'
2
3
  require 'awsraw/s3/request'
3
4
  require 'awsraw/s3/http_request_builder'
4
5
  require 'awsraw/s3/response'
@@ -0,0 +1,12 @@
1
+ module AWSRaw
2
+ module S3
3
+ class Configuration
4
+ attr_accessor :host, :regional_hosts
5
+
6
+ def initialize
7
+ @host = "s3.amazonaws.com"
8
+ @regional_hosts = Hash.new { |hash, region| hash[region] = "s3-#{region}.amazonaws.com" }
9
+ end
10
+ end
11
+ end
12
+ end
@@ -38,9 +38,9 @@ module AWSRaw
38
38
 
39
39
  def host
40
40
  if @region && @region != US_STANDARD
41
- "s3-#{@region}.amazonaws.com"
41
+ S3.configuration.regional_hosts[@region]
42
42
  else
43
- "s3.amazonaws.com"
43
+ S3.configuration.host
44
44
  end
45
45
  end
46
46
 
data/lib/awsraw/s3.rb ADDED
@@ -0,0 +1,15 @@
1
+ require 'awsraw/s3/configuration'
2
+
3
+ module AWSRaw
4
+ module S3
5
+ def configuration
6
+ @configuration ||= self::Configuration.new
7
+ end
8
+ module_function :configuration
9
+
10
+ def configure
11
+ yield(configuration)
12
+ end
13
+ module_function :configure
14
+ end
15
+ end
@@ -1,3 +1,3 @@
1
1
  module Awsraw
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
data/lib/awsraw.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require "awsraw/version"
2
2
 
3
- module Awsraw
4
- # Your code goes here...
3
+ module AWSRaw
4
+
5
5
  end
@@ -0,0 +1,23 @@
1
+ require 'awsraw/s3/configuration'
2
+
3
+ describe AWSRaw::S3::Configuration do
4
+ subject(:configuration) { AWSRaw::S3::Configuration.new }
5
+
6
+ it 'has the default S3 host' do
7
+ expect(configuration.host).to eq 's3.amazonaws.com'
8
+ end
9
+
10
+ it 'has the default S3 regional host' do
11
+ expect(configuration.regional_hosts['ap-southeast-2']).to eq 's3-ap-southeast-2.amazonaws.com'
12
+ end
13
+
14
+ describe 'with a custom regional hosts hash' do
15
+ before do
16
+ configuration.regional_hosts = { 'ap-southeast-2' => 's3.envato.dev' }
17
+ end
18
+
19
+ it 'returns the custom regional host' do
20
+ expect(configuration.regional_hosts['ap-southeast-2']).to eq 's3.envato.dev'
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,43 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awsraw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Pete Yandell
8
9
  - David Goodlad
9
10
  - Jack 'chendo' Chen
11
+ - Warren Seen
10
12
  autorequire:
11
13
  bindir: bin
12
14
  cert_chain: []
13
- date: 2013-07-19 00:00:00.000000000 Z
15
+ date: 2013-09-12 00:00:00.000000000 Z
14
16
  dependencies:
15
17
  - !ruby/object:Gem::Dependency
16
18
  name: rake
17
19
  requirement: !ruby/object:Gem::Requirement
20
+ none: false
18
21
  requirements:
19
- - - '>='
22
+ - - ! '>='
20
23
  - !ruby/object:Gem::Version
21
24
  version: '0'
22
25
  type: :development
23
26
  prerelease: false
24
27
  version_requirements: !ruby/object:Gem::Requirement
28
+ none: false
25
29
  requirements:
26
- - - '>='
30
+ - - ! '>='
27
31
  - !ruby/object:Gem::Version
28
32
  version: '0'
29
33
  - !ruby/object:Gem::Dependency
30
34
  name: rspec
31
35
  requirement: !ruby/object:Gem::Requirement
36
+ none: false
32
37
  requirements:
33
- - - '>='
38
+ - - ! '>='
34
39
  - !ruby/object:Gem::Version
35
40
  version: '0'
36
41
  type: :development
37
42
  prerelease: false
38
43
  version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
39
45
  requirements:
40
- - - '>='
46
+ - - ! '>='
41
47
  - !ruby/object:Gem::Version
42
48
  version: '0'
43
49
  description: A client for Amazon Web Services in the style of FlickRaw
@@ -45,6 +51,7 @@ email:
45
51
  - pete@notahat.com
46
52
  - david@goodlad.net
47
53
  - gems.awsraw@chen.do
54
+ - warren@warrenseen.com
48
55
  executables: []
49
56
  extensions: []
50
57
  extra_rdoc_files: []
@@ -56,7 +63,9 @@ files:
56
63
  - Rakefile
57
64
  - awsraw.gemspec
58
65
  - lib/awsraw.rb
66
+ - lib/awsraw/s3.rb
59
67
  - lib/awsraw/s3/client.rb
68
+ - lib/awsraw/s3/configuration.rb
60
69
  - lib/awsraw/s3/http_request_builder.rb
61
70
  - lib/awsraw/s3/md5_digester.rb
62
71
  - lib/awsraw/s3/query_string_signer.rb
@@ -65,6 +74,7 @@ files:
65
74
  - lib/awsraw/s3/signer.rb
66
75
  - lib/awsraw/version.rb
67
76
  - spec/s3/client_spec.rb
77
+ - spec/s3/configuration_spec.rb
68
78
  - spec/s3/http_request_builder_spec.rb
69
79
  - spec/s3/md5_digester_spec.rb
70
80
  - spec/s3/query_string_signer_spec.rb
@@ -73,29 +83,37 @@ files:
73
83
  homepage: http://github.com/envato/awsraw
74
84
  licenses:
75
85
  - MIT
76
- metadata: {}
77
86
  post_install_message:
78
87
  rdoc_options: []
79
88
  require_paths:
80
89
  - lib
81
90
  required_ruby_version: !ruby/object:Gem::Requirement
91
+ none: false
82
92
  requirements:
83
- - - '>='
93
+ - - ! '>='
84
94
  - !ruby/object:Gem::Version
85
95
  version: '0'
96
+ segments:
97
+ - 0
98
+ hash: 2757418691985908867
86
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
87
101
  requirements:
88
- - - '>='
102
+ - - ! '>='
89
103
  - !ruby/object:Gem::Version
90
104
  version: '0'
105
+ segments:
106
+ - 0
107
+ hash: 2757418691985908867
91
108
  requirements: []
92
109
  rubyforge_project: awsraw
93
- rubygems_version: 2.0.3
110
+ rubygems_version: 1.8.23
94
111
  signing_key:
95
- specification_version: 4
112
+ specification_version: 3
96
113
  summary: Minimal AWS client
97
114
  test_files:
98
115
  - spec/s3/client_spec.rb
116
+ - spec/s3/configuration_spec.rb
99
117
  - spec/s3/http_request_builder_spec.rb
100
118
  - spec/s3/md5_digester_spec.rb
101
119
  - spec/s3/query_string_signer_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 340d4202747685ddfd86dab87ae9730af3fddf89
4
- data.tar.gz: 5229cdcce0449aca086607905fb4a84e325d1417
5
- SHA512:
6
- metadata.gz: fb18c1d7f30d2a2811ec8ca99fffce33291561374a96bf9f7d4d28ec894e632c22f6b7b64c33fe65c089825c174935810521324b94426cdf25560b8183344554
7
- data.tar.gz: 45d4d12d2242fcfe51658260fb3b6f1deb7322b441bcc20d31a22380a443f264196d027eddbe87900b6f8a2634a734d3aac3b2edce472243bac115c088e38bcc