simple_aws 0.0.1a → 0.0.1b

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.
Files changed (46) hide show
  1. data/README.md +115 -38
  2. data/lib/aws/auto_scaling.rb +24 -0
  3. data/lib/aws/call_types/action_param.rb +10 -35
  4. data/lib/aws/cloud_formation.rb +25 -0
  5. data/lib/aws/cloud_watch.rb +25 -0
  6. data/lib/aws/core/connection.rb +2 -1
  7. data/lib/aws/core/request.rb +16 -7
  8. data/lib/aws/core/util.rb +2 -0
  9. data/lib/aws/ec2.rb +2 -0
  10. data/lib/aws/elasti_cache.rb +25 -0
  11. data/lib/aws/elastic_beanstalk.rb +25 -0
  12. data/lib/aws/elb.rb +2 -0
  13. data/lib/aws/iam.rb +2 -0
  14. data/lib/aws/import_export.rb +28 -0
  15. data/lib/aws/map_reduce.rb +24 -0
  16. data/lib/aws/mechanical_turk.rb +57 -0
  17. data/lib/aws/rds.rb +24 -0
  18. data/lib/aws/ses.rb +29 -0
  19. data/lib/aws/signing/version2.rb +49 -0
  20. data/lib/aws/signing/version3.rb +38 -0
  21. data/lib/aws/sns.rb +25 -0
  22. data/lib/aws/sqs.rb +56 -0
  23. data/samples/sqs.rb +35 -0
  24. data/samples/turk.rb +14 -0
  25. data/simple_aws.gemspec +1 -1
  26. data/test/aws/auto_scaling_test.rb +36 -0
  27. data/test/aws/call_types/action_param_test.rb +6 -13
  28. data/test/aws/cloud_formation_test.rb +36 -0
  29. data/test/aws/cloud_watch_test.rb +36 -0
  30. data/test/aws/core/connection_test.rb +12 -0
  31. data/test/aws/core/request_test.rb +15 -3
  32. data/test/aws/ec2_test.rb +1 -1
  33. data/test/aws/elasti_cache_test.rb +36 -0
  34. data/test/aws/elastic_beanstalk_test.rb +36 -0
  35. data/test/aws/elb_test.rb +1 -1
  36. data/test/aws/iam_test.rb +1 -1
  37. data/test/aws/import_export_test.rb +42 -0
  38. data/test/aws/map_reduce_test.rb +36 -0
  39. data/test/aws/mechanical_turk_test.rb +44 -0
  40. data/test/aws/rds_test.rb +36 -0
  41. data/test/aws/ses.rb +42 -0
  42. data/test/aws/signing/version2_test.rb +37 -0
  43. data/test/aws/signing/version3.rb +40 -0
  44. data/test/aws/sns_test.rb +36 -0
  45. data/test/aws/sqs.rb +54 -0
  46. metadata +50 -6
