simplydb 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 JT Archie
1
+ Copyright (c) 2010 JT Archie
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -194,7 +194,7 @@ module SimplyDB
194
194
 
195
195
  # Save the record to SimpleDB. Requires that an <tt>item_name</tt> has been set for the record.
196
196
  def save(replace = false)
197
- raise SimplyDB::Record::MissingItemName if @item_name.nil? || @item_name.empty?
197
+ raise SimplyDB::Record::MissingItemName if item_name.nil? || item_name.empty?
198
198
  if interface.put_attributes(domain_name, item_name, attributes, {}, replace)
199
199
  @new_record = false
200
200
  return true
@@ -238,7 +238,11 @@ module SimplyDB
238
238
  raise NoMethodError.new("Could not find method #{method}", method, *args)
239
239
  end
240
240
 
241
- attr_accessor :item_name
241
+ def item_name=(value)
242
+ @item_name = value.to_s
243
+ end
244
+
245
+ attr_reader :item_name
242
246
 
243
247
  private
244
248
  def read_attribute(name) #:nodoc:
@@ -246,7 +250,7 @@ module SimplyDB
246
250
  end
247
251
 
248
252
  def write_attribute(name, value) #:nodoc:
249
- @attributes[name.to_s] = value
253
+ @attributes[name.to_s] = value.to_s
250
254
  end
251
255
  end
252
256
  end
data/simplydb.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simplydb}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["JT Archie"]
12
- s.date = %q{2010-06-25}
12
+ s.date = %q{2010-06-30}
13
13
  s.description = %q{A minimal interface to Amazon SimpleDB that has separation of interfaces. From the low level HTTP request access to high level Ruby abstraction ORM.}
14
14
  s.email = %q{jtarchie@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -9,7 +9,7 @@ describe SimplyDB::Record::Base do
9
9
 
10
10
  @attributes = {
11
11
  'name' => 'Joe Smith',
12
- 'age' => 25
12
+ 'age' => "25"
13
13
  }
14
14
  end
15
15
 
@@ -39,13 +39,13 @@ describe SimplyDB::Record::Base do
39
39
  describe "while setting up a domain" do
40
40
  it "should be able to create the domain" do
41
41
  People.interface.should_receive(:create_domain).with('people').once.and_return(true)
42
- People.create_domain.should == true
42
+ People.create_domain.should be_true
43
43
  end
44
44
 
45
45
  describe "check the existance of the domain" do
46
46
  it "should not exist" do
47
47
  People.interface.should_receive(:domain_metadata).with('people').once.and_raise(SimplyDB::Error::NoSuchDomain)
48
- People.domain_exists?.should == false
48
+ People.domain_exists?.should be_false
49
49
  end
50
50
  it "should exist" do
51
51
  People.interface.should_receive(:domain_metadata).with('people').once.and_return({
@@ -57,13 +57,13 @@ describe SimplyDB::Record::Base do
57
57
  'AttributeValuesSizeBytes' => '50149756',
58
58
  'Timestamp' => '1225486466'
59
59
  })
60
- People.domain_exists?.should == true
60
+ People.domain_exists?.should be_true
61
61
  end
62
62
  end
63
63
 
64
64
  it "should be able to delete the domain" do
65
65
  People.interface.should_receive(:delete_domain).with('people').once.and_return(true)
66
- People.delete_domain.should == true
66
+ People.delete_domain.should be_true
67
67
  end
68
68
  end
69
69
  end
@@ -74,26 +74,26 @@ describe SimplyDB::Record::Base do
74
74
  end
75
75
  it "should be able to access the attributes" do
76
76
  @person[:name].should == 'Joe Smith'
77
- @person[:age].should == 25
77
+ @person[:age].should == "25"
78
78
  end
79
79
  it "should have first level access to attributes" do
80
80
  @person.name.should == 'Joe Smith'
81
- @person.age.should == 25
81
+ @person.age.should == "25"
82
82
  end
83
83
  it "should be able to set the attributes" do
84
84
  @person[:name] = 'Jane Smith'
85
85
  @person[:name].should == 'Jane Smith'
86
86
  @person[:age] = 27
87
- @person[:age].should == 27
87
+ @person[:age].should == "27"
88
88
  end
89
89
  it "should have first level access to set attributes" do
90
90
  @person.name = 'Jane Smith'
91
91
  @person.name.should == 'Jane Smith'
92
92
  @person.age = 27
93
- @person.age.should == 27
93
+ @person.age.should == "27"
94
94
  end
95
95
  it "should be a new record" do
96
- @person.new_record?.should == true
96
+ @person.new_record?.should be_true
97
97
  end
98
98
  it "should be able to retrieve attribute names" do
99
99
  @person.attribute_names.should == ['age', 'name']
@@ -120,10 +120,10 @@ describe SimplyDB::Record::Base do
120
120
 
121
121
  describe "#create" do
122
122
  it "should have saved the item" do
123
- People.interface.should_receive(:put_attributes).with("people", "1234", {'name'=>'Joe Smith', 'age'=>25}, anything, anything).and_return(true)
123
+ People.interface.should_receive(:put_attributes).with("people", "1234", @attributes, anything, anything).and_return(true)
124
124
  UUIDTools::UUID.should_receive(:random_create).and_return("1234")
125
125
  @person = People.create(@attributes)
126
- @person.new_record?.should == false
126
+ @person.new_record?.should be_false
127
127
  @person.item_name.should == "1234"
128
128
  end
129
129
  end
@@ -134,10 +134,10 @@ describe SimplyDB::Record::Base do
134
134
  end
135
135
  context "saving the attributes to domain" do
136
136
  it "should save successfully" do
137
- People.interface.should_receive(:put_attributes).with("people", "1234", {'name'=>'Joe Smith', 'age'=>25}, anything, anything).and_return(true)
137
+ People.interface.should_receive(:put_attributes).with("people", "1234", @attributes, anything, anything).and_return(true)
138
138
  @person.item_name = "1234"
139
139
  @person.save.should == true
140
- @person.new_record?.should == false
140
+ @person.new_record?.should be_false
141
141
  end
142
142
  context "should save unsuccessfully" do
143
143
  it "should complain about missing item_name" do
@@ -148,14 +148,14 @@ describe SimplyDB::Record::Base do
148
148
  end
149
149
  end
150
150
  it "should not change the values of the attributes" do
151
- People.interface.should_receive(:put_attributes).with("people", "1234", {'name'=>'Joe Smith', 'age'=>25}, anything, anything).and_return(true)
151
+ People.interface.should_receive(:put_attributes).with("people", "1234", @attributes, anything, anything).and_return(true)
152
152
  lambda {
153
153
  @person.item_name = "1234"
154
154
  @person.save
155
155
  }.should_not change { @person.attributes}
156
156
  end
157
157
  it "should replace all attributes item on domain" do
158
- People.interface.should_receive(:put_attributes).with("people", "1234", {'name'=>'Joe Smith', 'age'=>25}, anything, true).and_return(true)
158
+ People.interface.should_receive(:put_attributes).with("people", "1234", @attributes, anything, true).and_return(true)
159
159
  @person.item_name = "1234"
160
160
  @person.save(true)
161
161
  end
@@ -180,6 +180,7 @@ describe SimplyDB::Record::Base do
180
180
  People.interface.should_receive(:get_attributes).with("people","1234").and_return(@attributes)
181
181
  @person = People.find("1234")
182
182
  @person.attributes.should == @attributes
183
+ @person.new_record?.should be_false
183
184
  end
184
185
 
185
186
  it "should raise ItemNotFound" do
@@ -190,9 +191,8 @@ describe SimplyDB::Record::Base do
190
191
  end
191
192
  end
192
193
 
193
- describe "#find" do
194
- end
195
-
196
194
  describe "#find_by_select" do
195
+ it "should return an empty array if nothing was found"
196
+ it "should return a has of initialized items"
197
197
  end
198
198
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplydb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 0
10
- version: 0.0.0
9
+ - 1
10
+ version: 0.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - JT Archie
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-25 00:00:00 -07:00
18
+ date: 2010-06-30 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency