insightly 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,22 +1,24 @@
1
1
  module Insightly
2
2
  module AddressHelper
3
3
  def addresses
4
- return [] if !@data["ADDRESSES"]
5
- @data["ADDRESSES"].collect {|a| Insightly::Address.build(a)}
6
- end
7
- def addresses=(list)
8
- @data["ADDRESSES"] = list.collect {|a| a.remote_data}
9
- end
10
- def add_address(address)
11
- @data["ADDRESSES"] ||= []
12
- @data["ADDRESSES"].each do |a|
13
- if address.same_address?(Insightly::Address.build(a))
4
+ @data["ADDRESSES"] ||= []
5
+ @data["ADDRESSES"].collect { |a| Insightly::Address.build(a) }
6
+ end
14
7
 
15
- return false
16
- end
17
- end
18
- @data["ADDRESSES"] << address.remote_data
19
- true
20
- end
8
+ def addresses=(list)
9
+ @data["ADDRESSES"] = list ? list.collect { |a| a.remote_data } : []
10
+ end
11
+
12
+ def add_address(address)
13
+ @data["ADDRESSES"] ||= []
14
+ @data["ADDRESSES"].each do |a|
15
+ if address.same_address?(Insightly::Address.build(a))
16
+
17
+ return false
18
+ end
19
+ end
20
+ @data["ADDRESSES"] << address.remote_data
21
+ true
22
+ end
21
23
  end
22
24
  end
@@ -1,16 +1,18 @@
1
1
  module Insightly
2
2
  module ContactInfoHelper
3
3
  def contact_infos
4
- return [] if !@data["CONTACTINFOS"]
5
- @data["CONTACTINFOS"].collect {|a| Insightly::ContactInfo.build(a)}
6
- end
7
- def contact_infos=(list)
8
- @data["CONTACTINFOS"] = list.collect {|a| a.remote_data}
9
- end
10
- def add_contact_info(contact_info)
11
- @data["CONTACTINFOS"] ||= []
12
- @data["CONTACTINFOS"] << contact_info.remote_data
13
- true
14
- end
4
+ @data["CONTACTINFOS"] ||= []
5
+ @data["CONTACTINFOS"].collect { |a| Insightly::ContactInfo.build(a) }
6
+ end
7
+
8
+ def contact_infos=(list)
9
+ @data["CONTACTINFOS"] = list ? list.collect { |a| a.remote_data } : []
10
+ end
11
+
12
+ def add_contact_info(contact_info)
13
+ @data["CONTACTINFOS"] ||= []
14
+ @data["CONTACTINFOS"] << contact_info.remote_data
15
+ true
16
+ end
15
17
  end
16
18
  end
@@ -1,11 +1,11 @@
1
1
  module Insightly
2
2
  module LinkHelper
3
3
  def links
4
- return [] if !@data["LINKS"]
4
+ @data["LINKS"] ||= []
5
5
  @data["LINKS"].collect {|a| Insightly::Link.build(a)}
6
6
  end
7
7
  def links=(list)
8
- @data["LINKS"] = list.collect {|a| fix_for_link(a).remote_data}
8
+ @data["LINKS"] = list ? list.collect {|a| fix_for_link(a).remote_data} : []
9
9
  end
10
10
  def add_link(link)
11
11
  @data["LINKS"] ||= []
@@ -1,11 +1,11 @@
1
1
  module Insightly
2
2
  module TagHelper
3
3
  def tags
4
- return [] if !@data["TAGS"]
4
+ @data["TAGS"] ||= []
5
5
  @data["TAGS"].collect {|a| Insightly::Tag.build(a)}
6
6
  end
7
7
  def tags=(list)
8
- @data["TAGS"] = list.collect {|a| a.remote_data}
8
+ @data["TAGS"] = list ? list.collect {|a| a.remote_data} : []
9
9
  end
10
10
  def add_tag(tag)
11
11
  @data["TAGS"] ||= []
@@ -1,11 +1,11 @@
1
1
  module Insightly
2
2
  module TaskLinkHelper
3
3
  def task_links