@@ -0,0 +1,36 @@
1
+ require 'test_helper'
2
+ require 'aws/rds'
3
+
4
+ describe AWS::RDS do
5
+
6
+ before do
7
+ @api = AWS::RDS.new "key", "secret"
8
+ end
9
+
10
+ it "points to the endpoint" do
11
+ @api.uri.must_equal "https://rds.amazonaws.com"
12
+ end
13
+
14
+ it "works with the current version" do
15
+ @api.version.must_equal "2011-04-01"
16
+ end
17
+
18
+ describe "API calls" do
19
+
20
+ it "builds and signs calls with ActionParam rules" do
21
+ AWS::Connection.any_instance.expects(:call).with do |request|
22
+ params = request.params
23
+ params.wont_be_nil
24
+
25
+ params["Action"].must_equal "DescribeEvents"
26
+ params["Signature"].wont_be_nil
27
+
28
+ true
29
+ end
30
+
31
+ obj = AWS::RDS.new "key", "secret"
32
+ obj.describe_events
33
+ end
34
+
35
+ end
36
+ end
data/test/aws/ses.rb ADDED
@@ -0,0 +1,42 @@
1
+ require 'test_helper'
2
+ require 'aws/ses'
3
+
4
+ describe AWS::SES do
5
+
6
+ before do
7
+ @api = AWS::SES.new "key", "secret"
8
+ end
9
+
10
+ it "only works on one endpoint" do
11
+ lambda {
12
+ AWS::SES.new "key", "secret", "us-west-1"
13
+ }.must_raise ArgumentError
14
+ end
15
+
16
+ it "points to the endpoint" do
17
+ @api.uri.must_equal "https://email.us-east-1.amazonaws.com"
18
+ end
19
+
20
+ it "works with the current version" do
21
+ @api.version.must_equal "2010-12-01"
22
+ end
23
+
24
+ describe "API calls" do
25
+
26
+ it "builds and signs calls with Signature Version 3" do
27
+ AWS::Connection.any_instance.expects(:call).with do |request|
28
+ params = request.params
29
+ params.wont_be_nil
30
+
31
+ params["Action"].must_equal "SendEmail"
32
+ request.headers["X-Amzn-Authorization"].wont_be_nil
33
+
34
+ true
35
+ end
36
+
37
+ obj = AWS::SES.new "key", "secret"
38
+ obj.send_email
39
+ end
40
+
41
+ end
42
+ end
@@ -0,0 +1,37 @@
1
+ require 'test_helper'
2
+ require 'aws/api'
3
+ require 'aws/call_types/action_param'
4
+ require 'aws/signing/version2'
5
+
6
+ describe AWS::Signing::Version2 do
7
+
8
+ class SigningTestAPI < AWS::API
9
+ endpoint "aptest"
10
+ version "2011-01-01"
11
+ use_https true
12
+
13
+ include AWS::CallTypes::ActionParam
14
+ include AWS::Signing::Version2
15
+ end
16
+
17
+ it "signs the given request according to Version 2 rules" do
18
+ AWS::Connection.any_instance.expects(:call).with do |request|
19
+ params = request.params
20
+ params.wont_be_nil
21
+
22
+ params["Version"].must_equal "2011-01-01"
23
+ params["AWSAccessKeyId"].must_equal "key"
24
+ params["SignatureMethod"].must_equal "HmacSHA256"
25
+ params["SignatureVersion"].must_equal "2"
26
+
27
+ params["Signature"].wont_be_nil
28
+
29
+ Time.parse(params["Timestamp"]).wont_be_nil
30
+ true
31
+ end.returns
32
+
33
+ obj = SigningTestAPI.new "key", "secret"
34
+ obj.describe_instances
35
+ end
36
+
37
+ end
@@ -0,0 +1,40 @@
1
+ require 'test_helper'
2
+ require 'aws/api'
3
+ require 'aws/call_types/action_param'
4
+ require 'aws/signing/version3'
5
+
6
+ describe AWS::Signing::Version3 do
7
+
8
+ class SigningV3TestAPI < AWS::API
9
+ endpoint "aptest"
10
+ version "2011-01-01"
11
+ use_https true
12
+
13
+ include AWS::CallTypes::ActionParam
14
+ include AWS::Signing::Version3
15
+ end
16
+
17
+ it "signs the given request according to Version 3 rules" do
18
+ AWS::Connection.any_instance.expects(:call).with do |request|
19
+ params = request.params
20
+ params.wont_be_nil
21
+
22
+ header = request.headers["X-Amzn-Authorization"]
23
+ parts = header.split(", ")
24
+
25
+ parts[0].must_equal "AWS3-HTTPS AWSAccessKeyId=key"
26
+ parts[1].must_equal "Algorithm=HmacSHA256"
27
+ parts[2].must_match /Signature=.*/
28
+
29
+ params["Version"].must_equal "2011-01-01"
30
+ params["AWSAccessKeyId"].must_equal "key"
31
+
32
+ Time.parse(params["Timestamp"]).wont_be_nil
33
+ true
34
+ end.returns
35
+
36
+ obj = SigningV3TestAPI.new "key", "secret"
37
+ obj.describe_instances
38
+ end
39
+
40
+ end
@@ -0,0 +1,36 @@
1
+ require 'test_helper'
2
+ require 'aws/sns'
3
+
4
+ describe AWS::SNS do
5
+
6
+ before do
7
+ @api = AWS::SNS.new "key", "secret"
8
+ end
9
+
10
+ it "points to endpoint, default to us-east-1" do
11
+ @api.uri.must_equal "https://sns.us-east-1.amazonaws.com"
12
+ end
13
+
14
+ it "works with the current version" do
15
+ @api.version.must_equal "2010-03-31"
16
+ end
17
+
18
+ describe "API calls" do
19
+
20
+ it "builds and signs calls with ActionParam rules" do
21
+ AWS::Connection.any_instance.expects(:call).with do |request|
22
+ params = request.params
23
+ params.wont_be_nil
24
+
25
+ params["Action"].must_equal "ListTopics"
26
+ params["Signature"].wont_be_nil
27
+
28
+ true
29
+ end
30
+
31
+ obj = AWS::SNS.new "key", "secret"
32
+ obj.list_topics
33
+ end
34
+
35
+ end
36
+ end
data/test/aws/sqs.rb ADDED
@@ -0,0 +1,54 @@
1
+ require 'test_helper'
2
+ require 'aws/sqs'
3
+
4
+ describe AWS::SQS do
5
+
6
+ before do
7
+ @api = AWS::SQS.new "key", "secret"
8
+ end
9
+
10
+ it "points to the endpoint" do
11
+ @api.uri.must_equal "https://sqs.us-east-1.amazonaws.com"
12
+ end
13
+
14
+ it "works with the current version" do
15
+ @api.version.must_equal "2011-10-01"
16
+ end
17
+
18
+ describe "API calls" do
19
+
20
+ it "builds and signs calls with ActionParam rules" do
21
+ AWS::Connection.any_instance.expects(:call).with do |request|
22
+ params = request.params
23
+ params.wont_be_nil
24
+
25
+ params["Action"].must_equal "ListQueues"
26
+ params["Signature"].wont_be_nil
27
+
28
+ true
29
+ end
30
+
31
+ obj = AWS::SQS.new "key", "secret"
32
+ obj.list_queues
33
+ end
34
+
35
+ it "listens for the first parameter to be a queue URL and sets the path appropriately" do
36
+ AWS::Connection.any_instance.expects(:call).with do |request|
37
+ params = request.params
38
+ params.wont_be_nil
39
+
40
+ request.host.must_equal "sqs.us-west-1.amazonaws.com"
41
+ request.path.must_equal "/1234567890/queue_name"
42
+
43
+ params["MessageBody"].must_equal "This is a message body"
44
+
45
+ true
46
+ end
47
+
48
+ obj = AWS::SQS.new "key", "secret"
49
+ obj.send_message "http://sqs.us-west-1.amazonaws.com/1234567890/queue_name",
50
+ "MessageBody" => "This is a message body"
51
+ end
52
+
53
+ end
54
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1a
4
+ version: 0.0.1b
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-23 00:00:00.000000000 Z
12
+ date: 2012-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ox
16
- requirement: &70336671153960 !ruby/object:Gem::Requirement
16
+ requirement: &70137915318080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70336671153960
24
+ version_requirements: *70137915318080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: httparty
27
- requirement: &70336671153520 !ruby/object:Gem::Requirement
27
+ requirement: &70137915317640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70336671153520
35
+ version_requirements: *70137915317640
36
36
  description: The simplest and easiest to use and maintain AWS communication library
37
37
  email:
38
38
  - jameskilton@gmail.com
@@ -46,26 +46,56 @@ files:
46
46
  - README.md
47
47
  - Rakefile
48
48
  - lib/aws/api.rb
49
+ - lib/aws/auto_scaling.rb
49
50
  - lib/aws/call_types/action_param.rb
51
+ - lib/aws/cloud_formation.rb
52
+ - lib/aws/cloud_watch.rb
50
53
  - lib/aws/core/connection.rb
51
54
  - lib/aws/core/request.rb
52
55
  - lib/aws/core/response.rb
53
56
  - lib/aws/core/util.rb
54
57
  - lib/aws/ec2.rb
58
+ - lib/aws/elasti_cache.rb
59
+ - lib/aws/elastic_beanstalk.rb
55
60
  - lib/aws/elb.rb
56
61
  - lib/aws/iam.rb
62
+ - lib/aws/import_export.rb
63
+ - lib/aws/map_reduce.rb
64
+ - lib/aws/mechanical_turk.rb
65
+ - lib/aws/rds.rb
66
+ - lib/aws/ses.rb
67
+ - lib/aws/signing/version2.rb
68
+ - lib/aws/signing/version3.rb
69
+ - lib/aws/sns.rb
70
+ - lib/aws/sqs.rb
57
71
  - samples/ec2.rb
58
72
  - samples/elb.rb
59
73
  - samples/iam.rb
74
+ - samples/sqs.rb
75
+ - samples/turk.rb
60
76
  - simple_aws.gemspec
61
77
  - test/aws/api_test.rb
78
+ - test/aws/auto_scaling_test.rb
62
79
  - test/aws/call_types/action_param_test.rb
80
+ - test/aws/cloud_formation_test.rb
81
+ - test/aws/cloud_watch_test.rb
63
82
  - test/aws/core/connection_test.rb
64
83
  - test/aws/core/request_test.rb
65
84
  - test/aws/core/response_test.rb
66
85
  - test/aws/ec2_test.rb
86
+ - test/aws/elasti_cache_test.rb
87
+ - test/aws/elastic_beanstalk_test.rb
67
88
  - test/aws/elb_test.rb
68
89
  - test/aws/iam_test.rb
90
+ - test/aws/import_export_test.rb
91
+ - test/aws/map_reduce_test.rb
92
+ - test/aws/mechanical_turk_test.rb
93
+ - test/aws/rds_test.rb
94
+ - test/aws/ses.rb
95
+ - test/aws/signing/version2_test.rb
96
+ - test/aws/signing/version3.rb
97
+ - test/aws/sns_test.rb
98
+ - test/aws/sqs.rb
69
99
  - test/test_helper.rb
70
100
  homepage:
71
101
  licenses: []
@@ -93,11 +123,25 @@ specification_version: 3
93
123
  summary: The simplest and easiest to use and maintain AWS communication library
94
124
  test_files:
95
125
  - test/aws/api_test.rb
126
+ - test/aws/auto_scaling_test.rb
96
127
  - test/aws/call_types/action_param_test.rb
128
+ - test/aws/cloud_formation_test.rb
129
+ - test/aws/cloud_watch_test.rb
97
130
  - test/aws/core/connection_test.rb
98
131
  - test/aws/core/request_test.rb
99
132
  - test/aws/core/response_test.rb
100
133
  - test/aws/ec2_test.rb
134
+ - test/aws/elasti_cache_test.rb
135
+ - test/aws/elastic_beanstalk_test.rb
101
136
  - test/aws/elb_test.rb
102
137
  - test/aws/iam_test.rb
138
+ - test/aws/import_export_test.rb
139
+ - test/aws/map_reduce_test.rb
140
+ - test/aws/mechanical_turk_test.rb
141
+ - test/aws/rds_test.rb
142
+ - test/aws/ses.rb
143
+ - test/aws/signing/version2_test.rb
144
+ - test/aws/signing/version3.rb
145
+ - test/aws/sns_test.rb
146
+ - test/aws/sqs.rb
103
147
  - test/test_helper.rb