pipeline_deals 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +47 -8
- data/lib/pipeline_deals.rb +5 -4
- data/lib/pipeline_deals/admin_resource.rb +6 -0
- data/lib/{collection.rb → pipeline_deals/collection.rb} +0 -0
- data/lib/{resource.rb → pipeline_deals/resource.rb} +3 -1
- data/lib/{resources → pipeline_deals/resources}/company.rb +0 -0
- data/lib/pipeline_deals/resources/company_custom_field_label.rb +4 -0
- data/lib/pipeline_deals/resources/custom_field_label_dropdown_entry.rb +4 -0
- data/lib/pipeline_deals/resources/deal.rb +10 -0
- data/lib/pipeline_deals/resources/deal_custom_field_label.rb +4 -0
- data/lib/pipeline_deals/resources/deal_stage.rb +4 -0
- data/lib/pipeline_deals/resources/definitions.rb +21 -0
- data/lib/pipeline_deals/resources/event_category.rb +5 -0
- data/lib/pipeline_deals/resources/lead_source.rb +5 -0
- data/lib/pipeline_deals/resources/lead_status.rb +4 -0
- data/lib/pipeline_deals/resources/note_category.rb +5 -0
- data/lib/{resources → pipeline_deals/resources}/person.rb +0 -0
- data/lib/pipeline_deals/resources/person_custom_field_label.rb +4 -0
- data/lib/pipeline_deals/resources/predefined_contacts_tags.rb +5 -0
- data/lib/{resources → pipeline_deals/resources}/user.rb +1 -0
- data/lib/{version.rb → pipeline_deals/version.rb} +1 -1
- data/pipeline_deals.gemspec +1 -1
- data/spec/cassettes/deal_user.yml +46 -0
- data/spec/cassettes/get_a_deal.yml +51 -0
- data/spec/cassettes/list_deal_stages.yml +47 -0
- data/spec/cassettes/list_deals.yml +10 -528
- data/spec/cassettes/paginate_deals.yml +12 -33
- data/spec/cassettes/update_deal.yml +104 -0
- data/spec/cassettes/update_lead_source.yml +197 -0
- data/spec/pipeline_deals/admin_spec.rb +14 -0
- data/spec/pipeline_deals/deals_spec.rb +53 -0
- data/spec/spec_helper.rb +4 -0
- metadata +38 -13
- data/lib/resources/deal.rb +0 -56
- data/lib/resources/definitions.rb +0 -10
- data/spec/pipelinedeals_spec.rb +0 -53
@@ -2,7 +2,7 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: http://
|
5
|
+
uri: http://localhost:3000/api/v3/deals.json?api_key=xxxkeyxxx&page=2&per_page=5
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
@@ -15,47 +15,26 @@ http_interactions:
|
|
15
15
|
- Ruby
|
16
16
|
response:
|
17
17
|
status:
|
18
|
-
code:
|
19
|
-
message:
|
18
|
+
code: 406
|
19
|
+
message: Not Acceptable
|
20
20
|
headers:
|
21
21
|
Date:
|
22
|
-
-
|
22
|
+
- Fri, 14 Jun 2013 23:55:59 GMT
|
23
23
|
Status:
|
24
|
-
-
|
24
|
+
- 406 Not Acceptable
|
25
25
|
Connection:
|
26
26
|
- close
|
27
|
-
|
28
|
-
-
|
29
|
-
- is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
|
30
|
-
00:00:00 GMT
|
31
|
-
Content-Length:
|
32
|
-
- '3573'
|
27
|
+
Cache-Control:
|
28
|
+
- no-cache
|
33
29
|
Content-Type:
|
34
30
|
- application/json; charset=utf-8
|
35
|
-
|
36
|
-
-
|
37
|
-
Etag:
|
38
|
-
- ! '"07586330fcab734b3878c6cf6de5c7af"'
|
31
|
+
Content-Length:
|
32
|
+
- '27'
|
39
33
|
X-Runtime:
|
40
|
-
- '
|
34
|
+
- '12'
|
41
35
|
body:
|
42
36
|
encoding: US-ASCII
|
43
|
-
string: ! '{"
|
44
|
-
strategic ROI","primary_contact":null,"user_id":1,"company_id":null,"source_id":null,"is_example":null,"created_at":"2013/04/16
|
45
|
-
10:09:43 -0400","company":null,"person_ids":[],"collaborators":[],"people":[],"status":1,"custom_fields":{"custom_label_29":null,"custom_label_27":null,"custom_label_26":null,"custom_label_25":null},"probability":39,"is_archived":false,"closed_time":null,"deal_stage":null,"id":6,"user":{"id":1,"last_name":"hoboson","first_name":"hobo"},"value_in_cents":365857,"import_id":null,"updated_at":"2013/04/16
|
46
|
-
10:09:44 -0400","expected_close_date_event_id":null},{"summary":null,"primary_contact_id":null,"expected_close_date":null,"deal_stage_id":null,"name":"architect
|
47
|
-
B2C ROI","primary_contact":null,"user_id":1,"company_id":null,"source_id":null,"is_example":null,"created_at":"2013/04/16
|
48
|
-
10:09:44 -0400","company":null,"person_ids":[],"collaborators":[],"people":[],"status":-1,"custom_fields":{"custom_label_29":null,"custom_label_27":null,"custom_label_26":null,"custom_label_25":null},"probability":2,"is_archived":false,"closed_time":null,"deal_stage":null,"id":7,"user":{"id":1,"last_name":"hoboson","first_name":"hobo"},"value_in_cents":7919635,"import_id":null,"updated_at":"2013/04/16
|
49
|
-
10:09:44 -0400","expected_close_date_event_id":null},{"summary":null,"primary_contact_id":null,"expected_close_date":null,"deal_stage_id":null,"name":"cultivate
|
50
|
-
back-end models","primary_contact":null,"user_id":1,"company_id":null,"source_id":null,"is_example":null,"created_at":"2013/04/16
|
51
|
-
10:09:44 -0400","company":null,"person_ids":[],"collaborators":[],"people":[],"status":0,"custom_fields":{"custom_label_29":null,"custom_label_27":null,"custom_label_26":null,"custom_label_25":null},"probability":53,"is_archived":false,"closed_time":null,"deal_stage":null,"id":8,"user":{"id":1,"last_name":"hoboson","first_name":"hobo"},"value_in_cents":4737478,"import_id":null,"updated_at":"2013/04/16
|
52
|
-
10:09:44 -0400","expected_close_date_event_id":null},{"summary":null,"primary_contact_id":null,"expected_close_date":null,"deal_stage_id":null,"name":"deliver
|
53
|
-
ubiquitous infrastructures","primary_contact":null,"user_id":1,"company_id":null,"source_id":null,"is_example":null,"created_at":"2013/04/16
|
54
|
-
10:09:44 -0400","company":null,"person_ids":[],"collaborators":[],"people":[],"status":-1,"custom_fields":{"custom_label_29":null,"custom_label_27":null,"custom_label_26":null,"custom_label_25":null},"probability":4,"is_archived":false,"closed_time":null,"deal_stage":null,"id":9,"user":{"id":1,"last_name":"hoboson","first_name":"hobo"},"value_in_cents":8211008,"import_id":null,"updated_at":"2013/04/16
|
55
|
-
10:09:44 -0400","expected_close_date_event_id":null},{"summary":null,"primary_contact_id":null,"expected_close_date":null,"deal_stage_id":null,"name":"brand
|
56
|
-
leading-edge e-tailers","primary_contact":null,"user_id":1,"company_id":null,"source_id":null,"is_example":null,"created_at":"2013/04/16
|
57
|
-
10:09:45 -0400","company":null,"person_ids":[],"collaborators":[],"people":[],"status":-1,"custom_fields":{"custom_label_29":null,"custom_label_27":null,"custom_label_26":null,"custom_label_25":null},"probability":40,"is_archived":false,"closed_time":null,"deal_stage":null,"id":10,"user":{"id":1,"last_name":"hoboson","first_name":"hobo"},"value_in_cents":6172077,"import_id":null,"updated_at":"2013/04/16
|
58
|
-
10:09:45 -0400","expected_close_date_event_id":null}]}'
|
37
|
+
string: ! '{"error":"Unknown api key"}'
|
59
38
|
http_version:
|
60
|
-
recorded_at:
|
39
|
+
recorded_at: Fri, 14 Jun 2013 23:55:59 GMT
|
61
40
|
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,104 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: put
|
5
|
+
uri: http://localhost:3000/api/v3/deals/1.json?api_key=iJHyFkMUBSfjUovt29
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ! '{"deal":{"value_in_cents":45600,"is_example":null,"company_id":null,"shared_user_ids":[],"user_id":1,"import_id":null,"deal_stage_id":2,"deal_stage":{"percent":10,"id":2,"name":"Qualified
|
9
|
+
Lead"},"collaborators":[],"company":null,"summary":null,"possible_notify_user_ids":[],"updated_at":"2013/06/14
|
10
|
+
19:54:48 -0400","source_id":2,"source":{"id":2,"name":"Cold Call"},"probability":0,"primary_contact_id":null,"created_at":"2013/05/31
|
11
|
+
13:10:26 -0400","expected_close_date_event_id":null,"id":1,"expected_close_date":null,"primary_contact":null,"user":{"last_name":"hoboson","first_name":"hobo","id":1},"closed_time":"2013/06/03
|
12
|
+
15:25:21 -0400","custom_fields":{"custom_label_29":10,"custom_label_28":0,"custom_label_27":8,"custom_label_26":5,"custom_label_25":1},"person_ids":[],"status":2,"name":"architect
|
13
|
+
open-source bandwidth","people":[],"is_archived":false}}'
|
14
|
+
headers:
|
15
|
+
Content-Type:
|
16
|
+
- application/json
|
17
|
+
Accept:
|
18
|
+
- ! '*/*'
|
19
|
+
User-Agent:
|
20
|
+
- Ruby
|
21
|
+
response:
|
22
|
+
status:
|
23
|
+
code: 200
|
24
|
+
message: OK
|
25
|
+
headers:
|
26
|
+
Date:
|
27
|
+
- Fri, 14 Jun 2013 23:55:58 GMT
|
28
|
+
Status:
|
29
|
+
- 200 OK
|
30
|
+
Connection:
|
31
|
+
- close
|
32
|
+
Cache-Control:
|
33
|
+
- private, max-age=0, must-revalidate
|
34
|
+
Set-Cookie:
|
35
|
+
- _session_id=992ce8bc41d6d031fe3f9d44f5da0495; path=/; HttpOnly
|
36
|
+
- is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
|
37
|
+
00:00:00 GMT
|
38
|
+
Content-Type:
|
39
|
+
- application/json; charset=utf-8
|
40
|
+
Etag:
|
41
|
+
- ! '"8132923694d46ee3cfec015954966a69"'
|
42
|
+
Content-Length:
|
43
|
+
- '853'
|
44
|
+
X-Runtime:
|
45
|
+
- '93'
|
46
|
+
body:
|
47
|
+
encoding: US-ASCII
|
48
|
+
string: ! '{"value_in_cents":45600,"is_example":null,"company_id":null,"shared_user_ids":[],"user_id":1,"import_id":null,"deal_stage_id":2,"deal_stage":{"percent":10,"id":2,"name":"Qualified
|
49
|
+
Lead"},"collaborators":[],"company":null,"summary":null,"possible_notify_user_ids":[],"updated_at":"2013/06/14
|
50
|
+
19:54:48 -0400","source_id":2,"source":{"id":2,"name":"Cold Call"},"probability":0,"primary_contact_id":null,"created_at":"2013/05/31
|
51
|
+
13:10:26 -0400","expected_close_date_event_id":null,"id":1,"expected_close_date":null,"primary_contact":null,"user":{"last_name":"hoboson","first_name":"hobo","id":1},"closed_time":"2013/06/03
|
52
|
+
15:25:21 -0400","custom_fields":{"custom_label_29":10,"custom_label_28":0,"custom_label_27":8,"custom_label_26":5,"custom_label_25":1},"person_ids":[],"status":2,"name":"architect
|
53
|
+
open-source bandwidth","people":[],"is_archived":false}'
|
54
|
+
http_version:
|
55
|
+
recorded_at: Fri, 14 Jun 2013 23:55:58 GMT
|
56
|
+
- request:
|
57
|
+
method: get
|
58
|
+
uri: http://localhost:3000/api/v3/deals/1.json?api_key=iJHyFkMUBSfjUovt29
|
59
|
+
body:
|
60
|
+
encoding: US-ASCII
|
61
|
+
string: ''
|
62
|
+
headers:
|
63
|
+
Accept:
|
64
|
+
- application/json
|
65
|
+
Accept-Encoding:
|
66
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
67
|
+
User-Agent:
|
68
|
+
- Ruby
|
69
|
+
response:
|
70
|
+
status:
|
71
|
+
code: 200
|
72
|
+
message: OK
|
73
|
+
headers:
|
74
|
+
Date:
|
75
|
+
- Fri, 14 Jun 2013 23:55:58 GMT
|
76
|
+
Status:
|
77
|
+
- 200 OK
|
78
|
+
Connection:
|
79
|
+
- close
|
80
|
+
Cache-Control:
|
81
|
+
- private, max-age=0, must-revalidate
|
82
|
+
Set-Cookie:
|
83
|
+
- _session_id=d7b7223c22193c1d556c567509c26c24; path=/; HttpOnly
|
84
|
+
- is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
|
85
|
+
00:00:00 GMT
|
86
|
+
Content-Type:
|
87
|
+
- application/json; charset=utf-8
|
88
|
+
Etag:
|
89
|
+
- ! '"6de39b87bebe7538b7b38d5c1085ec74"'
|
90
|
+
Content-Length:
|
91
|
+
- '853'
|
92
|
+
X-Runtime:
|
93
|
+
- '44'
|
94
|
+
body:
|
95
|
+
encoding: US-ASCII
|
96
|
+
string: ! '{"value_in_cents":45600,"is_example":null,"company_id":null,"shared_user_ids":[],"user_id":1,"import_id":null,"deal_stage_id":2,"deal_stage":{"percent":10,"id":2,"name":"Qualified
|
97
|
+
Lead"},"collaborators":[],"company":null,"summary":null,"possible_notify_user_ids":[],"updated_at":"2013/06/14
|
98
|
+
19:55:58 -0400","source_id":2,"source":{"id":2,"name":"Cold Call"},"probability":0,"primary_contact_id":null,"created_at":"2013/05/31
|
99
|
+
13:10:26 -0400","expected_close_date_event_id":null,"id":1,"expected_close_date":null,"primary_contact":null,"user":{"last_name":"hoboson","first_name":"hobo","id":1},"closed_time":"2013/06/03
|
100
|
+
15:25:21 -0400","custom_fields":{"custom_label_29":10,"custom_label_28":0,"custom_label_27":8,"custom_label_26":5,"custom_label_25":1},"person_ids":[],"status":2,"name":"architect
|
101
|
+
open-source bandwidth","people":[],"is_archived":false}'
|
102
|
+
http_version:
|
103
|
+
recorded_at: Fri, 14 Jun 2013 23:55:58 GMT
|
104
|
+
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,197 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://localhost:3000/api/v3/admin/lead_sources.json?api_key=iJHyFkMUBSfjUovt29
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Date:
|
22
|
+
- Sat, 15 Jun 2013 00:05:18 GMT
|
23
|
+
Status:
|
24
|
+
- 200 OK
|
25
|
+
Connection:
|
26
|
+
- close
|
27
|
+
Cache-Control:
|
28
|
+
- private, max-age=0, must-revalidate
|
29
|
+
Set-Cookie:
|
30
|
+
- _session_id=ddca432e0e9b34a033d4969805a6395d; path=/; HttpOnly
|
31
|
+
- is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
|
32
|
+
00:00:00 GMT
|
33
|
+
Content-Type:
|
34
|
+
- application/json; charset=utf-8
|
35
|
+
Etag:
|
36
|
+
- ! '"76457704dbc4a975c52ebe4280e4e44a"'
|
37
|
+
Content-Length:
|
38
|
+
- '578'
|
39
|
+
X-Runtime:
|
40
|
+
- '19'
|
41
|
+
body:
|
42
|
+
encoding: US-ASCII
|
43
|
+
string: ! '{"pagination":{"per_page":200,"total":6,"pages":1,"page_var":"page","page":1},"entries":[{"flat_fee_in_cents":null,"cost_per_lead_in_cents":null,"id":2,"name":"Cold
|
44
|
+
Call"},{"flat_fee_in_cents":null,"cost_per_lead_in_cents":null,"id":6,"name":"Import"},{"flat_fee_in_cents":null,"cost_per_lead_in_cents":null,"id":1,"name":"None"},{"flat_fee_in_cents":null,"cost_per_lead_in_cents":null,"id":3,"name":"Referral"},{"flat_fee_in_cents":null,"cost_per_lead_in_cents":null,"id":4,"name":"Trade
|
45
|
+
Show"},{"flat_fee_in_cents":null,"cost_per_lead_in_cents":null,"id":5,"name":"Website"}]}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Sat, 15 Jun 2013 00:05:18 GMT
|
48
|
+
- request:
|
49
|
+
method: put
|
50
|
+
uri: http://localhost:3000/api/v3/deals/1.json?api_key=iJHyFkMUBSfjUovt29
|
51
|
+
body:
|
52
|
+
encoding: US-ASCII
|
53
|
+
string: ! '{"deal":{"value_in_cents":45600,"is_example":null,"company_id":null,"shared_user_ids":[],"user_id":1,"import_id":null,"deal_stage_id":2,"deal_stage":{"percent":10,"id":2,"name":"Qualified
|
54
|
+
Lead"},"collaborators":[],"company":null,"summary":null,"possible_notify_user_ids":[],"updated_at":"2013/06/14
|
55
|
+
19:54:48 -0400","source_id":5,"source":{"id":2,"name":"Cold Call"},"probability":0,"primary_contact_id":null,"created_at":"2013/05/31
|
56
|
+
13:10:26 -0400","expected_close_date_event_id":null,"id":1,"expected_close_date":null,"primary_contact":null,"user":{"last_name":"hoboson","first_name":"hobo","id":1},"closed_time":"2013/06/03
|
57
|
+
15:25:21 -0400","custom_fields":{"custom_label_29":10,"custom_label_28":0,"custom_label_27":8,"custom_label_26":5,"custom_label_25":2},"person_ids":[],"status":2,"name":"architect
|
58
|
+
open-source bandwidth","people":[],"is_archived":false}}'
|
59
|
+
headers:
|
60
|
+
Content-Type:
|
61
|
+
- application/json
|
62
|
+
Accept:
|
63
|
+
- ! '*/*'
|
64
|
+
User-Agent:
|
65
|
+
- Ruby
|
66
|
+
response:
|
67
|
+
status:
|
68
|
+
code: 200
|
69
|
+
message: OK
|
70
|
+
headers:
|
71
|
+
Date:
|
72
|
+
- Sat, 15 Jun 2013 00:05:18 GMT
|
73
|
+
Status:
|
74
|
+
- 200 OK
|
75
|
+
Connection:
|
76
|
+
- close
|
77
|
+
Cache-Control:
|
78
|
+
- private, max-age=0, must-revalidate
|
79
|
+
Set-Cookie:
|
80
|
+
- _session_id=6fcacf0be69d9c9ed531cffd115e5415; path=/; HttpOnly
|
81
|
+
- is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
|
82
|
+
00:00:00 GMT
|
83
|
+
Content-Type:
|
84
|
+
- application/json; charset=utf-8
|
85
|
+
Etag:
|
86
|
+
- ! '"f4a47dc831559ddda21a4ad0bc398a50"'
|
87
|
+
Content-Length:
|
88
|
+
- '853'
|
89
|
+
X-Runtime:
|
90
|
+
- '335'
|
91
|
+
body:
|
92
|
+
encoding: US-ASCII
|
93
|
+
string: ! '{"value_in_cents":45600,"is_example":null,"company_id":null,"shared_user_ids":[],"user_id":1,"import_id":null,"deal_stage_id":2,"deal_stage":{"percent":10,"id":2,"name":"Qualified
|
94
|
+
Lead"},"collaborators":[],"company":null,"summary":null,"possible_notify_user_ids":[],"updated_at":"2013/06/14
|
95
|
+
20:05:18 -0400","source_id":5,"source":{"id":2,"name":"Cold Call"},"probability":0,"primary_contact_id":null,"created_at":"2013/05/31
|
96
|
+
13:10:26 -0400","expected_close_date_event_id":null,"id":1,"expected_close_date":null,"primary_contact":null,"user":{"last_name":"hoboson","first_name":"hobo","id":1},"closed_time":"2013/06/03
|
97
|
+
15:25:21 -0400","custom_fields":{"custom_label_29":10,"custom_label_28":0,"custom_label_27":8,"custom_label_26":5,"custom_label_25":2},"person_ids":[],"status":2,"name":"architect
|
98
|
+
open-source bandwidth","people":[],"is_archived":false}'
|
99
|
+
http_version:
|
100
|
+
recorded_at: Sat, 15 Jun 2013 00:05:18 GMT
|
101
|
+
- request:
|
102
|
+
method: get
|
103
|
+
uri: http://localhost:3000/api/v3/deals/1.json?api_key=iJHyFkMUBSfjUovt29
|
104
|
+
body:
|
105
|
+
encoding: US-ASCII
|
106
|
+
string: ''
|
107
|
+
headers:
|
108
|
+
Accept:
|
109
|
+
- application/json
|
110
|
+
Accept-Encoding:
|
111
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
112
|
+
User-Agent:
|
113
|
+
- Ruby
|
114
|
+
response:
|
115
|
+
status:
|
116
|
+
code: 200
|
117
|
+
message: OK
|
118
|
+
headers:
|
119
|
+
Date:
|
120
|
+
- Sat, 15 Jun 2013 00:05:19 GMT
|
121
|
+
Status:
|
122
|
+
- 200 OK
|
123
|
+
Connection:
|
124
|
+
- close
|
125
|
+
Cache-Control:
|
126
|
+
- private, max-age=0, must-revalidate
|
127
|
+
Set-Cookie:
|
128
|
+
- _session_id=f8cc0d2efb1a79c888683ac4c975bfa1; path=/; HttpOnly
|
129
|
+
- is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
|
130
|
+
00:00:00 GMT
|
131
|
+
Content-Type:
|
132
|
+
- application/json; charset=utf-8
|
133
|
+
Etag:
|
134
|
+
- ! '"cef0c6a12770ab0ca607e93f3c26b4e9"'
|
135
|
+
Content-Length:
|
136
|
+
- '851'
|
137
|
+
X-Runtime:
|
138
|
+
- '40'
|
139
|
+
body:
|
140
|
+
encoding: US-ASCII
|
141
|
+
string: ! '{"value_in_cents":45600,"is_example":null,"company_id":null,"shared_user_ids":[],"user_id":1,"import_id":null,"deal_stage_id":2,"deal_stage":{"percent":10,"id":2,"name":"Qualified
|
142
|
+
Lead"},"collaborators":[],"company":null,"summary":null,"possible_notify_user_ids":[],"updated_at":"2013/06/14
|
143
|
+
20:05:18 -0400","source_id":5,"source":{"id":5,"name":"Website"},"probability":0,"primary_contact_id":null,"created_at":"2013/05/31
|
144
|
+
13:10:26 -0400","expected_close_date_event_id":null,"id":1,"expected_close_date":null,"primary_contact":null,"user":{"last_name":"hoboson","first_name":"hobo","id":1},"closed_time":"2013/06/03
|
145
|
+
15:25:21 -0400","custom_fields":{"custom_label_29":10,"custom_label_28":0,"custom_label_27":8,"custom_label_26":5,"custom_label_25":2},"person_ids":[],"status":2,"name":"architect
|
146
|
+
open-source bandwidth","people":[],"is_archived":false}'
|
147
|
+
http_version:
|
148
|
+
recorded_at: Sat, 15 Jun 2013 00:05:19 GMT
|
149
|
+
- request:
|
150
|
+
method: get
|
151
|
+
uri: http://localhost:3000/api/v3/deals/1.json?api_key=iJHyFkMUBSfjUovt29
|
152
|
+
body:
|
153
|
+
encoding: US-ASCII
|
154
|
+
string: ''
|
155
|
+
headers:
|
156
|
+
Accept:
|
157
|
+
- application/json
|
158
|
+
Accept-Encoding:
|
159
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
160
|
+
User-Agent:
|
161
|
+
- Ruby
|
162
|
+
response:
|
163
|
+
status:
|
164
|
+
code: 200
|
165
|
+
message: OK
|
166
|
+
headers:
|
167
|
+
Date:
|
168
|
+
- Sat, 15 Jun 2013 00:05:19 GMT
|
169
|
+
Status:
|
170
|
+
- 200 OK
|
171
|
+
Connection:
|
172
|
+
- close
|
173
|
+
Cache-Control:
|
174
|
+
- private, max-age=0, must-revalidate
|
175
|
+
Set-Cookie:
|
176
|
+
- _session_id=28697eab4a1ebf89d932f9d7ebae8546; path=/; HttpOnly
|
177
|
+
- is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
|
178
|
+
00:00:00 GMT
|
179
|
+
Content-Type:
|
180
|
+
- application/json; charset=utf-8
|
181
|
+
Etag:
|
182
|
+
- ! '"cef0c6a12770ab0ca607e93f3c26b4e9"'
|
183
|
+
Content-Length:
|
184
|
+
- '851'
|
185
|
+
X-Runtime:
|
186
|
+
- '235'
|
187
|
+
body:
|
188
|
+
encoding: US-ASCII
|
189
|
+
string: ! '{"value_in_cents":45600,"is_example":null,"company_id":null,"shared_user_ids":[],"user_id":1,"import_id":null,"deal_stage_id":2,"deal_stage":{"percent":10,"id":2,"name":"Qualified
|
190
|
+
Lead"},"collaborators":[],"company":null,"summary":null,"possible_notify_user_ids":[],"updated_at":"2013/06/14
|
191
|
+
20:05:18 -0400","source_id":5,"source":{"id":5,"name":"Website"},"probability":0,"primary_contact_id":null,"created_at":"2013/05/31
|
192
|
+
13:10:26 -0400","expected_close_date_event_id":null,"id":1,"expected_close_date":null,"primary_contact":null,"user":{"last_name":"hoboson","first_name":"hobo","id":1},"closed_time":"2013/06/03
|
193
|
+
15:25:21 -0400","custom_fields":{"custom_label_29":10,"custom_label_28":0,"custom_label_27":8,"custom_label_26":5,"custom_label_25":2},"person_ids":[],"status":2,"name":"architect
|
194
|
+
open-source bandwidth","people":[],"is_archived":false}'
|
195
|
+
http_version:
|
196
|
+
recorded_at: Sat, 15 Jun 2013 00:05:19 GMT
|
197
|
+
recorded_with: VCR 2.3.0
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe PipelineDeals, "admin data" do
|
3
|
+
before(:each) { PipelineDeals.api_key = ENV['PIPELINEDEALS_API_KEY'] }
|
4
|
+
describe "deal stages" do
|
5
|
+
it "should list the deal stages" do
|
6
|
+
VCR.use_cassette(:list_deal_stages) do
|
7
|
+
stages = PipelineDeals::DealStage.find(:all)
|
8
|
+
stages.size.should == 6
|
9
|
+
stages.first.name.should == 'Lost'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
PipelineDeals.api_key = ENV['PIPELINEDEALS_API_KEY']
|
3
|
+
describe PipelineDeals, "deals" do
|
4
|
+
let(:deal) do
|
5
|
+
VCR.use_cassette(:get_a_deal) { PipelineDeals::Deal.find 1 }
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should have a deal stage" do
|
9
|
+
deal.deal_stage.should be_an_instance_of PipelineDeals::DealStage
|
10
|
+
deal.deal_stage.name.should == "Qualified Lead"
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "custom fields" do
|
14
|
+
it "should have custom fields" do
|
15
|
+
deal.custom_fields.should be_an_instance_of PipelineDeals::Deal::CustomFields
|
16
|
+
deal.custom_fields.custom_label_25.should == 2
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to update custom fields" do
|
20
|
+
VCR.use_cassette(:update_deal) do
|
21
|
+
deal.custom_fields.custom_label_25 = 1
|
22
|
+
deal.save
|
23
|
+
PipelineDeals::Deal.find(1).custom_fields.custom_label_25.should == 1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "source" do
|
29
|
+
it "should have a source" do
|
30
|
+
VCR.use_cassette(:lead_source) do
|
31
|
+
#deal.source.should be_an_instance_of PipelineDeals::LeadSource
|
32
|
+
deal.source.name.should == "Cold Call"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should be able to update the source" do
|
37
|
+
VCR.use_cassette(:update_lead_source) do
|
38
|
+
source = PipelineDeals::LeadSource.last
|
39
|
+
deal.source_id = source.id
|
40
|
+
deal.save
|
41
|
+
deal.reload.source.name.should == "Website"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe "user" do
|
47
|
+
it "should have a user" do
|
48
|
+
VCR.use_cassette(:deal_user) do
|
49
|
+
deal.user.should be_an_instance_of(PipelineDeals::User)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,10 @@ require 'vcr'
|
|
3
3
|
require 'pipeline_deals'
|
4
4
|
require 'pry'
|
5
5
|
|
6
|
+
PipelineDeals::Resource.site = "http://localhost:3000"
|
7
|
+
|
8
|
+
ActiveResource::Base.logger = Logger.new(STDOUT)
|
9
|
+
|
6
10
|
VCR.configure do |c|
|
7
11
|
c.cassette_library_dir = './spec/cassettes'
|
8
12
|
c.hook_into :webmock
|