capsulecrm-b 0.0.6

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.
Files changed (45) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +10 -0
  3. data/README.rdoc +33 -0
  4. data/Rakefile +9 -0
  5. data/capsulecrm.gemspec +23 -0
  6. data/examples.rb +82 -0
  7. data/lib/capsulecrm/address.rb +23 -0
  8. data/lib/capsulecrm/base.rb +176 -0
  9. data/lib/capsulecrm/child.rb +24 -0
  10. data/lib/capsulecrm/child_collection.rb +14 -0
  11. data/lib/capsulecrm/collection.rb +14 -0
  12. data/lib/capsulecrm/contact.rb +27 -0
  13. data/lib/capsulecrm/custom_field.rb +41 -0
  14. data/lib/capsulecrm/email.rb +64 -0
  15. data/lib/capsulecrm/history.rb +32 -0
  16. data/lib/capsulecrm/history_item.rb +20 -0
  17. data/lib/capsulecrm/opportunity.rb +60 -0
  18. data/lib/capsulecrm/organisation.rb +41 -0
  19. data/lib/capsulecrm/party.rb +114 -0
  20. data/lib/capsulecrm/person.rb +126 -0
  21. data/lib/capsulecrm/phone.rb +15 -0
  22. data/lib/capsulecrm/record_not_found.rb +1 -0
  23. data/lib/capsulecrm/recorn_not_recognised.rb +1 -0
  24. data/lib/capsulecrm/tag.rb +12 -0
  25. data/lib/capsulecrm/version.rb +3 -0
  26. data/lib/capsulecrm/website.rb +19 -0
  27. data/lib/capsulecrm.rb +46 -0
  28. data/test/create_person_test.rb +36 -0
  29. data/test/fixtures/responses/create_person.yml +59 -0
  30. data/test/fixtures/responses/party_history.yml +45 -0
  31. data/test/fixtures/responses/party_tags.yml +26 -0
  32. data/test/fixtures/responses/person_find_all.yml +28 -0
  33. data/test/fixtures/responses/person_find_all_with_limit.yml +26 -0
  34. data/test/fixtures/responses/person_find_all_with_offset.yml +28 -0
  35. data/test/fixtures/responses/person_find_by_id.yml +102 -0
  36. data/test/fixtures/responses/update_person.yml +85 -0
  37. data/test/fixtures/responses/update_person_without_changes.yml +28 -0
  38. data/test/party_dot_find_test.rb +40 -0
  39. data/test/party_dot_history_test.rb +29 -0
  40. data/test/party_dot_tags_test.rb +30 -0
  41. data/test/person_dot_find_all_test.rb +48 -0
  42. data/test/person_dot_find_by_id_test.rb +61 -0
  43. data/test/test_helper.rb +52 -0
  44. data/test/update_person_test.rb +46 -0
  45. metadata +158 -0
@@ -0,0 +1,41 @@
1
+ class CapsuleCRM::Organisation < CapsuleCRM::Party
2
+
3
+ attr_accessor :about
4
+ attr_accessor :name
5
+
6
+
7
+ # nodoc
8
+ def people
9
+ return @people if @people
10
+ path = self.class.get_path
11
+ path = [path, '/', id, '/people'].join
12
+ last_response = self.class.get(path)
13
+ @people = CapsuleCRM::Person.init_many(last_response)
14
+ end
15
+
16
+
17
+ # nodoc
18
+ def self.init_many(response)
19
+ data = response['parties']['organisation']
20
+ CapsuleCRM::Collection.new(self, data)
21
+ end
22
+
23
+
24
+ # nodoc
25
+ def self.init_one(response)
26
+ data = response['organisation']
27
+ new(attributes_from_xml_hash(data))
28
+ end
29
+
30
+
31
+ # nodoc
32
+ def self.xml_map
33
+ map = {
34
+ 'about' => 'about',
35
+ 'name' => 'name'
36
+ }
37
+ super.merge map
38
+ end
39
+
40
+
41
+ end
@@ -0,0 +1,114 @@
1
+ class CapsuleCRM::Party < CapsuleCRM::Base
2
+ include CapsuleCRM::History
3
+
4
+ # nodoc
5
+ def addresses
6
+ return @addresses if @addresses
7
+ data = raw_data['contacts'].try(:[], 'address')
8
+ @addresses = CapsuleCRM::Address.init_many(self, data)
9
+ end
10
+
11
+
12
+ # nodoc
13
+ def custom_fields
14
+ return @custom_fields if @custom_fields
15
+ path = self.class.get_path
16
+ path = [path, '/', id, '/customfield'].join
17
+ last_response = self.class.get(path)
18
+ data = last_response['customFields'].try(:[], 'customField')
19
+ @custom_fields = CapsuleCRM::CustomField.init_many(self, data)
20
+ end
21
+
22
+ def tags
23
+ return @tags if @tags
24
+ path = self.class.get_path
25
+ path = [path, '/', id, '/tag'].join
26
+ last_response = self.class.get(path)
27
+ data = last_response['tags'].try(:[], 'tag')
28
+ @tags = CapsuleCRM::Tag.init_many(self, data)
29
+ end
30
+
31
+ def tag_names
32
+ tags.map(&:name)
33
+ end
34
+
35
+ # nodoc
36
+ def emails
37
+ return @emails if @emails
38
+ data = raw_data['contacts'].try(:[], 'email')
39
+ @emails = CapsuleCRM::Email.init_many(self, data)
40
+ end
41
+
42
+
43
+ # nodoc
44
+ def phone_numbers
45
+ return @phone_numbers if @phone_numbers
46
+ data = raw_data['contacts'].try(:[], 'phone')
47
+ @phone_numbers = CapsuleCRM::Phone.init_many(self, data)
48
+ end
49
+
50
+ # nodoc
51
+ def websites
52
+ return @websites if @websites
53
+ data = raw_data['contacts'].try(:[], 'website')
54
+ @websites = CapsuleCRM::Website.init_many(self, data)
55
+ end
56
+
57
+ def is?(kind)
58
+ required_class = kind.to_s.camelize
59
+ self.class.to_s.include? required_class
60
+ end
61
+
62
+ def tag(value)
63
+ # unset tags so that if anyone were to request tags again, it
64
+ # requests an update from the server.
65
+ @tags = nil
66
+ path = self.class.get_path
67
+ tag = URI.escape(value.to_s)
68
+ path = [path, id, 'tag', tag].join('/')
69
+ req = self.class.post(path)
70
+ req.response.code == ("201" || "200")
71
+ end
72
+
73
+
74
+ def untag(value)
75
+ # unset tags so that if anyone were to request tags again, it
76
+ # requests an update from the server.
77
+ @tags = nil
78
+ path = self.class.get_path
79
+ tag = URI.escape(value.to_s)
80
+ path = [path, id, 'tag', tag].join('/')
81
+ req = self.class.delete(path)
82
+ req.response.code == "200"
83
+ end
84
+
85
+ # nodoc
86
+ def self.get_path
87
+ '/api/party'
88
+ end
89
+
90
+
91
+ def self.find_all_by_email(email, options={})
92
+ options[:email] = email
93
+ find_all(options)
94
+ end
95
+
96
+
97
+ # nodoc
98
+ def self.find_by_email(email)
99
+ find_all_by_email(email, :limit => 1, :offset => 0).first
100
+ end
101
+
102
+
103
+ # nodoc
104
+ def self.search(query, options={})
105
+ options[:q] = query
106
+ find_all(options)
107
+ end
108
+
109
+ def self.init_one(response)
110
+ return CapsuleCRM::Person.init_one(response) if response['person']
111
+ return CapsuleCRM::Organisation.init_one(response) if response['organisation']
112
+ raise CapsuleCRM::RecordNotRecognised, "Could not recognise returned entity type: #{response}"
113
+ end
114
+ end
@@ -0,0 +1,126 @@
1
+ class CapsuleCRM::Person < CapsuleCRM::Party
2
+
3
+ attr_accessor :about
4
+ attr_accessor :first_name
5
+ attr_accessor :job_title
6
+ attr_accessor :last_name
7
+ attr_accessor :organisation_id
8
+ attr_accessor :title
9
+ attr_accessor :note
10
+
11
+ define_attribute_methods [:about, :first_name, :last_name, :job_title, :organisation_id, :title]
12
+
13
+
14
+ # nodoc
15
+ def attributes
16
+ attrs = {}
17
+ arr = [:about, :first_name, :last_name, :title, :job_title]
18
+ arr.each do |key|
19
+ attrs[key] = self.send(key)
20
+ end
21
+ attrs
22
+ end
23
+
24
+
25
+ # nodoc
26
+ def first_name=(value)
27
+ first_name_will_change! unless value == first_name
28
+ @first_name = value
29
+ end
30
+
31
+
32
+ # nodoc
33
+ def last_name=(value)
34
+ last_name_will_change! unless value == last_name
35
+ @last_name = value
36
+ end
37
+
38
+
39
+ # nodoc
40
+ def title=(value)
41
+ title_will_change! unless value == title
42
+ @title = value
43
+ end
44
+
45
+
46
+ # nodoc
47
+ def organisation
48
+ return nil if organisation_id.nil?
49
+ @organisation ||= CapsuleCRM::Organisation.find(organisation_id)
50
+ end
51
+
52
+
53
+ # nodoc
54
+ def save
55
+ new_record?? create : update
56
+ end
57
+
58
+
59
+ private
60
+
61
+
62
+ # nodoc
63
+ def create
64
+ path = '/api/person'
65
+ options = {:root => 'person', :path => path}
66
+ new_id = self.class.create dirty_attributes, options
67
+ unless new_id
68
+ errors << self.class.last_response.response.message
69
+ return false
70
+ end
71
+ @errors = []
72
+ changed_attributes.clear
73
+ self.id = new_id
74
+ self
75
+ end
76
+
77
+
78
+ # nodoc
79
+ def dirty_attributes
80
+ Hash[attributes.select { |k,v| changed.include? k.to_s }]
81
+ end
82
+
83
+
84
+ # nodoc
85
+ def update
86
+ path = '/api/person/' + id.to_s
87
+ options = {:root => 'person', :path => path}
88
+ success = self.class.update id, dirty_attributes, options
89
+ changed_attributes.clear if success
90
+ success
91
+ end
92
+
93
+
94
+ # -- Class methods --
95
+
96
+
97
+ # nodoc
98
+ def self.init_many(response)
99
+ data = response['parties']['person']
100
+ CapsuleCRM::Collection.new(self, data)
101
+ end
102
+
103
+
104
+ # nodoc
105
+ def self.init_one(response)
106
+ data = response['person']
107
+ new(attributes_from_xml_hash(data))
108
+ end
109
+
110
+
111
+ # nodoc
112
+ def self.xml_map
113
+ map = {
114
+ 'about' => 'about',
115
+ 'firstName' => 'first_name',
116
+ 'jobTitle' => 'job_title',
117
+ 'lastName' => 'last_name',
118
+ 'organisationId' => 'organisation_id',
119
+ 'title' => 'title',
120
+ 'note' => 'note'
121
+ }
122
+ super.merge map
123
+ end
124
+
125
+
126
+ end
@@ -0,0 +1,15 @@
1
+ class CapsuleCRM::Phone < CapsuleCRM::Contact
2
+
3
+ attr_accessor :number
4
+
5
+
6
+ # nodoc
7
+ def self.xml_map
8
+ map = {
9
+ 'phoneNumber' => 'number'
10
+ }
11
+ super.merge map
12
+ end
13
+
14
+
15
+ end
@@ -0,0 +1 @@
1
+ class CapsuleCRM::RecordNotFound < StandardError; end
@@ -0,0 +1 @@
1
+ class CapsuleCRM::RecordNotRecognised < StandardError; end
@@ -0,0 +1,12 @@
1
+ class CapsuleCRM::Tag < CapsuleCRM::Child
2
+
3
+ attr_accessor :name
4
+
5
+ # nodoc
6
+ def self.xml_map
7
+ map = {
8
+ 'name' => 'name'
9
+ }
10
+ super.merge map
11
+ end
12
+ end
@@ -0,0 +1,3 @@
1
+ module CapsuleCRM
2
+ VERSION = "0.0.6"
3
+ end
@@ -0,0 +1,19 @@
1
+ class CapsuleCRM::Website < CapsuleCRM::Child
2
+
3
+ attr_accessor :web_address
4
+ attr_accessor :url
5
+ attr_accessor :web_service
6
+
7
+
8
+ # nodoc
9
+ def self.xml_map
10
+ map = {
11
+ 'webAddress' => 'web_address',
12
+ 'url' => 'url',
13
+ 'webService' => 'web_service'
14
+ }
15
+ super.merge map
16
+ end
17
+
18
+
19
+ end
data/lib/capsulecrm.rb ADDED
@@ -0,0 +1,46 @@
1
+ require 'active_support/core_ext/module/attribute_accessors'
2
+ require 'active_support/core_ext/hash'
3
+ require 'active_support'
4
+ require 'active_model'
5
+ require 'httparty'
6
+ require 'uri'
7
+ module CapsuleCRM
8
+
9
+ mattr_accessor :account_name
10
+ mattr_accessor :api_token
11
+
12
+ # nodoc
13
+ def self.base_uri(account_name)
14
+ "https://#{account_name}.capsulecrm.com"
15
+ end
16
+
17
+
18
+ # nodoc
19
+ def self.initialize!
20
+ raise ArgumentError, "CapsuleCRM.account_name not defined" if account_name.nil?
21
+ raise ArgumentError, "CapsuleCRM.api_token not defined" if api_token.nil?
22
+ CapsuleCRM::Base.base_uri base_uri(account_name)
23
+ CapsuleCRM::Base.basic_auth api_token, 'x'
24
+ end
25
+
26
+
27
+ end
28
+
29
+ require 'capsulecrm/record_not_found'
30
+ require 'capsulecrm/base'
31
+ require 'capsulecrm/history'
32
+ require 'capsulecrm/party'
33
+ require 'capsulecrm/person'
34
+ require 'capsulecrm/organisation'
35
+ require 'capsulecrm/collection'
36
+ require 'capsulecrm/child_collection'
37
+ require 'capsulecrm/child'
38
+ require 'capsulecrm/custom_field'
39
+ require 'capsulecrm/contact'
40
+ require 'capsulecrm/email'
41
+ require 'capsulecrm/phone'
42
+ require 'capsulecrm/address'
43
+ require 'capsulecrm/tag'
44
+ require 'capsulecrm/history_item'
45
+ require 'capsulecrm/website'
46
+ require 'capsulecrm/opportunity'
@@ -0,0 +1,36 @@
1
+ require 'test_helper'
2
+ class CreatePersonTest < Test::Unit::TestCase
3
+
4
+ # nodoc
5
+ def setup
6
+ end
7
+
8
+
9
+ # nodoc
10
+ def test_success
11
+ VCR.use_cassette('create_person') do
12
+
13
+ # save a new object, check for the id
14
+ person = CapsuleCRM::Person.new
15
+ person.first_name = 'Homer'
16
+ person.last_name = 'Simpson'
17
+ assert person.save
18
+ assert !person.id.nil?
19
+
20
+
21
+ # check it was persisted
22
+ person = CapsuleCRM::Person.find person.id
23
+ assert_equal 'Homer', person.first_name
24
+ assert_equal 'Simpson', person.last_name
25
+
26
+ end
27
+ end
28
+
29
+
30
+ # nodoc
31
+ def teardown
32
+ WebMock.reset!
33
+ end
34
+
35
+
36
+ end
@@ -0,0 +1,59 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :post
5
+ uri: https://[API-TOKEN]:x@[ACCOUNT-NAME].capsulecrm.com:443/api/person
6
+ body: |
7
+ <?xml version="1.0" encoding="UTF-8"?>
8
+ <person>
9
+ <lastName>Simpson</lastName>
10
+ <firstName>Homer</firstName>
11
+ </person>
12
+
13
+ headers:
14
+ content-type:
15
+ - text/xml
16
+ response: !ruby/struct:VCR::Response
17
+ status: !ruby/struct:VCR::ResponseStatus
18
+ code: 201
19
+ message: Created
20
+ headers:
21
+ location:
22
+ - https://[ACCOUNT-NAME].capsulecrm.com/api/party/10256313
23
+ content-type:
24
+ - text/plain; charset=UTF-8
25
+ server:
26
+ - Apache
27
+ date:
28
+ - Tue, 12 Apr 2011 12:28:36 GMT
29
+ content-length:
30
+ - "0"
31
+ set-cookie:
32
+ - "[SESSION-COOKIE]"
33
+ body:
34
+ http_version: "1.1"
35
+ - !ruby/struct:VCR::HTTPInteraction
36
+ request: !ruby/struct:VCR::Request
37
+ method: :get
38
+ uri: https://[API-TOKEN]:x@[ACCOUNT-NAME].capsulecrm.com:443/api/party/10256313
39
+ body:
40
+ headers:
41
+ user-agent:
42
+ - CapsuleCRM ruby gem
43
+ response: !ruby/struct:VCR::Response
44
+ status: !ruby/struct:VCR::ResponseStatus
45
+ code: 200
46
+ message: OK
47
+ headers:
48
+ content-type:
49
+ - "*/*"
50
+ server:
51
+ - Apache
52
+ date:
53
+ - Tue, 12 Apr 2011 12:28:38 GMT
54
+ content-length:
55
+ - "268"
56
+ set-cookie:
57
+ - "[SESSION-COOKIE]"
58
+ body: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><person><id>10256313</id><contacts/><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><firstName>Homer</firstName><lastName>Simpson</lastName></person>
59
+ http_version: "1.1"
@@ -0,0 +1,45 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://[API-TOKEN]:x@[ACCOUNT-NAME].capsulecrm.com:443/api/party/10185257/history
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - CapsuleCRM ruby gem
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ content-type:
16
+ - "*/*"
17
+ server:
18
+ - Apache
19
+ date:
20
+ - Tue, 12 Apr 2011 12:31:20 GMT
21
+ content-length:
22
+ - "426"
23
+ set-cookie:
24
+ - "[SESSION-COOKIE]"
25
+ body: |
26
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
27
+ <history size="2">
28
+ <historyItem>
29
+ <id>1</id>
30
+ <type>Note</type>
31
+ <entryDate>2012-01-30T18:00:00Z</entryDate>
32
+ <creator>Creator Name</creator>
33
+ <subject>First subject</subject>
34
+ <note>This is the first note</note>
35
+ </historyItem>
36
+ <historyItem>
37
+ <id>2</id>
38
+ <type>Note</type>
39
+ <entryDate>2012-01-31T15:00:00Z</entryDate>
40
+ <creator>Creator Name</creator>
41
+ <subject>Second subject</subject>
42
+ <note>This is the second note</note>
43
+ </historyItem>
44
+ </history>
45
+ http_version: "1.1"
@@ -0,0 +1,26 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://[API-TOKEN]:x@[ACCOUNT-NAME].capsulecrm.com:443/api/party/10185257/tag
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - CapsuleCRM ruby gem
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ content-type:
16
+ - "*/*"
17
+ server:
18
+ - Apache
19
+ date:
20
+ - Tue, 12 Apr 2011 12:31:20 GMT
21
+ content-length:
22
+ - "426"
23
+ set-cookie:
24
+ - "[SESSION-COOKIE]"
25
+ body: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><tags size="11"><tag><name>TMT</name></tag><tag><name>Industrials</name></tag><tag><name>Energy</name></tag><tag><name>Consumer</name></tag><tag><name>Healthcare</name></tag><tag><name>Professional Services</name></tag><tag><name>Mid-cap</name></tag><tag><name>Large-cap</name></tag><tag><name>EU</name></tag><tag><name>Asia</name></tag><tag><name>USA</name></tag></tags>
26
+ http_version: "1.1"
@@ -0,0 +1,28 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://[API-TOKEN]:x@[ACCOUNT-NAME].capsulecrm.com:443/api/party?
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - CapsuleCRM ruby gem
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ content-type:
16
+ - "*/*"
17
+ server:
18
+ - Apache
19
+ date:
20
+ - Tue, 12 Apr 2011 12:31:18 GMT
21
+ content-length:
22
+ - "3305"
23
+ set-cookie:
24
+ - "[SESSION-COOKIE]"
25
+ body: |-
26
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><parties size="8"><person><id>9719416</id><contacts><email><id>17716757</id><emailAddress>at@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Prof</title><firstName>Alan</firstName><lastName>Turing</lastName></person><person><id>10185304</id><contacts><email><id>18565226</id><emailAddress>cd@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Dr</title><firstName>Charles</firstName><lastName>Darwin</lastName></person><person><id>10185257</id><contacts><address><id>18565068</id><type>Office</type><street>10 Downing Street</street><city>London</city><zip>SW1A 2AA</zip><country>United Kingdom</country></address><email><id>18565066</id><type>Work</type><emailAddress>pm@example.com</emailAddress></email><phone><id>18566503</id><phoneNumber>12345 67890</phoneNumber></phone><website><id>18565067</id><webAddress>http://www.number10.gov.uk/</webAddress><webService>URL</webService><url>http://www.number10.gov.uk/</url></website></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Mr</title><firstName>David</firstName><lastName>Cameron</lastName><jobTitle>Prime Minister</jobTitle><organisationId>10185256</organisationId><organisationName>UK Government</organisationName></person><organisation><id>10185222</id><contacts/><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/org_avatar_70.png</pictureURL><name>foo.com</name></organisation><person><id>10185308</id><contacts><email><id>18565231</id><emailAddress>mc@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Ms</title><firstName>Marie</firstName><lastName>Curie</lastName></person><person><id>10185261</id><contacts><address><id>18565115</id><type>Office</type><street>Deputy Prime Minister's Office&#xD;
27
+ 70 Whitehall</street><city>London</city><zip>SW1A 2AS</zip><country>United Kingdom</country></address><email><id>18565116</id><type>Work</type><emailAddress>dpm@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Mr</title><firstName>Nick</firstName><lastName>Clegg</lastName><jobTitle>Deputy Prime Minister</jobTitle><organisationId>10185256</organisationId><organisationName>UK Government</organisationName></person><person><id>9851220</id><contacts><email><id>18565224</id><emailAddress>tbl@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Prof</title><firstName>Tim</firstName><lastName>Berners-Lee</lastName></person><organisation><id>10185256</id><contacts><email><id>18583945</id><emailAddress>gov@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/org_avatar_70.png</pictureURL><name>UK Government</name></organisation></parties>
28
+ http_version: "1.1"
@@ -0,0 +1,26 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://[API-TOKEN]:x@[ACCOUNT-NAME].capsulecrm.com:443/api/party?limit=2
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - CapsuleCRM ruby gem
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ content-type:
16
+ - "*/*"
17
+ server:
18
+ - Apache
19
+ date:
20
+ - Tue, 12 Apr 2011 12:31:20 GMT
21
+ content-length:
22
+ - "713"
23
+ set-cookie:
24
+ - "[SESSION-COOKIE]"
25
+ body: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><parties size="2"><person><id>9719416</id><contacts><email><id>17716757</id><emailAddress>at@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Prof</title><firstName>Alan</firstName><lastName>Turing</lastName></person><person><id>10185304</id><contacts><email><id>18565226</id><emailAddress>cd@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Dr</title><firstName>Charles</firstName><lastName>Darwin</lastName></person></parties>
26
+ http_version: "1.1"
@@ -0,0 +1,28 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: https://[API-TOKEN]:x@[ACCOUNT-NAME].capsulecrm.com:443/api/party?start=3
6
+ body:
7
+ headers:
8
+ user-agent:
9
+ - CapsuleCRM ruby gem
10
+ response: !ruby/struct:VCR::Response
11
+ status: !ruby/struct:VCR::ResponseStatus
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ content-type:
16
+ - "*/*"
17
+ server:
18
+ - Apache
19
+ date:
20
+ - Tue, 12 Apr 2011 12:31:21 GMT
21
+ content-length:
22
+ - "1833"
23
+ set-cookie:
24
+ - "[SESSION-COOKIE]"
25
+ body: |-
26
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><parties size="5"><organisation><id>10185222</id><contacts/><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/org_avatar_70.png</pictureURL><name>foo.com</name></organisation><person><id>10185308</id><contacts><email><id>18565231</id><emailAddress>mc@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Ms</title><firstName>Marie</firstName><lastName>Curie</lastName></person><person><id>10185261</id><contacts><address><id>18565115</id><type>Office</type><street>Deputy Prime Minister's Office&#xD;
27
+ 70 Whitehall</street><city>London</city><zip>SW1A 2AS</zip><country>United Kingdom</country></address><email><id>18565116</id><type>Work</type><emailAddress>dpm@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Mr</title><firstName>Nick</firstName><lastName>Clegg</lastName><jobTitle>Deputy Prime Minister</jobTitle><organisationId>10185256</organisationId><organisationName>UK Government</organisationName></person><person><id>9851220</id><contacts><email><id>18565224</id><emailAddress>tbl@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/person_avatar_70.png</pictureURL><title>Prof</title><firstName>Tim</firstName><lastName>Berners-Lee</lastName></person><organisation><id>10185256</id><contacts><email><id>18583945</id><emailAddress>gov@example.com</emailAddress></email></contacts><pictureURL>https://d365sd3k9yw37.cloudfront.net/a/543325/theme/default/images/org_avatar_70.png</pictureURL><name>UK Government</name></organisation></parties>
28
+ http_version: "1.1"