4
- return [] if !@data["TASKLINKS"]
4
+ @data["TASKLINKS"] ||= []
5
5
  @data["TASKLINKS"].collect {|a| Insightly::TaskLink.build(a)}
6
6
  end
7
7
  def task_links=(list)
8
- @data["TASKLINKS"] = list.collect {|a| fix_for_link(a).remote_data}
8
+ @data["TASKLINKS"] = list ? list.collect {|a| fix_for_link(a).remote_data} : []
9
9
  end
10
10
  def add_task_link(link)
11
11
  @data["TASKLINKS"] ||= []
@@ -4,7 +4,7 @@ module Insightly
4
4
  module Version
5
5
  Major = 0
6
6
  Minor = 2
7
- Tiny = 7
7
+ Tiny = 8
8
8
  String = "#{Major}.#{Minor}.#{Tiny}"
9
9
  end
10
10
  end
@@ -44,7 +44,7 @@ describe Insightly::Organisation do
44
44
  #
45
45
  # @organisation.visible_to = "EVERYONE"
46
46
  # @organisation.organisation_name = "000 Dummy Test Org"
47
- # @organisation.background = "This organisation was created for test purposes and can be deleted."
47
+ # @organisation.background = "This organisation was crtaskeated for test purposes and can be deleted."
48
48
  #
49
49
  # @organisation.save
50
50
  #
@@ -75,6 +75,10 @@ describe Insightly::Organisation do
75
75
  @address.postcode = "46112"
76
76
  @address.country = "US"
77
77
  end
78
+ it "should let you set it to nil" do
79
+ @org.addresses = nil
80
+ @org.addresses.should == []
81
+ end
78
82
  it "should allow you to update an address" do
79
83
  @org.addresses.should == []
80
84
  @org.add_address(@address)
@@ -142,6 +146,10 @@ describe Insightly::Organisation do
142
146
  @contact_info.detail = "bob@aol.com"
143
147
 
144
148
  end
149
+ it "should let you set it to nil" do
150
+ @org.contact_infos = nil
151
+ @org.contact_infos.should == []
152
+ end
145
153
  it "should allow you to update an contact_info" do
146
154
  @org.contact_infos.should == []
147
155
  @org.add_contact_info(@contact_info)
@@ -195,6 +203,10 @@ describe Insightly::Organisation do
195
203
  @link = Insightly::Link.add_contact(2982194, "Janitor", "Recent Hire")
196
204
  # @link = Insightly::Link.add_opportunity(968613,"Janitor", "Recent Hire")
197
205
  end
206
+ it "should let you set it to nil" do
207
+ @org.links = nil
208
+ @org.links.should == []
209
+ end
198
210
  it "should allow you to update an link" do
199
211
  @org.links.should == []
200
212
  @org.add_link(@link)
@@ -249,6 +261,10 @@ describe Insightly::Organisation do
249
261
  @tag2 = Insightly::Tag.build("Freebie")
250
262
 
251
263
  end
264
+ it "should let you set it to nil" do
265
+ @org.tags = nil
266
+ @org.tags.should == []
267
+ end
252
268
  it "should allow you to update an tag" do
253
269
  @org.tags.should == []
254
270
  @org.add_tag(@tag)
@@ -173,14 +173,20 @@ describe Insightly::Task do
173
173
 
174
174
  context "TaskLinks" do
175
175
  before(:each) do
176
- @task = Insightly::Task.new(3263739)
176
+ # @task = Insightly::Task.new(3263739)
177
+ @task = Insightly::Task.new
177
178
  @task.task_links = []
178
- @task.save
179
+ # @task.save
179
180
 
180
181
 
181
182
  @link = Insightly::TaskLink.add_organisation(8936117)
182
183
  @link2 = Insightly::TaskLink.add_opportunity(968613)
183
184
  end
185
+ it "should allow you to try to set it to nil" do
186
+ @task = Insightly::Task.new
187
+ @task.task_links = nil
188
+ @task.task_links.should == []
189
+ end
184
190
  it "should allow you to update an link" do
185
191
  @task.task_links.should == []
186
192
  @task.add_task_link(@link)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insightly
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 7
10
- version: 0.2.7
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dirk Elmendorf