curdbee 0.0.8 → 0.0.9

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{curdbee}
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Lakshan Perera"]
12
- s.date = %q{2010-12-15}
12
+ s.date = %q{2011-03-14}
13
13
  s.email = %q{lakshan@vesess.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -29,8 +29,8 @@ module CurdBee
29
29
  return true if (response.code.to_i == 201)
30
30
  end
31
31
 
32
- def update
33
- body = {"#{self.class.element}" => self}.to_json
32
+ def update(attrs=nil)
33
+ body = {"#{self.class.element}" => (attrs || self)}.to_json
34
34
  response = self.class.send_request(:put, "/#{self.class.resource}/#{self[:id]}", :body => body)
35
35
  #Hashie::Mash.new(response["#{@element}"])
36
36
  return true if (response.code.to_i == 200)
@@ -62,7 +62,7 @@ module CurdBee
62
62
  when 403
63
63
  raise(CurdBee::Error::Forbidden.new(response), "Your action was forbidden.")
64
64
  when 422
65
- raise(CurdBee::Error::BadRequest.new(response), JSON.parse(response.body).join(" "))
65
+ raise(CurdBee::Error::BadRequest.new(response), (!response.body.empty? ? JSON.parse(response.body).join(" ") : "") )
66
66
  when 404
67
67
  raise(CurdBee::Error::NotFound.new(response), "Resource not found.")
68
68
  when 500
@@ -10,19 +10,19 @@ describe CurdBee::Client do
10
10
  end
11
11
 
12
12
  it "should return a list of clients" do
13
- stub_get "http://test.curdbee.com/clients.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "clients.json"
13
+ stub_get "https://test.curdbee.com/clients.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "clients.json"
14
14
  result = CurdBee::Client.list
15
15
  result.first.name.should == "Awesome Inc."
16
16
  end
17
17
 
18
18
  it "should take limit as an option" do
19
- stub_get "http://test.curdbee.com/clients.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "clients.json"
19
+ stub_get "https://test.curdbee.com/clients.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "clients.json"
20
20
  result = CurdBee::Client.list(:limit => 1)
21
21
  result.length.should == 1
22
22
  end
23
23
 
24
24
  it "should take page as an option" do
25
- stub_get "http://test.curdbee.com/clients.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "clients.json"
25
+ stub_get "https://test.curdbee.com/clients.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "clients.json"
26
26
  result = CurdBee::Client.list(:limit => 1, :page => 2)
27
27
  result.length.should == 1
28
28
  end
@@ -37,13 +37,13 @@ describe CurdBee::Client do
37
37
  end
38
38
 
39
39
  it "should return the matching client" do
40
- stub_get "http://test.curdbee.com/clients/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "client.json"
40
+ stub_get "https://test.curdbee.com/clients/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "client.json"
41
41
  result = CurdBee::Client.show(31)
42
42
  result.name.should == "Awesome Inc."
43
43
  end
44
44
 
45
45
  it "should raise an error if nothing found" do
46
- stub_get "http://test.curdbee.com/clients/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
46
+ stub_get "https://test.curdbee.com/clients/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
47
47
  lambda{
48
48
  CurdBee::Client.show(32)
49
49
  }.should raise_error(CurdBee::Error::NotFound)
@@ -59,7 +59,7 @@ describe CurdBee::Client do
59
59
  end
60
60
 
61
61
  it "should return the created client" do
62
- stub_post "http://test.curdbee.com/clients?api_token=TYMuwW6rM2PQnoWx1ht4", "new_client.json"
62
+ stub_post "https://test.curdbee.com/clients?api_token=TYMuwW6rM2PQnoWx1ht4", "new_client.json"
63
63
  @client = CurdBee::Client.new(
64
64
  :name => "RickRoll Inc.",
65
65
  :email => "rickroll@example.com",
@@ -70,7 +70,7 @@ describe CurdBee::Client do
70
70
  end
71
71
 
72
72
  it "should raise an error if creation fails" do
73
- stub_post "http://test.curdbee.com/clients?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
73
+ stub_post "https://test.curdbee.com/clients?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
74
74
  lambda{
75
75
  @client = CurdBee::Client.new()
76
76
  @client.create
@@ -85,12 +85,19 @@ describe CurdBee::Client do
85
85
  before do
86
86
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
87
87
  CurdBee::Config.subdomain = "test"
88
- stub_get "http://test.curdbee.com/clients/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "client.json"
88
+ stub_get "https://test.curdbee.com/clients/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "client.json"
89
89
  @client = CurdBee::Client.show(31)
90
90
  end
91
+
92
+ it "should be possible to pass update params to the method" do
93
+ stub_put "https://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_client.json"
94
+
95
+ result = @client.update({:name => "RickRoll Inc.", :email => "rickroll@example.com"})
96
+ result.should be_true
97
+ end
91
98
 
92
99
  it "should return the updated client" do
93
- stub_put "http://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_client.json"
100
+ stub_put "https://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_client.json"
94
101
  @client.name = "RickRoll Inc."
95
102
  @client.email = "rickroll@example.com"
96
103
 
@@ -99,14 +106,13 @@ describe CurdBee::Client do
99
106
  end
100
107
 
101
108
  it "should raise an error if update fails" do
102
- stub_put "http://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
109
+ stub_put "https://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
103
110
  lambda{
104
111
  @client.name = ""
105
112
  @client.update
106
113
  }.should raise_error(CurdBee::Error::BadRequest)
107
114
  end
108
115
 
109
-
110
116
  end
111
117
 
112
118
  describe 'delete' do
@@ -114,25 +120,25 @@ describe CurdBee::Client do
114
120
  before do
115
121
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
116
122
  CurdBee::Config.subdomain = "test"
117
- stub_get "http://test.curdbee.com/clients/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "client.json"
123
+ stub_get "https://test.curdbee.com/clients/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "client.json"
118
124
  @client = CurdBee::Client.show(31)
119
125
  end
120
126
 
121
127
  it "should return true if client was deleted" do
122
- stub_delete "http://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
128
+ stub_delete "https://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
123
129
  result = @client.delete
124
130
  result.should == true
125
131
  end
126
132
 
127
133
  it "should raise a bad request error if deletion fails" do
128
- stub_delete "http://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
134
+ stub_delete "https://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
129
135
  lambda{
130
136
  @client.delete
131
137
  }.should raise_error(CurdBee::Error::BadRequest)
132
138
  end
133
139
 
134
140
  it "should raise a not found error if client doesnt exist" do
135
- stub_delete "http://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
141
+ stub_delete "https://test.curdbee.com/clients/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
136
142
  lambda{
137
143
  @client.delete
138
144
  }.should raise_error(CurdBee::Error::NotFound)
@@ -10,19 +10,19 @@ describe CurdBee::Estimate do
10
10
  end
11
11
 
12
12
  it "should return a list of estimates" do
13
- stub_get "http://test.curdbee.com/estimates.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "estimates.json"
13
+ stub_get "https://test.curdbee.com/estimates.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "estimates.json"
14
14
  result = CurdBee::Estimate.list
15
15
  result.first.estimate_no.should == "TEST-1"
16
16
  end
17
17
 
18
18
  it "should take limit as an option" do
19
- stub_get "http://test.curdbee.com/estimates.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "estimates.json"
19
+ stub_get "https://test.curdbee.com/estimates.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "estimates.json"
20
20
  result = CurdBee::Estimate.list(:limit => 1)
21
21
  result.length.should == 1
22
22
  end
23
23
 
24
24
  it "should take page as an option" do
25
- stub_get "http://test.curdbee.com/estimates.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "estimates.json"
25
+ stub_get "https://test.curdbee.com/estimates.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "estimates.json"
26
26
  result = CurdBee::Estimate.list(:limit => 1, :page => 2)
27
27
  result.length.should == 1
28
28
  end
@@ -36,13 +36,13 @@ describe CurdBee::Estimate do
36
36
  end
37
37
 
38
38
  it "should return the matching estimate" do
39
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
39
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
40
40
  result = CurdBee::Estimate.show(31)
41
41
  result.estimate_no.should == "TEST-1"
42
42
  end
43
43
 
44
44
  it "should raise an error if nothing found" do
45
- stub_get "http://test.curdbee.com/estimates/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
45
+ stub_get "https://test.curdbee.com/estimates/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
46
46
  lambda{
47
47
  CurdBee::Estimate.show(32)
48
48
  }.should raise_error(CurdBee::Error::NotFound)
@@ -58,7 +58,7 @@ describe CurdBee::Estimate do
58
58
  end
59
59
 
60
60
  it "should return the created estimate" do
61
- stub_post "http://test.curdbee.com/estimates?api_token=TYMuwW6rM2PQnoWx1ht4", "new_estimate.json"
61
+ stub_post "https://test.curdbee.com/estimates?api_token=TYMuwW6rM2PQnoWx1ht4", "new_estimate.json"
62
62
  estimate_info = {:date => Date.today, :estimate_no => "EST-NEW", :client_id => @client.id,
63
63
  :line_items_attributes => [{:name_and_description => "Sample Item", :quantity => 1, :price => 25.00, :unit => "hour"}]
64
64
  }
@@ -68,7 +68,7 @@ describe CurdBee::Estimate do
68
68
  end
69
69
 
70
70
  it "should raise an error if creation fails" do
71
- stub_post "http://test.curdbee.com/estimates?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
71
+ stub_post "https://test.curdbee.com/estimates?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
72
72
  lambda{
73
73
  @estimate = CurdBee::Estimate.new({})
74
74
  @estimate.create
@@ -83,12 +83,12 @@ describe CurdBee::Estimate do
83
83
  before do
84
84
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
85
85
  CurdBee::Config.subdomain = "test"
86
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
86
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
87
87
  @estimate = CurdBee::Estimate.show(31)
88
88
  end
89
89
 
90
90
  it "should return the updated estimate" do
91
- stub_put "http://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_estimate.json"
91
+ stub_put "https://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_estimate.json"
92
92
  @estimate.estimate_no = "EST-NEW"
93
93
  @estimate.date = Date.today
94
94
 
@@ -97,7 +97,7 @@ describe CurdBee::Estimate do
97
97
  end
98
98
 
99
99
  it "should raise an error if update fails" do
100
- stub_put "http://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
100
+ stub_put "https://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
101
101
  lambda{
102
102
  @estimate.estimate_no = ""
103
103
  @estimate.update
@@ -112,25 +112,25 @@ describe CurdBee::Estimate do
112
112
  before do
113
113
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
114
114
  CurdBee::Config.subdomain = "test"
115
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
115
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
116
116
  @estimate = CurdBee::Estimate.show(31)
117
117
  end
118
118
 
119
119
  it "should return true if estimate was deleted" do
120
- stub_delete "http://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
120
+ stub_delete "https://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
121
121
  result = @estimate.delete
122
122
  result.should be_true
123
123
  end
124
124
 
125
125
  it "should raise a bad request error if deletion fails" do
126
- stub_delete "http://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
126
+ stub_delete "https://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
127
127
  lambda{
128
128
  @estimate.delete
129
129
  }.should raise_error(CurdBee::Error::BadRequest)
130
130
  end
131
131
 
132
132
  it "should raise a not found error if estimate doesnt exist" do
133
- stub_delete "http://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
133
+ stub_delete "https://test.curdbee.com/estimates/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
134
134
  lambda{
135
135
  @estimate.delete
136
136
  }.should raise_error(CurdBee::Error::NotFound)
@@ -144,25 +144,25 @@ describe CurdBee::Estimate do
144
144
  before do
145
145
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
146
146
  CurdBee::Config.subdomain = "test"
147
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
147
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
148
148
  @estimate = CurdBee::Estimate.show(31)
149
149
  end
150
150
 
151
151
  it "should return the duplicated estimate if it was duplicated" do
152
- stub_post "http://test.curdbee.com/estimates/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "new_estimate.json"
152
+ stub_post "https://test.curdbee.com/estimates/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "new_estimate.json"
153
153
  result = @estimate.duplicate
154
154
  result.estimate_no.should == "EST-NEW"
155
155
  end
156
156
 
157
157
  it "should raise a bad request error if duplication fails" do
158
- stub_post "http://test.curdbee.com/estimates/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
158
+ stub_post "https://test.curdbee.com/estimates/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
159
159
  lambda{
160
160
  @estimate.duplicate
161
161
  }.should raise_error(CurdBee::Error::BadRequest)
162
162
  end
163
163
 
164
164
  it "should raise a not found error if estimate doesnt exist" do
165
- stub_post "http://test.curdbee.com/estimates/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
165
+ stub_post "https://test.curdbee.com/estimates/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
166
166
  lambda{
167
167
  @estimate.duplicate
168
168
  }.should raise_error(CurdBee::Error::NotFound)
@@ -174,25 +174,25 @@ describe CurdBee::Estimate do
174
174
  before do
175
175
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
176
176
  CurdBee::Config.subdomain = "test"
177
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
177
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
178
178
  @estimate = CurdBee::Estimate.show(31)
179
179
  end
180
180
 
181
181
  it "should return true if estimate was closed" do
182
- stub_post "http://test.curdbee.com/estimates/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
182
+ stub_post "https://test.curdbee.com/estimates/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
183
183
  result = @estimate.close
184
184
  result.should be_true
185
185
  end
186
186
 
187
187
  it "should raise a bad request error if closing fails" do
188
- stub_post "http://test.curdbee.com/estimates/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
188
+ stub_post "https://test.curdbee.com/estimates/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
189
189
  lambda{
190
190
  @estimate.close
191
191
  }.should raise_error(CurdBee::Error::BadRequest)
192
192
  end
193
193
 
194
194
  it "should raise a not found error if estimate doesnt exist" do
195
- stub_post "http://test.curdbee.com/estimates/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
195
+ stub_post "https://test.curdbee.com/estimates/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
196
196
  lambda{
197
197
  @estimate.close
198
198
  }.should raise_error(CurdBee::Error::NotFound)
@@ -204,25 +204,25 @@ describe CurdBee::Estimate do
204
204
  before do
205
205
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
206
206
  CurdBee::Config.subdomain = "test"
207
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
207
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
208
208
  @estimate = CurdBee::Estimate.show(31)
209
209
  end
210
210
 
211
211
  it "should return true if estimate was reopened" do
212
- stub_post "http://test.curdbee.com/estimates/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
212
+ stub_post "https://test.curdbee.com/estimates/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
213
213
  result = @estimate.reopen
214
214
  result.should be_true
215
215
  end
216
216
 
217
217
  it "should raise a bad request error if reopening fails" do
218
- stub_post "http://test.curdbee.com/estimates/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
218
+ stub_post "https://test.curdbee.com/estimates/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
219
219
  lambda{
220
220
  @estimate.reopen
221
221
  }.should raise_error(CurdBee::Error::BadRequest)
222
222
  end
223
223
 
224
224
  it "should raise a not found error if estimate doesnt exist" do
225
- stub_post "http://test.curdbee.com/estimates/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
225
+ stub_post "https://test.curdbee.com/estimates/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
226
226
  lambda{
227
227
  @estimate.reopen
228
228
  }.should raise_error(CurdBee::Error::NotFound)
@@ -234,25 +234,25 @@ describe CurdBee::Estimate do
234
234
  before do
235
235
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
236
236
  CurdBee::Config.subdomain = "test"
237
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
237
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
238
238
  @estimate = CurdBee::Estimate.show(31)
239
239
  end
240
240
 
241
241
  it "should return the invoice if estimate was converted to a invoice" do
242
- stub_post "http://test.curdbee.com/estimates/31/convert?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
242
+ stub_post "https://test.curdbee.com/estimates/31/convert?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
243
243
  result = @estimate.convert
244
244
  result.invoice_no.should == "IN-NEW"
245
245
  end
246
246
 
247
247
  it "should raise a bad request error if reopening fails" do
248
- stub_post "http://test.curdbee.com/estimates/31/convert?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
248
+ stub_post "https://test.curdbee.com/estimates/31/convert?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
249
249
  lambda{
250
250
  @estimate.convert
251
251
  }.should raise_error(CurdBee::Error::BadRequest)
252
252
  end
253
253
 
254
254
  it "should raise a not found error if estimate doesnt exist" do
255
- stub_post "http://test.curdbee.com/estimates/31/convert?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
255
+ stub_post "https://test.curdbee.com/estimates/31/convert?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
256
256
  lambda{
257
257
  @estimate.convert
258
258
  }.should raise_error(CurdBee::Error::NotFound)
@@ -265,25 +265,25 @@ describe CurdBee::Estimate do
265
265
  before do
266
266
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
267
267
  CurdBee::Config.subdomain = "test"
268
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
268
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
269
269
  @estimate = CurdBee::Estimate.show(31)
270
270
  end
271
271
 
272
272
  it "should return true if estimate was sent" do
273
- stub_post "http://test.curdbee.com/deliver/estimate/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
273
+ stub_post "https://test.curdbee.com/deliver/estimate/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
274
274
  result = @estimate.deliver
275
275
  result.should be_true
276
276
  end
277
277
 
278
278
  it "should raise a bad request error if sending fails" do
279
- stub_post "http://test.curdbee.com/deliver/estimate/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
279
+ stub_post "https://test.curdbee.com/deliver/estimate/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
280
280
  lambda{
281
281
  @estimate.deliver
282
282
  }.should raise_error(CurdBee::Error::BadRequest)
283
283
  end
284
284
 
285
285
  it "should raise a not found error if estimate doesnt exist" do
286
- stub_post "http://test.curdbee.com/deliver/estimate/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
286
+ stub_post "https://test.curdbee.com/deliver/estimate/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
287
287
  lambda{
288
288
  @estimate.deliver
289
289
  }.should raise_error(CurdBee::Error::NotFound)
@@ -295,12 +295,12 @@ describe CurdBee::Estimate do
295
295
  before do
296
296
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
297
297
  CurdBee::Config.subdomain = "test"
298
- stub_get "http://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
298
+ stub_get "https://test.curdbee.com/estimates/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "estimate.json"
299
299
  @estimate = CurdBee::Estimate.show(31)
300
300
  end
301
301
 
302
302
  it "should return the permalink to view a sent invoice" do
303
- @estimate.permalink.should == "http://test.curdbee.com/est/tx9045ff"
303
+ @estimate.permalink.should == "https://test.curdbee.com/est/tx9045ff"
304
304
  end
305
305
 
306
306
  it "should return nothing for draft invoices" do
@@ -10,19 +10,19 @@ describe CurdBee::Invoice do
10
10
  end
11
11
 
12
12
  it "should return a list of invoices" do
13
- stub_get "http://test.curdbee.com/invoices.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "invoices.json"
13
+ stub_get "https://test.curdbee.com/invoices.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "invoices.json"
14
14
  result = CurdBee::Invoice.list
15
15
  result.first.invoice_no.should == "TEST-1"
16
16
  end
17
17
 
18
18
  it "should take limit as an option" do
19
- stub_get "http://test.curdbee.com/invoices.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "invoices.json"
19
+ stub_get "https://test.curdbee.com/invoices.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "invoices.json"
20
20
  result = CurdBee::Invoice.list(:limit => 1)
21
21
  result.length.should == 1
22
22
  end
23
23
 
24
24
  it "should take page as an option" do
25
- stub_get "http://test.curdbee.com/invoices.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "invoices.json"
25
+ stub_get "https://test.curdbee.com/invoices.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "invoices.json"
26
26
  result = CurdBee::Invoice.list(:limit => 1, :page => 2)
27
27
  result.length.should == 1
28
28
  end
@@ -36,13 +36,13 @@ describe CurdBee::Invoice do
36
36
  end
37
37
 
38
38
  it "should return the matching invoice" do
39
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
39
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
40
40
  result = CurdBee::Invoice.show(31)
41
41
  result.invoice_no.should == "TEST-1"
42
42
  end
43
43
 
44
44
  it "should raise an error if nothing found" do
45
- stub_get "http://test.curdbee.com/invoices/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
45
+ stub_get "https://test.curdbee.com/invoices/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
46
46
  lambda{
47
47
  CurdBee::Invoice.show(32)
48
48
  }.should raise_error(CurdBee::Error::NotFound)
@@ -58,7 +58,7 @@ describe CurdBee::Invoice do
58
58
  end
59
59
 
60
60
  it "should return the created invoice" do
61
- stub_post "http://test.curdbee.com/invoices?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
61
+ stub_post "https://test.curdbee.com/invoices?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
62
62
  invoice_info = {:date => Date.today, :invoice_no => "IN-NEW", :client_id => @client.id,
63
63
  :line_items_attributes => [{:name_and_description => "Sample Item", :quantity => 1, :price => 25.00, :unit => "hour"}]
64
64
  }
@@ -69,7 +69,7 @@ describe CurdBee::Invoice do
69
69
  end
70
70
 
71
71
  it "should raise an error if creation fails" do
72
- stub_post "http://test.curdbee.com/invoices?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
72
+ stub_post "https://test.curdbee.com/invoices?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
73
73
  lambda{
74
74
  @invoice = CurdBee::Invoice.new({})
75
75
  @invoice.create
@@ -83,12 +83,12 @@ describe CurdBee::Invoice do
83
83
  before do
84
84
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
85
85
  CurdBee::Config.subdomain = "test"
86
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
86
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
87
87
  @invoice = CurdBee::Invoice.show(31)
88
88
  end
89
89
 
90
90
  it "should return the updated invoice" do
91
- stub_put "http://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
91
+ stub_put "https://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
92
92
 
93
93
  @invoice.invoice_no = "IN-NEW"
94
94
  @invoice.date = Date.today
@@ -98,7 +98,7 @@ describe CurdBee::Invoice do
98
98
  end
99
99
 
100
100
  it "should raise an error if update fails" do
101
- stub_put "http://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
101
+ stub_put "https://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
102
102
  lambda{
103
103
  @invoice.invoice_no = ""
104
104
  @invoice.update
@@ -112,25 +112,25 @@ describe CurdBee::Invoice do
112
112
  before do
113
113
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
114
114
  CurdBee::Config.subdomain = "test"
115
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
115
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
116
116
  @invoice = CurdBee::Invoice.show(31)
117
117
  end
118
118
 
119
119
  it "should return true if invoice was deleted" do
120
- stub_delete "http://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
120
+ stub_delete "https://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
121
121
  result = @invoice.delete
122
122
  result.should == true
123
123
  end
124
124
 
125
125
  it "should raise a bad request error if deletion fails" do
126
- stub_delete "http://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
126
+ stub_delete "https://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
127
127
  lambda{
128
128
  @invoice.delete
129
129
  }.should raise_error(CurdBee::Error::BadRequest)
130
130
  end
131
131
 
132
132
  it "should raise a not found error if invoice doesnt exist" do
133
- stub_delete "http://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
133
+ stub_delete "https://test.curdbee.com/invoices/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
134
134
  lambda{
135
135
  @invoice.delete
136
136
  }.should raise_error(CurdBee::Error::NotFound)
@@ -143,25 +143,25 @@ describe CurdBee::Invoice do
143
143
  before do
144
144
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
145
145
  CurdBee::Config.subdomain = "test"
146
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
146
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
147
147
  @invoice = CurdBee::Invoice.show(31)
148
148
  end
149
149
 
150
150
  it "should return the duplicated invoice if invoice was duplicated" do
151
- stub_post "http://test.curdbee.com/invoices/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
151
+ stub_post "https://test.curdbee.com/invoices/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "new_invoice.json"
152
152
  result = @invoice.duplicate
153
153
  result.invoice_no.should == "IN-NEW"
154
154
  end
155
155
 
156
156
  it "should raise a bad request error if duplication fails" do
157
- stub_post "http://test.curdbee.com/invoices/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
157
+ stub_post "https://test.curdbee.com/invoices/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
158
158
  lambda{
159
159
  @invoice.duplicate
160
160
  }.should raise_error(CurdBee::Error::BadRequest)
161
161
  end
162
162
 
163
163
  it "should raise a not found error if invoice doesnt exist" do
164
- stub_post "http://test.curdbee.com/invoices/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
164
+ stub_post "https://test.curdbee.com/invoices/31/duplicate?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
165
165
  lambda{
166
166
  @invoice.duplicate
167
167
  }.should raise_error(CurdBee::Error::NotFound)
@@ -173,25 +173,25 @@ describe CurdBee::Invoice do
173
173
  before do
174
174
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
175
175
  CurdBee::Config.subdomain = "test"
176
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
176
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
177
177
  @invoice = CurdBee::Invoice.show(31)
178
178
  end
179
179
 
180
180
  it "should return true if invoice was closed" do
181
- stub_post "http://test.curdbee.com/invoices/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
181
+ stub_post "https://test.curdbee.com/invoices/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
182
182
  result = @invoice.close
183
183
  result.should == true
184
184
  end
185
185
 
186
186
  it "should raise a bad request error if closing fails" do
187
- stub_post "http://test.curdbee.com/invoices/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
187
+ stub_post "https://test.curdbee.com/invoices/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
188
188
  lambda{
189
189
  @invoice.close
190
190
  }.should raise_error(CurdBee::Error::BadRequest)
191
191
  end
192
192
 
193
193
  it "should raise a not found error if invoice doesnt exist" do
194
- stub_post "http://test.curdbee.com/invoices/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
194
+ stub_post "https://test.curdbee.com/invoices/31/close?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
195
195
  lambda{
196
196
  @invoice.close
197
197
  }.should raise_error(CurdBee::Error::NotFound)
@@ -203,25 +203,25 @@ describe CurdBee::Invoice do
203
203
  before do
204
204
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
205
205
  CurdBee::Config.subdomain = "test"
206
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
206
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
207
207
  @invoice = CurdBee::Invoice.show(31)
208
208
  end
209
209
 
210
210
  it "should return true if invoice was reopened" do
211
- stub_post "http://test.curdbee.com/invoices/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
211
+ stub_post "https://test.curdbee.com/invoices/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
212
212
  result = @invoice.reopen
213
213
  result.should == true
214
214
  end
215
215
 
216
216
  it "should raise a bad request error if reopening fails" do
217
- stub_post "http://test.curdbee.com/invoices/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
217
+ stub_post "https://test.curdbee.com/invoices/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
218
218
  lambda{
219
219
  @invoice.reopen
220
220
  }.should raise_error(CurdBee::Error::BadRequest)
221
221
  end
222
222
 
223
223
  it "should raise a not found error if invoice doesnt exist" do
224
- stub_post "http://test.curdbee.com/invoices/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
224
+ stub_post "https://test.curdbee.com/invoices/31/reopen?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
225
225
  lambda{
226
226
  @invoice.reopen
227
227
  }.should raise_error(CurdBee::Error::NotFound)
@@ -233,25 +233,25 @@ describe CurdBee::Invoice do
233
233
  before do
234
234
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
235
235
  CurdBee::Config.subdomain = "test"
236
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
236
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
237
237
  @invoice = CurdBee::Invoice.show(31)
238
238
  end
239
239
 
240
240
  it "should return true if invoice was delivered" do
241
- stub_post "http://test.curdbee.com/deliver/invoice/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
241
+ stub_post "https://test.curdbee.com/deliver/invoice/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
242
242
  result = @invoice.deliver
243
243
  result.should == true
244
244
  end
245
245
 
246
246
  it "should raise a bad request error if sending fails" do
247
- stub_post "http://test.curdbee.com/deliver/invoice/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
247
+ stub_post "https://test.curdbee.com/deliver/invoice/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
248
248
  lambda{
249
249
  @invoice.deliver
250
250
  }.should raise_error(CurdBee::Error::BadRequest)
251
251
  end
252
252
 
253
253
  it "should raise a not found error if invoice doesnt exist" do
254
- stub_post "http://test.curdbee.com/deliver/invoice/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
254
+ stub_post "https://test.curdbee.com/deliver/invoice/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
255
255
  lambda{
256
256
  @invoice.deliver
257
257
  }.should raise_error(CurdBee::Error::NotFound)
@@ -263,12 +263,12 @@ describe CurdBee::Invoice do
263
263
  before do
264
264
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
265
265
  CurdBee::Config.subdomain = "test"
266
- stub_get "http://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
266
+ stub_get "https://test.curdbee.com/invoices/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "invoice.json"
267
267
  @invoice = CurdBee::Invoice.show(31)
268
268
  end
269
269
 
270
270
  it "should return the permalink to view a sent invoice" do
271
- @invoice.permalink.should == "http://test.curdbee.com/inv/tx9045ff"
271
+ @invoice.permalink.should == "https://test.curdbee.com/inv/tx9045ff"
272
272
  end
273
273
 
274
274
  it "should return nothing for draft invoices" do
@@ -10,19 +10,19 @@ describe CurdBee::Item do
10
10
  end
11
11
 
12
12
  it "should return a list of items" do
13
- stub_get "http://test.curdbee.com/items.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "items.json"
13
+ stub_get "https://test.curdbee.com/items.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "items.json"
14
14
  result = CurdBee::Item.list
15
15
  result.first.name.should == "My Item"
16
16
  end
17
17
 
18
18
  it "should take limit as an option" do
19
- stub_get "http://test.curdbee.com/items.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "items.json"
19
+ stub_get "https://test.curdbee.com/items.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "items.json"
20
20
  result = CurdBee::Item.list(:limit => 1)
21
21
  result.length.should == 1
22
22
  end
23
23
 
24
24
  it "should take page as an option" do
25
- stub_get "http://test.curdbee.com/items.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "items.json"
25
+ stub_get "https://test.curdbee.com/items.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "items.json"
26
26
  result = CurdBee::Item.list(:limit => 1, :page => 2)
27
27
  result.length.should == 1
28
28
  end
@@ -36,13 +36,13 @@ describe CurdBee::Item do
36
36
  end
37
37
 
38
38
  it "should return the matching item" do
39
- stub_get "http://test.curdbee.com/items/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "item.json"
39
+ stub_get "https://test.curdbee.com/items/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "item.json"
40
40
  result = CurdBee::Item.show(25)
41
41
  result.name.should == "My Item"
42
42
  end
43
43
 
44
44
  it "should raise an error if nothing found" do
45
- stub_get "http://test.curdbee.com/items/27.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
45
+ stub_get "https://test.curdbee.com/items/27.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
46
46
  lambda{
47
47
  CurdBee::Item.show(27)
48
48
  }.should raise_error(CurdBee::Error::NotFound)
@@ -58,14 +58,14 @@ describe CurdBee::Item do
58
58
  end
59
59
 
60
60
  it "should return the created item" do
61
- stub_post "http://test.curdbee.com/items?api_token=TYMuwW6rM2PQnoWx1ht4", "new_item.json"
61
+ stub_post "https://test.curdbee.com/items?api_token=TYMuwW6rM2PQnoWx1ht4", "new_item.json"
62
62
  @item = CurdBee::Item.new(:name => "My New Item")
63
63
  result = @item.create
64
64
  @item.id.should == 28
65
65
  end
66
66
 
67
67
  it "should raise an error if creation fails" do
68
- stub_post "http://test.curdbee.com/items?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
68
+ stub_post "https://test.curdbee.com/items?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
69
69
  lambda{
70
70
  @item = CurdBee::Item.new()
71
71
  @item.create
@@ -80,12 +80,12 @@ describe CurdBee::Item do
80
80
  before do
81
81
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
82
82
  CurdBee::Config.subdomain = "test"
83
- stub_get "http://test.curdbee.com/items/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "item.json"
83
+ stub_get "https://test.curdbee.com/items/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "item.json"
84
84
  @item = CurdBee::Item.show(25)
85
85
  end
86
86
 
87
87
  it "should return the updated item" do
88
- stub_put "http://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "new_item.json"
88
+ stub_put "https://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "new_item.json"
89
89
  @item.name = "My New Item"
90
90
  result = @item.update
91
91
 
@@ -93,7 +93,7 @@ describe CurdBee::Item do
93
93
  end
94
94
 
95
95
  it "should raise an error if update fails" do
96
- stub_put "http://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
96
+ stub_put "https://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
97
97
  lambda{
98
98
  @item.name = ""
99
99
  @item.update
@@ -108,25 +108,25 @@ describe CurdBee::Item do
108
108
  before do
109
109
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
110
110
  CurdBee::Config.subdomain = "test"
111
- stub_get "http://test.curdbee.com/items/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "item.json"
111
+ stub_get "https://test.curdbee.com/items/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "item.json"
112
112
  @item = CurdBee::Item.show(25)
113
113
  end
114
114
 
115
115
  it "should return true if item was deleted" do
116
- stub_delete "http://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
116
+ stub_delete "https://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
117
117
  result = @item.delete
118
118
  result.should == true
119
119
  end
120
120
 
121
121
  it "should raise a bad request error if deletion fails" do
122
- stub_delete "http://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
122
+ stub_delete "https://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
123
123
  lambda{
124
124
  @item.delete
125
125
  }.should raise_error(CurdBee::Error::BadRequest)
126
126
  end
127
127
 
128
128
  it "should raise a not found error if item doesnt exist" do
129
- stub_delete "http://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
129
+ stub_delete "https://test.curdbee.com/items/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
130
130
  lambda{
131
131
  @item.delete
132
132
  }.should raise_error(CurdBee::Error::NotFound)
@@ -11,7 +11,7 @@ describe CurdBee::Payment do
11
11
  end
12
12
 
13
13
  it "should return a list of payments" do
14
- stub_get "http://test.curdbee.com/invoices/23/payments.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "payments.json"
14
+ stub_get "https://test.curdbee.com/invoices/23/payments.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "payments.json"
15
15
  result = CurdBee::Payment.list
16
16
  result.first.payment_method.should == "cash"
17
17
  end
@@ -29,7 +29,7 @@ describe CurdBee::Payment do
29
29
  end
30
30
 
31
31
  it "should return the matching payment" do
32
- stub_get "http://test.curdbee.com/invoices/23/payments/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "payment.json"
32
+ stub_get "https://test.curdbee.com/invoices/23/payments/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "payment.json"
33
33
  result = CurdBee::Payment.show(25)
34
34
  result.payment_method.should == "cash"
35
35
  end
@@ -38,7 +38,7 @@ describe CurdBee::Payment do
38
38
  end
39
39
 
40
40
  it "should raise an error if nothing found" do
41
- stub_get "http://test.curdbee.com/invoices/23/payments/28.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
41
+ stub_get "https://test.curdbee.com/invoices/23/payments/28.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
42
42
  lambda{
43
43
  CurdBee::Payment.show(28)
44
44
  }.should raise_error(CurdBee::Error::NotFound)
@@ -55,7 +55,7 @@ describe CurdBee::Payment do
55
55
  end
56
56
 
57
57
  it "should return the created payment" do
58
- stub_post "http://test.curdbee.com/invoices/23/payments?api_token=TYMuwW6rM2PQnoWx1ht4", "new_payment.json"
58
+ stub_post "https://test.curdbee.com/invoices/23/payments?api_token=TYMuwW6rM2PQnoWx1ht4", "new_payment.json"
59
59
  payment_info = {
60
60
  :amount => 50,
61
61
  :date => Date.today,
@@ -67,7 +67,7 @@ describe CurdBee::Payment do
67
67
  end
68
68
 
69
69
  it "should raise an error if creation fails" do
70
- stub_post "http://test.curdbee.com/invoices/23/payments?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
70
+ stub_post "https://test.curdbee.com/invoices/23/payments?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
71
71
  lambda{
72
72
  @payment = CurdBee::Payment.new({})
73
73
  @payment.create
@@ -83,12 +83,12 @@ describe CurdBee::Payment do
83
83
  CurdBee::Config.subdomain = "test"
84
84
  CurdBee::Payment.invoice_id = 23
85
85
 
86
- stub_get "http://test.curdbee.com/invoices/23/payments/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "payment.json"
86
+ stub_get "https://test.curdbee.com/invoices/23/payments/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "payment.json"
87
87
  @payment = CurdBee::Payment.show(25)
88
88
  end
89
89
 
90
90
  it "should return the updated payment" do
91
- stub_put "http://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "new_payment.json"
91
+ stub_put "https://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "new_payment.json"
92
92
  @payment.payment_method = "custom payment"
93
93
 
94
94
  result = @payment.update
@@ -96,7 +96,7 @@ describe CurdBee::Payment do
96
96
  end
97
97
 
98
98
  it "should raise an error if update fails" do
99
- stub_put "http://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
99
+ stub_put "https://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
100
100
 
101
101
  lambda{
102
102
  @payment.amount = ""
@@ -114,25 +114,25 @@ describe CurdBee::Payment do
114
114
  CurdBee::Config.subdomain = "test"
115
115
  CurdBee::Payment.invoice_id = 23
116
116
 
117
- stub_get "http://test.curdbee.com/invoices/23/payments/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "payment.json"
117
+ stub_get "https://test.curdbee.com/invoices/23/payments/25.json?api_token=TYMuwW6rM2PQnoWx1ht4", "payment.json"
118
118
  @payment = CurdBee::Payment.show(25)
119
119
  end
120
120
 
121
121
  it "should return true if payment was deleted" do
122
- stub_delete "http://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
122
+ stub_delete "https://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
123
123
  result = @payment.delete
124
124
  result.should be_true
125
125
  end
126
126
 
127
127
  it "should raise a bad request error if deletion fails" do
128
- stub_delete "http://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
128
+ stub_delete "https://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
129
129
  lambda{
130
130
  @payment.delete
131
131
  }.should raise_error(CurdBee::Error::BadRequest)
132
132
  end
133
133
 
134
134
  it "should raise a not found error if payment doesnt exist" do
135
- stub_delete "http://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
135
+ stub_delete "https://test.curdbee.com/invoices/23/payments/25?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
136
136
  lambda{
137
137
  @payment.delete
138
138
  }.should raise_error(CurdBee::Error::NotFound)
@@ -10,19 +10,19 @@ describe CurdBee::RecurringProfile do
10
10
  end
11
11
 
12
12
  it "should return a list of recurring_profiles" do
13
- stub_get "http://test.curdbee.com/recurring_profiles.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "recurring_profiles.json"
13
+ stub_get "https://test.curdbee.com/recurring_profiles.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=20", "recurring_profiles.json"
14
14
  result = CurdBee::RecurringProfile.list
15
15
  result.first.profile_name.should == "RP-Test"
16
16
  end
17
17
 
18
18
  it "should take limit as an option" do
19
- stub_get "http://test.curdbee.com/recurring_profiles.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "recurring_profiles.json"
19
+ stub_get "https://test.curdbee.com/recurring_profiles.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=1&per_page=1", "recurring_profiles.json"
20
20
  result = CurdBee::RecurringProfile.list(:limit => 1)
21
21
  result.length.should == 1
22
22
  end
23
23
 
24
24
  it "should take page as an option" do
25
- stub_get "http://test.curdbee.com/recurring_profiles.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "recurring_profiles.json"
25
+ stub_get "https://test.curdbee.com/recurring_profiles.json?api_token=TYMuwW6rM2PQnoWx1ht4&page=2&per_page=1", "recurring_profiles.json"
26
26
  result = CurdBee::RecurringProfile.list(:limit => 1, :page => 2)
27
27
  result.length.should == 1
28
28
  end
@@ -36,13 +36,13 @@ describe CurdBee::RecurringProfile do
36
36
  end
37
37
 
38
38
  it "should return the matching recurring_profile" do
39
- stub_get "http://test.curdbee.com/recurring_profiles/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "recurring_profile.json"
39
+ stub_get "https://test.curdbee.com/recurring_profiles/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "recurring_profile.json"
40
40
  result = CurdBee::RecurringProfile.show(31)
41
41
  result.profile_name.should == "RP-Test"
42
42
  end
43
43
 
44
44
  it "should raise an error if nothing found" do
45
- stub_get "http://test.curdbee.com/recurring_profiles/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
45
+ stub_get "https://test.curdbee.com/recurring_profiles/32.json?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
46
46
  lambda{
47
47
  CurdBee::RecurringProfile.show(32)
48
48
  }.should raise_error(CurdBee::Error::NotFound)
@@ -58,7 +58,7 @@ describe CurdBee::RecurringProfile do
58
58
  end
59
59
 
60
60
  it "should return the created recurring_profile" do
61
- stub_post "http://test.curdbee.com/recurring_profiles?api_token=TYMuwW6rM2PQnoWx1ht4", "new_recurring_profile.json"
61
+ stub_post "https://test.curdbee.com/recurring_profiles?api_token=TYMuwW6rM2PQnoWx1ht4", "new_recurring_profile.json"
62
62
  recurring_profile_info = {:start_date => Date.today, :invoice_no => "RP-NEW", :client_id => @client.id,
63
63
  :frequency => "1", :occurences => "0", :profile_name => "test profile",
64
64
  :line_items_attributes => [{:name_and_description => "Sample Item", :quantity => 1, :price => 25.00, :unit => "hour"}]
@@ -69,7 +69,7 @@ describe CurdBee::RecurringProfile do
69
69
  end
70
70
 
71
71
  it "should raise an error if creation fails" do
72
- stub_post "http://test.curdbee.com/recurring_profiles?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
72
+ stub_post "https://test.curdbee.com/recurring_profiles?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
73
73
  lambda{
74
74
  @recurring_profile = CurdBee::RecurringProfile.new({})
75
75
  @recurring_profile.create
@@ -83,12 +83,12 @@ describe CurdBee::RecurringProfile do
83
83
  before do
84
84
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
85
85
  CurdBee::Config.subdomain = "test"
86
- stub_get "http://test.curdbee.com/recurring_profiles/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "recurring_profile.json"
86
+ stub_get "https://test.curdbee.com/recurring_profiles/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "recurring_profile.json"
87
87
  @recurring_profile = CurdBee::RecurringProfile.show(31)
88
88
  end
89
89
 
90
90
  it "should return the updated recurring_profile" do
91
- stub_put "http://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_recurring_profile.json"
91
+ stub_put "https://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "new_recurring_profile.json"
92
92
  @recurring_profile.profile_name = "RP-New"
93
93
  @recurring_profile.date = Date.today
94
94
 
@@ -97,7 +97,7 @@ describe CurdBee::RecurringProfile do
97
97
  end
98
98
 
99
99
  it "should raise an error if update fails" do
100
- stub_put "http://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
100
+ stub_put "https://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
101
101
  lambda{
102
102
  @recurring_profile.profile_name = ""
103
103
  @recurring_profile.update
@@ -111,25 +111,25 @@ describe CurdBee::RecurringProfile do
111
111
  before do
112
112
  CurdBee::Config.api_key = "TYMuwW6rM2PQnoWx1ht4"
113
113
  CurdBee::Config.subdomain = "test"
114
- stub_get "http://test.curdbee.com/recurring_profiles/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "recurring_profile.json"
114
+ stub_get "https://test.curdbee.com/recurring_profiles/31.json?api_token=TYMuwW6rM2PQnoWx1ht4", "recurring_profile.json"
115
115
  @recurring_profile = CurdBee::RecurringProfile.show(31)
116
116
  end
117
117
 
118
118
  it "should return true if recurring_profile was deleted" do
119
- stub_delete "http://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
119
+ stub_delete "https://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 200
120
120
  result = @recurring_profile.delete
121
121
  result.should be_true
122
122
  end
123
123
 
124
124
  it "should raise a bad request error if deletion fails" do
125
- stub_delete "http://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
125
+ stub_delete "https://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 422
126
126
  lambda{
127
127
  @recurring_profile.delete
128
128
  }.should raise_error(CurdBee::Error::BadRequest)
129
129
  end
130
130
 
131
131
  it "should raise a not found error if recurring_profile doesnt exist" do
132
- stub_delete "http://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
132
+ stub_delete "https://test.curdbee.com/recurring_profiles/31?api_token=TYMuwW6rM2PQnoWx1ht4", "", 404
133
133
  lambda{
134
134
  @recurring_profile.delete
135
135
  }.should raise_error(CurdBee::Error::NotFound)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 8
9
- version: 0.0.8
8
+ - 9
9
+ version: 0.0.9
10
10
  platform: ruby
11
11
  authors:
12
12
  - Lakshan Perera
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-15 00:00:00 +05:30
17
+ date: 2011-03-14 00:00:00 +05:30
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency