aws 1.10.2 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@
23
23
 
24
24
  # Test
25
25
  module RightAws
26
- require 'md5'
26
+ require 'digest/md5'
27
27
  require 'pp'
28
28
 
29
29
  class AwsUtils #:nodoc:
@@ -52,8 +52,8 @@ require 'acf/right_acf_interface'
52
52
  module RightAws #:nodoc:
53
53
  module VERSION #:nodoc:
54
54
  MAJOR = 1
55
- MINOR = 10
56
- TINY = 2
55
+ MINOR = 11
56
+ TINY = 0
57
57
 
58
58
  STRING = [MAJOR, MINOR, TINY].join('.')
59
59
  end
@@ -761,9 +761,9 @@ module RightAws
761
761
  @name = name
762
762
  @perms = perms.to_a
763
763
  case action
764
- when :apply: apply
765
- when :refresh: refresh
766
- when :apply_and_refresh: apply; refresh
764
+ when :apply then apply
765
+ when :refresh then refresh
766
+ when :apply_and_refresh then apply; refresh
767
767
  end
768
768
  end
769
769
 
@@ -253,66 +253,23 @@ module RightAws
253
253
  connection.delete_domain(domain)
254
254
  end
255
255
 
256
- # Perform a find request.
257
- #
258
- # Single record:
259
- #
260
- # Client.find(:first)
261
- # Client.find(:first, :conditions=> [ "['name'=?] intersection ['wife'=?]", "Jon", "Sandy"])
262
- #
263
- # Bunch of records:
264
- #
265
- # Client.find(:all)
266
- # Client.find(:all, :limit => 10)
267
- # Client.find(:all, :conditions=> [ "['name'=?] intersection ['girlfriend'=?]", "Jon", "Judy"])
268
- # Client.find(:all, :conditions=> [ "['name'=?]", "Sandy"], :limit => 3)
269
- #
270
- # Records by ids:
271
- #
272
- # Client.find('1')
273
- # Client.find('1234987b4583475347523948')
274
- # Client.find('1','2','3','4', :conditions=> [ "['toys'=?]", "beer"])
275
256
  #
276
- # Find helpers: RightAws::ActiveSdb::Base.find_by_... and RightAws::ActiveSdb::Base.find_all_by_...
277
- #
278
- # Client.find_by_name('Matias Rust')
279
- # Client.find_by_name_and_city('Putin','Moscow')
280
- # Client.find_by_name_and_city_and_post('Medvedev','Moscow','president')
281
- #
282
- # Client.find_all_by_author('G.Bush jr')
283
- # Client.find_all_by_age_and_gender_and_ethnicity('34','male','russian')
284
- # Client.find_all_by_gender_and_country('male', 'Russia', :auto_load => true, :order => 'name desc')
285
- #
286
- # Returned records have to be +reloaded+ to access their attributes.
287
- #
288
- # item = Client.find_by_name('Cat') #=> #<Client:0xb77d0d40 @attributes={"id"=>"2937601a-e45d-11dc-a75f-001bfc466dd7"}, @new_record=false>
289
- # item.reload #=> #<Client:0xb77d0d40 @attributes={"id"=>"2937601a-e45d-11dc-a75f-001bfc466dd7", "name"=>["Cat"], "toys"=>["Jons socks", "clew", "mice"]}, @new_record=false>
290
- #
291
- # Continue listing:
292
- # # initial listing
293
- # Client.find(:all, :limit => 10)
294
- # # continue listing
295
- # begin
296
- # Client.find(:all, :limit => 10, :next_token => Client.next_token)
297
- # end while Client.next_token
298
- #
299
- # Sort oder:
300
- # Client.find(:all, :order => 'gender')
301
- # Client.find(:all, :order => 'name desc')
302
- #
303
- # Attributes auto load (be carefull - this may take lot of time for a huge bunch of records):
304
- # Client.find(:first) #=> #<Client:0xb77d0d40 @attributes={"id"=>"2937601a-e45d-11dc-a75f-001bfc466dd7"}, @new_record=false>
305
- # Client.find(:first, :auto_load => true) #=> #<Client:0xb77d0d40 @attributes={"id"=>"2937601a-e45d-11dc-a75f-001bfc466dd7", "name"=>["Cat"], "toys"=>["Jons socks", "clew", "mice"]}, @new_record=false>
306
- #
307
- # see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?UsingQuery.html
257
+ # See select(), original find with QUERY syntax is deprecated so now find and select are synonyms.
308
258
  #
309
259
  def find(*args)
260
+ select(args)
261
+
262
+ =begin
263
+
310
264
  options = args.last.is_a?(Hash) ? args.pop : {}
311
265
  case args.first
312
266
  when :all then find_every options
313
267
  when :first then find_initial options
314
268
  else find_from_ids args, options
315
269
  end
270
+
271
+ =end
272
+
316
273
  end
317
274
 
318
275
  # Perform a SQL-like select request.
@@ -569,10 +526,19 @@ module RightAws
569
526
 
570
527
  # Misc
571
528
 
572
- def method_missing(method, *args) # :nodoc:
529
+ def method_missing(method, *args) # :nodoc:
573
530
  if method.to_s[/^(find_all_by_|find_by_|select_all_by_|select_by_)/]
531
+ # get rid of the find ones, only select now
532
+ to_send_to = $1
533
+ attributes = method.to_s[$1.length..method.to_s.length]
534
+ # puts 'attributes=' + attributes
535
+ if to_send_to[0...4] == "find"
536
+ to_send_to = "select" + to_send_to[4..to_send_to.length]
537
+ # puts 'CONVERTED ' + $1 + " to " + to_send_to
538
+ end
539
+
574
540
  options = args.last.is_a?(Hash) ? args.pop : {}
575
- __send__($1, method, args, options)
541
+ __send__(to_send_to, attributes, args, options)
576
542
  else
577
543
  super(method, *args)
578
544
  end
@@ -930,7 +896,7 @@ module RightAws
930
896
  attrs = {}
931
897
  attributes.each do |attribute, values|
932
898
  attribute = attribute.to_s
933
- attrs[attribute] = attribute == 'id' ? values.to_s : values.to_a.uniq
899
+ attrs[attribute] = attribute == 'id' ? values.to_s : [*values].uniq
934
900
  attrs.delete(attribute) if values.blank?
935
901
  end
936
902
  attrs
@@ -30,8 +30,8 @@ module RightAws
30
30
  include RightAwsBaseInterface
31
31
 
32
32
  DEFAULT_HOST = 'sdb.amazonaws.com'
33
- DEFAULT_PORT = 443
34
- DEFAULT_PROTOCOL = 'https'
33
+ DEFAULT_PORT = 80
34
+ DEFAULT_PROTOCOL = 'http'
35
35
  API_VERSION = '2007-11-07'
36
36
  DEFAULT_NIL_REPRESENTATION = 'nil'
37
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-13 00:00:00 -07:00
12
+ date: 2009-05-18 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency