cloudsponge 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -1,15 +1,16 @@
1
- History.txt
1
+ HISTORY
2
2
  Manifest.txt
3
- README.txt
4
3
  Rakefile
5
- lib/cloudsponge.rb
6
- lib/cloudsponge/contact.rb
7
- lib/cloudsponge/contact_importer.rb
8
- lib/cloudsponge/cs_exception.rb
4
+ README
5
+ TODO
6
+ lib/cloudsponge
9
7
  lib/cloudsponge/event.rb
8
+ lib/cloudsponge/cs_exception.rb
10
9
  lib/cloudsponge/utility.rb
11
- test/test_contact.rb
12
- test/test_contact_importer.rb
10
+ lib/cloudsponge/contact.rb
11
+ lib/cloudsponge/contact_importer.rb
12
+ lib/cloudsponge.rb
13
13
  test/test_cs_exception.rb
14
14
  test/test_utility.rb
15
- TODO
15
+ test/test_contact.rb
16
+ test/test_contact_importer.rb
data/lib/cloudsponge.rb CHANGED
@@ -5,5 +5,5 @@ require File.expand_path(File.dirname(__FILE__) + '/cloudsponge/cs_exception')
5
5
  require File.expand_path(File.dirname(__FILE__) + '/cloudsponge/utility')
6
6
 
7
7
  module Cloudsponge
8
- VERSION = '0.9.3'
8
+ VERSION = '0.9.4'
9
9
  end
@@ -26,15 +26,25 @@ module Cloudsponge
26
26
  def name
27
27
  "#{self.first_name} #{self.last_name}"
28
28
  end
29
+
29
30
  def email
30
- self.emails && self.emails.first && self.emails.first[:value]
31
+ get_first_value(self.emails)
31
32
  end
33
+
32
34
  def phone
33
- self.phones && self.phones.first && self.phones.first[:value]
35
+ get_first_value(self.phones)
34
36
  end
37
+
35
38
  def add_array_value(collection, value, type = nil)
36
39
  collection << {:value => value, :type => type}
37
40
  end
41
+
42
+ private
43
+
44
+ def self.get_first_value(from_array)
45
+ from_array && from_array.first && from_array.first[:value]
46
+ end
47
+
38
48
  end
39
49
 
40
50
  end
@@ -9,6 +9,10 @@ module Cloudsponge
9
9
  list.map { |event_data| Event.new(event_data) }.compact
10
10
  end
11
11
 
12
+ def inspect
13
+ "\#<#{self.class} #{event_type} #{status} #{value}>"
14
+ end
15
+
12
16
  def initialize(event_data)
13
17
  # is it an error?
14
18
 
@@ -21,7 +25,7 @@ module Cloudsponge
21
25
  end
22
26
 
23
27
  def is_error?
24
- self.event_type == 'ERROR'
28
+ self.status == 'ERROR'
25
29
  end
26
30
 
27
31
  def is_complete?
@@ -30,4 +34,4 @@ module Cloudsponge
30
34
 
31
35
  end
32
36
 
33
- end
37
+ end
@@ -19,20 +19,16 @@ module Cloudsponge
19
19
  def self.post_and_decode_response(url, params)
20
20
  # post the response
21
21
  response = post_url(url, params)
22
- if response.code_type == Net::HTTPOK
23
- # decode the response into an asscoiative array
24
- resp = decode_response(response.body, 'json')
25
- raise CsException.new(resp['error']['message'], response['code']) if resp['error']
26
- else
27
- raise CsException.new(response.body, response.code)
28
- end
29
- resp
22
+ decode_response(response)
30
23
  end
31
24
 
32
25
  def self.get_and_decode_response(full_url)
33
26
  # get the response
34
27
  response = get_url(full_url)
35
-
28
+ decode_response(response)
29
+ end
30
+
31
+ def self.decode_response(response)
36
32
  if response.code_type == Net::HTTPOK
37
33
  # decode the response into an asscoiative array
38
34
  resp = decode_response(response.body, 'json')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 3
9
- version: 0.9.3
8
+ - 4
9
+ version: 0.9.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Graeme Rouse
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-20 00:00:00 -07:00
17
+ date: 2010-05-03 00:00:00 -07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20