aws-sdk 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,7 +56,7 @@ require 'aws/core/autoloader'
56
56
  module AWS
57
57
 
58
58
  # Current version of the AWS SDK for Ruby
59
- VERSION = "1.2.1"
59
+ VERSION = "1.2.2"
60
60
 
61
61
  register_autoloads(self) do
62
62
  autoload :Errors, 'errors'
@@ -83,8 +83,8 @@ module AWS
83
83
  # group(s).
84
84
  #
85
85
  # # get two existing security groups
86
- # dbsvrs = ec2.security_groups['db-servers']
87
- # websvrs = ec2.security_groups['web-servers']
86
+ # dbsvrs = ec2.security_groups.filter('group-name', 'db-servers').first
87
+ # websvrs = ec2.security_groups.filter('group-name', 'web-servers').first
88
88
  #
89
89
  # # allow instances in the 'web-servers' security group to connect
90
90
  # # to instances in the 'db-servers' security group over tcp port 3306
@@ -444,22 +444,31 @@ module AWS
444
444
  @_domain_name = name
445
445
  end
446
446
 
447
+ # Returns the domain name this record class persists data into.
448
+ # The default domain name is the class name with the optional
449
+ # domain_prefix).
450
+ # @param [String] name Defaults to the name of this class.
447
451
  # @return [String] Returns the full prefixed domain name for this class.
448
- def domain_name
449
- @_domain_name ||= self.to_s
450
- "#{Record.domain_prefix}#{@_domain_name}"
452
+ def domain_name name = nil
453
+ "#{Record.domain_prefix}#{name || @_domain_name || self.to_s}"
451
454
  end
452
455
 
453
456
  # Creates the SimpleDB domain that is configured for this class.
454
- def create_domain
455
- AWS::SimpleDB.new.domains.create(domain_name)
457
+ # @param [String] name Name of the domain to create. Defaults to
458
+ # the name of this class. The +name+ will be prefixed with
459
+ # domain_prefix if one is set.
460
+ #
461
+ # @return [AWS::SimpleDB::Domain]
462
+ #
463
+ def create_domain name = nil
464
+ AWS::SimpleDB.new.domains.create(domain_name(name))
456
465
  end
457
466
 
458
467
  # @return [AWS::SimpleDB::Domain] Returns a reference to the domain
459
468
  # this class will save data to.
460
469
  # @private
461
- def sdb_domain
462
- AWS::SimpleDB.new.domains[domain_name]
470
+ def sdb_domain name = nil
471
+ AWS::SimpleDB.new.domains[domain_name(name)]
463
472
  end
464
473
 
465
474
  end
@@ -84,6 +84,19 @@ module AWS
84
84
  _new_scope.find(*args)
85
85
  end
86
86
 
87
+ # Returns a chainable scope object that restricts further scopes to a
88
+ # particular domain
89
+ #
90
+ # Book.domain('shard_3').all.each do |book|
91
+ # # ...
92
+ # end
93
+ #
94
+ # @param [String] domain
95
+ # @return [Scope] Returns a scope for restricting the domain of subsequent
96
+ def domain name
97
+ _new_scope.domain(name)
98
+ end
99
+
87
100
  # Returns an enumerable scope object represents all records.
88
101
  #
89
102
  # Book.all.each do |book|
@@ -64,6 +64,13 @@ module AWS
64
64
  # @return [Class] Returns the AWS::Record::Base extending class that
65
65
  # this scope will find records for.
66
66
  attr_reader :base_class
67
+
68
+ # @param [String] domain
69
+ # @return [Scope] Returns a scope for restricting the domain of subsequent
70
+ # scope operations
71
+ def domain name
72
+ _with(:domain => name)
73
+ end
67
74
 
68
75
  # @overload find(id)
69
76
  # Finds and returns a single record by id. If no record is found
@@ -283,7 +290,7 @@ module AWS
283
290
  # @private
284
291
  private
285
292
  def _item_collection
286
- items = base_class.sdb_domain.items
293
+ items = base_class.sdb_domain(@options[:domain]).items
287
294
  items = items.order(*@options[:order]) if @options[:order]
288
295
  items = items.limit(*@options[:limit]) if @options[:limit]
289
296
  Record.as_array(@options[:where]).each do |where_condition|
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 1
10
- version: 1.2.1
9
+ - 2
10
+ version: 1.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Amazon Web Services
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-13 00:00:00 -07:00
18
+ date: 2011-10-28 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency