pipeline_deals 0.1.0 → 0.3.0

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 (52) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/LICENSE.txt +2 -2
  4. data/Rakefile +6 -0
  5. data/lib/pipeline_deals.rb +11 -2
  6. data/lib/pipeline_deals/resource.rb +11 -5
  7. data/lib/pipeline_deals/resources/calendar_entry.rb +7 -0
  8. data/lib/pipeline_deals/resources/company.rb +2 -0
  9. data/lib/pipeline_deals/resources/company_custom_field_label.rb +1 -0
  10. data/lib/pipeline_deals/resources/deal.rb +4 -2
  11. data/lib/pipeline_deals/resources/deal_custom_field_label.rb +1 -0
  12. data/lib/pipeline_deals/resources/definitions.rb +12 -10
  13. data/lib/pipeline_deals/resources/event_category.rb +0 -1
  14. data/lib/pipeline_deals/resources/lead_source.rb +0 -1
  15. data/lib/pipeline_deals/resources/note.rb +9 -0
  16. data/lib/pipeline_deals/resources/note_category.rb +0 -1
  17. data/lib/pipeline_deals/resources/person.rb +8 -1
  18. data/lib/pipeline_deals/resources/person_custom_field_label.rb +1 -0
  19. data/lib/pipeline_deals/resources/predefined_contacts_tags.rb +0 -1
  20. data/lib/pipeline_deals/resources/user.rb +1 -0
  21. data/lib/pipeline_deals/version.rb +1 -1
  22. data/pipeline_deals.gemspec +6 -1
  23. data/spec/cassettes/PipelineDeals_Deal_calendar_entries.yml +49 -0
  24. data/spec/cassettes/PipelineDeals_Deal_notes.yml +62 -0
  25. data/spec/cassettes/PipelineDeals_Person_calendar_entries.yml +49 -0
  26. data/spec/cassettes/PipelineDeals_Person_documents.yml +47 -0
  27. data/spec/cassettes/PipelineDeals_Person_items.yml +156 -0
  28. data/spec/cassettes/PipelineDeals_Person_next_page.yml +57 -0
  29. data/spec/cassettes/PipelineDeals_Person_notes.yml +53 -0
  30. data/spec/cassettes/PipelineDeals_Person_per_page.yml +76 -0
  31. data/spec/cassettes/PipelineDeals_Person_six_things.yml +72 -0
  32. data/spec/cassettes/deal_create.yml +48 -0
  33. data/spec/cassettes/deals_filtered_by_custom_field.yml +95 -0
  34. data/spec/cassettes/get_a_person.yml +49 -0
  35. data/spec/cassettes/people_filtered_by_status.yml +64 -0
  36. data/spec/cassettes/person_with_company.yml +49 -0
  37. data/spec/cassettes/person_with_deals.yml +49 -0
  38. data/spec/pipeline_deals/admin_spec.rb +3 -4
  39. data/spec/pipeline_deals/companies_spec.rb +4 -62
  40. data/spec/pipeline_deals/deals_spec.rb +67 -51
  41. data/spec/pipeline_deals/people_spec.rb +45 -0
  42. data/spec/spec_helper.rb +13 -5
  43. data/spec/support/has_calendar_entries.rb +8 -0
  44. data/spec/support/has_deals.rb +8 -0
  45. data/spec/support/has_documents.rb +8 -0
  46. data/spec/support/has_notes.rb +8 -0
  47. data/spec/support/has_people.rb +8 -0
  48. data/spec/{pipeline_deals → support}/pagination_spec.rb +10 -12
  49. metadata +98 -22
  50. data/a_spike.rb +0 -72
  51. data/spec/pipeline_deals/has_documents.rb +0 -9
  52. data/spec/pipeline_deals/has_people.rb +0 -10
@@ -0,0 +1,95 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/v3/deals.json?api_key=iJHyFkMUBSfjUovt29&conditions%5Bcustom_label_11%5D%5Bfrom%5D=3&conditions%5Bcustom_label_11%5D%5Bto%5D=7
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
+ - Tue, 20 May 2014 17:01:17 GMT
23
+ Status:
24
+ - 200 OK
25
+ Connection:
26
+ - close
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ X-Runtime:
30
+ - '2196'
31
+ Etag:
32
+ - ! '"6de5fe702482b9cbb365cafffc8b4c51"'
33
+ Cache-Control:
34
+ - private, max-age=0, must-revalidate
35
+ Content-Length:
36
+ - '941'
37
+ Set-Cookie:
38
+ - is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
39
+ 00:00:00 GMT
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"entries":[{"closed_time":null,"company_id":28,"created_at":"2014/05/20
43
+ 12:12:30 -0400","deal_stage_id":3,"expected_close_date":"2014/05/22","expected_close_date_event_id":3,"id":10,"import_id":null,"is_archived":false,"is_example":null,"name":"Big
44
+ Deal","primary_contact_id":null,"probability":25,"source_id":4,"status":2,"summary":"Cool
45
+ Deal Summary...\r\nMultiple lines!","updated_at":"2014/05/20 12:12:32 -0400","user_id":2,"value_in_cents":3500,"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"deal_stage":{"id":3,"name":"Request
46
+ for Info","percent":25},"people":[],"company":{"id":28,"name":"The Random
47
+ Company"},"source":{"id":4,"name":"Trade Show"},"primary_contact":null,"collaborators":[],"shared_user_ids":[],"person_ids":[],"custom_fields":{"custom_label_1":2,"custom_label_2":6,"custom_label_3":7,"custom_label_4":8,"custom_label_11":5}}],"pagination":{"page":1,"page_var":"page","per_page":200,"pages":1,"total":1}}'
48
+ http_version:
49
+ recorded_at: Tue, 20 May 2014 17:01:17 GMT
50
+ - request:
51
+ method: get
52
+ uri: http://localhost:3000/api/v3/deals.json?api_key=iJHyFkMUBSfjUovt29&conditions%5Bcustom_label_12%5D%5B0%5D=19&conditions%5Bcustom_label_12%5D%5B1%5D=20
53
+ body:
54
+ encoding: US-ASCII
55
+ string: ''
56
+ headers:
57
+ Accept:
58
+ - application/json
59
+ Accept-Encoding:
60
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
61
+ User-Agent:
62
+ - Ruby
63
+ response:
64
+ status:
65
+ code: 200
66
+ message: OK
67
+ headers:
68
+ Date:
69
+ - Tue, 20 May 2014 18:08:39 GMT
70
+ Status:
71
+ - 200 OK
72
+ Connection:
73
+ - close
74
+ Content-Type:
75
+ - application/json; charset=utf-8
76
+ X-Runtime:
77
+ - '2459'
78
+ Etag:
79
+ - ! '"73501f87ac92c9c2fd3b0cfb3eab6c7f"'
80
+ Cache-Control:
81
+ - private, max-age=0, must-revalidate
82
+ Content-Length:
83
+ - '839'
84
+ Set-Cookie:
85
+ - is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
86
+ 00:00:00 GMT
87
+ body:
88
+ encoding: US-ASCII
89
+ string: ! '{"entries":[{"closed_time":null,"company_id":null,"created_at":"2014/05/20
90
+ 13:16:08 -0400","deal_stage_id":null,"expected_close_date":null,"expected_close_date_event_id":null,"id":11,"import_id":null,"is_archived":false,"is_example":null,"name":"Little
91
+ Deal","primary_contact_id":null,"probability":null,"source_id":null,"status":null,"summary":null,"updated_at":"2014/05/20
92
+ 13:16:08 -0400","user_id":2,"value_in_cents":null,"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"people":[],"deal_stage":null,"primary_contact":null,"company":null,"collaborators":[],"shared_user_ids":[],"person_ids":[],"custom_fields":{"custom_label_1":null,"custom_label_2":null,"custom_label_3":null,"custom_label_4":0,"custom_label_11":null,"custom_label_12":[20,21]}}],"pagination":{"page":1,"page_var":"page","per_page":200,"pages":1,"total":1}}'
93
+ http_version:
94
+ recorded_at: Tue, 20 May 2014 18:08:39 GMT
95
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/v3/people/1.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
+ - Mon, 19 May 2014 16:28:14 GMT
23
+ Status:
24
+ - 200 OK
25
+ Connection:
26
+ - close
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ X-Runtime:
30
+ - '1116'
31
+ Etag:
32
+ - ! '"5b1d943b32f448a039b024c24f55a3e2"'
33
+ Cache-Control:
34
+ - private, max-age=0, must-revalidate
35
+ Content-Length:
36
+ - '1232'
37
+ Set-Cookie:
38
+ - is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
39
+ 00:00:00 GMT
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"company_id":1,"created_at":"2014/05/19 08:54:59 -0400","email":null,"email2":null,"facebook_url":null,"fax":null,"first_name":"Leonard","home_address_1":null,"home_address_2":null,"home_city":null,"home_country":null,"home_email":null,"home_phone":null,"home_postal_code":null,"home_state":null,"id":1,"instant_message":null,"last_name":"Jakubowski","linked_in_url":null,"mobile":null,"phone":null,"position":null,"twitter":null,"type":"Contact","updated_at":"2014/05/19
43
+ 12:13:24 -0400","user_id":2,"viewed_at":null,"website":null,"work_address_1":null,"work_address_2":null,"work_city":null,"work_country":null,"work_postal_code":null,"work_state":null,"company_name":"Roob
44
+ Group","full_name":"Leonard Jakubowski","predefined_contacts_tag_ids":[],"deal_ids":[2],"image_thumb_url":"/images/thumb/missing.png","image_mobile_url":"/images/mobile/missing.png","predefined_contacts_tags":[],"deals":[{"id":2,"name":"reinvent
45
+ rich infrastructures"}],"lead_source":{"id":2,"name":"Cold Call"},"lead_status":{"hex_color":"C73408","id":2,"name":"Hot"},"company":{"id":1,"name":"Roob
46
+ Group"},"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"custom_fields":{},"possible_notify_user_ids":[],"total_pipeline":0,"won_deals_total":0}'
47
+ http_version:
48
+ recorded_at: Mon, 19 May 2014 16:28:14 GMT
49
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,64 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/v3/people.json?api_key=iJHyFkMUBSfjUovt29&conditions%5Bperson_status%5D%5B0%5D=2
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
+ - Mon, 19 May 2014 16:49:32 GMT
23
+ Status:
24
+ - 200 OK
25
+ Connection:
26
+ - close
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ X-Runtime:
30
+ - '1594'
31
+ Etag:
32
+ - ! '"9c47c29e4e3a8ae3adcdb6eae36ba7ac"'
33
+ Cache-Control:
34
+ - private, max-age=0, must-revalidate
35
+ Content-Length:
36
+ - '4640'
37
+ Set-Cookie:
38
+ - is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
39
+ 00:00:00 GMT
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"entries":[{"company_id":1,"created_at":"2014/05/19 08:54:59 -0400","email":null,"email2":null,"facebook_url":null,"fax":null,"first_name":"Leonard","home_address_1":null,"home_address_2":null,"home_city":null,"home_country":null,"home_email":null,"home_phone":null,"home_postal_code":null,"home_state":null,"id":1,"instant_message":null,"last_name":"Jakubowski","linked_in_url":null,"mobile":null,"phone":null,"position":null,"twitter":null,"type":"Contact","updated_at":"2014/05/19
43
+ 12:13:24 -0400","user_id":2,"viewed_at":null,"website":null,"work_address_1":null,"work_address_2":null,"work_city":null,"work_country":null,"work_postal_code":null,"work_state":null,"company_name":"Roob
44
+ Group","full_name":"Leonard Jakubowski","predefined_contacts_tag_ids":[],"deal_ids":[2],"image_thumb_url":"/images/thumb/missing.png","image_mobile_url":"/images/mobile/missing.png","predefined_contacts_tags":[],"deals":[{"id":2,"name":"reinvent
45
+ rich infrastructures"}],"lead_source":{"id":2,"name":"Cold Call"},"lead_status":{"hex_color":"C73408","id":2,"name":"Hot"},"company":{"id":1,"name":"Roob
46
+ Group"},"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"custom_fields":{}},{"company_id":2,"created_at":"2014/05/19
47
+ 08:55:01 -0400","email":null,"email2":null,"facebook_url":null,"fax":null,"first_name":"Kendrick","home_address_1":null,"home_address_2":null,"home_city":null,"home_country":null,"home_email":null,"home_phone":null,"home_postal_code":null,"home_state":null,"id":2,"instant_message":null,"last_name":"Rolfson","linked_in_url":null,"mobile":null,"phone":null,"position":null,"twitter":null,"type":"Contact","updated_at":"2014/05/19
48
+ 11:41:43 -0400","user_id":2,"viewed_at":null,"website":null,"work_address_1":null,"work_address_2":null,"work_city":null,"work_country":null,"work_postal_code":null,"work_state":null,"company_name":"Baumbach,
49
+ Mitchell and Pfannerstill","full_name":"Kendrick Rolfson","predefined_contacts_tag_ids":[],"deal_ids":[],"image_thumb_url":"/images/thumb/missing.png","image_mobile_url":"/images/mobile/missing.png","predefined_contacts_tags":[],"deals":[],"lead_source":{"id":2,"name":"Cold
50
+ Call"},"lead_status":{"hex_color":"C73408","id":2,"name":"Hot"},"company":{"id":2,"name":"Baumbach,
51
+ Mitchell and Pfannerstill"},"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"custom_fields":{}},{"company_id":3,"created_at":"2014/05/19
52
+ 08:55:01 -0400","email":null,"email2":null,"facebook_url":null,"fax":null,"first_name":"Dorcas","home_address_1":null,"home_address_2":null,"home_city":null,"home_country":null,"home_email":null,"home_phone":null,"home_postal_code":null,"home_state":null,"id":3,"instant_message":null,"last_name":"McCullough","linked_in_url":null,"mobile":null,"phone":null,"position":null,"twitter":null,"type":"Contact","updated_at":"2014/05/19
53
+ 11:41:43 -0400","user_id":2,"viewed_at":null,"website":null,"work_address_1":null,"work_address_2":null,"work_city":null,"work_country":null,"work_postal_code":null,"work_state":null,"company_name":"Walker
54
+ Inc","full_name":"Dorcas McCullough","predefined_contacts_tag_ids":[],"deal_ids":[],"image_thumb_url":"/images/thumb/missing.png","image_mobile_url":"/images/mobile/missing.png","predefined_contacts_tags":[],"deals":[],"lead_source":{"id":2,"name":"Cold
55
+ Call"},"lead_status":{"hex_color":"C73408","id":2,"name":"Hot"},"company":{"id":3,"name":"Walker
56
+ Inc"},"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"custom_fields":{}},{"company_id":4,"created_at":"2014/05/19
57
+ 08:55:03 -0400","email":null,"email2":null,"facebook_url":null,"fax":null,"first_name":"Tamia","home_address_1":null,"home_address_2":null,"home_city":null,"home_country":null,"home_email":null,"home_phone":null,"home_postal_code":null,"home_state":null,"id":4,"instant_message":null,"last_name":"Skiles","linked_in_url":null,"mobile":null,"phone":null,"position":null,"twitter":null,"type":"Contact","updated_at":"2014/05/19
58
+ 11:41:43 -0400","user_id":2,"viewed_at":null,"website":null,"work_address_1":null,"work_address_2":null,"work_city":null,"work_country":null,"work_postal_code":null,"work_state":null,"company_name":"Rosenbaum
59
+ Inc","full_name":"Tamia Skiles","predefined_contacts_tag_ids":[],"deal_ids":[],"image_thumb_url":"/images/thumb/missing.png","image_mobile_url":"/images/mobile/missing.png","predefined_contacts_tags":[],"deals":[],"lead_source":{"id":2,"name":"Cold
60
+ Call"},"lead_status":{"hex_color":"C73408","id":2,"name":"Hot"},"company":{"id":4,"name":"Rosenbaum
61
+ Inc"},"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"custom_fields":{}}],"pagination":{"page":1,"page_var":"page","per_page":200,"pages":1,"total":4}}'
62
+ http_version:
63
+ recorded_at: Mon, 19 May 2014 16:49:32 GMT
64
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/v3/people/1.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
+ - Mon, 19 May 2014 16:29:07 GMT
23
+ Status:
24
+ - 200 OK
25
+ Connection:
26
+ - close
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ X-Runtime:
30
+ - '1255'
31
+ Etag:
32
+ - ! '"5b1d943b32f448a039b024c24f55a3e2"'
33
+ Cache-Control:
34
+ - private, max-age=0, must-revalidate
35
+ Content-Length:
36
+ - '1232'
37
+ Set-Cookie:
38
+ - is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
39
+ 00:00:00 GMT
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"company_id":1,"created_at":"2014/05/19 08:54:59 -0400","email":null,"email2":null,"facebook_url":null,"fax":null,"first_name":"Leonard","home_address_1":null,"home_address_2":null,"home_city":null,"home_country":null,"home_email":null,"home_phone":null,"home_postal_code":null,"home_state":null,"id":1,"instant_message":null,"last_name":"Jakubowski","linked_in_url":null,"mobile":null,"phone":null,"position":null,"twitter":null,"type":"Contact","updated_at":"2014/05/19
43
+ 12:13:24 -0400","user_id":2,"viewed_at":null,"website":null,"work_address_1":null,"work_address_2":null,"work_city":null,"work_country":null,"work_postal_code":null,"work_state":null,"company_name":"Roob
44
+ Group","full_name":"Leonard Jakubowski","predefined_contacts_tag_ids":[],"deal_ids":[2],"image_thumb_url":"/images/thumb/missing.png","image_mobile_url":"/images/mobile/missing.png","predefined_contacts_tags":[],"deals":[{"id":2,"name":"reinvent
45
+ rich infrastructures"}],"lead_source":{"id":2,"name":"Cold Call"},"lead_status":{"hex_color":"C73408","id":2,"name":"Hot"},"company":{"id":1,"name":"Roob
46
+ Group"},"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"custom_fields":{},"possible_notify_user_ids":[],"total_pipeline":0,"won_deals_total":0}'
47
+ http_version:
48
+ recorded_at: Mon, 19 May 2014 16:29:07 GMT
49
+ recorded_with: VCR 2.3.0
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:3000/api/v3/people/1.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
+ - Mon, 19 May 2014 16:28:29 GMT
23
+ Status:
24
+ - 200 OK
25
+ Connection:
26
+ - close
27
+ Content-Type:
28
+ - application/json; charset=utf-8
29
+ X-Runtime:
30
+ - '1242'
31
+ Etag:
32
+ - ! '"5b1d943b32f448a039b024c24f55a3e2"'
33
+ Cache-Control:
34
+ - private, max-age=0, must-revalidate
35
+ Content-Length:
36
+ - '1232'
37
+ Set-Cookie:
38
+ - is_legacy_user=; domain=pipelinedeals.com; path=/; expires=Thu, 01-Jan-1970
39
+ 00:00:00 GMT
40
+ body:
41
+ encoding: US-ASCII
42
+ string: ! '{"company_id":1,"created_at":"2014/05/19 08:54:59 -0400","email":null,"email2":null,"facebook_url":null,"fax":null,"first_name":"Leonard","home_address_1":null,"home_address_2":null,"home_city":null,"home_country":null,"home_email":null,"home_phone":null,"home_postal_code":null,"home_state":null,"id":1,"instant_message":null,"last_name":"Jakubowski","linked_in_url":null,"mobile":null,"phone":null,"position":null,"twitter":null,"type":"Contact","updated_at":"2014/05/19
43
+ 12:13:24 -0400","user_id":2,"viewed_at":null,"website":null,"work_address_1":null,"work_address_2":null,"work_city":null,"work_country":null,"work_postal_code":null,"work_state":null,"company_name":"Roob
44
+ Group","full_name":"Leonard Jakubowski","predefined_contacts_tag_ids":[],"deal_ids":[2],"image_thumb_url":"/images/thumb/missing.png","image_mobile_url":"/images/mobile/missing.png","predefined_contacts_tags":[],"deals":[{"id":2,"name":"reinvent
45
+ rich infrastructures"}],"lead_source":{"id":2,"name":"Cold Call"},"lead_status":{"hex_color":"C73408","id":2,"name":"Hot"},"company":{"id":1,"name":"Roob
46
+ Group"},"user":{"id":2,"first_name":"Maggie","last_name":"Zemlak"},"custom_fields":{},"possible_notify_user_ids":[],"total_pipeline":0,"won_deals_total":0}'
47
+ http_version:
48
+ recorded_at: Mon, 19 May 2014 16:28:29 GMT
49
+ recorded_with: VCR 2.3.0
@@ -1,14 +1,13 @@
1
1
  require 'spec_helper'
2
+
2
3
  describe PipelineDeals, "admin data" do
3
- before(:each) { PipelineDeals.api_key = ENV['PIPELINEDEALS_API_KEY'] }
4
4
  describe "deal stages" do
5
5
  it "should list the deal stages" do
6
6
  VCR.use_cassette(:list_deal_stages) do
7
7
  stages = PipelineDeals::DealStage.find(:all)
8
- stages.size.should == 6
9
- stages.first.name.should == 'Lost'
8
+ expect(stages.size).to eq(6)
9
+ expect(stages.first.name).to eq 'Lost'
10
10
  end
11
11
  end
12
12
  end
13
13
  end
14
-
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- PipelineDeals.api_key = ENV['PIPELINEDEALS_API_KEY']
2
+
3
3
  describe PipelineDeals::Company do
4
4
  it_should_behave_like "a paginated collection"
5
5
 
@@ -10,68 +10,10 @@ describe PipelineDeals::Company do
10
10
 
11
11
  let(:company) { VCR.use_cassette(:get_a_company) { PipelineDeals::Company.find 3 } }
12
12
 
13
- it "should have many deals" do
13
+ it "has many deals" do
14
14
  VCR.use_cassette(:company_deals) do
15
- company.deals.size.should == 1
16
- company.deals.first.name.should == "disintermediate value-added technologies"
15
+ expect(company.deals.size).to eq 1
16
+ expect(company.deals.first.name).to eq "disintermediate value-added technologies"
17
17
  end
18
18
  end
19
-
20
- # describe "custom fields" do
21
- # it "should have custom fields" do
22
- # deal.custom_fields.should be_an_instance_of PipelineDeals::Deal::CustomFields
23
- # deal.custom_fields.custom_label_25.should == 2
24
- # end
25
-
26
- # it "should be able to update custom fields" do
27
- # VCR.use_cassette(:update_deal) do
28
- # deal.custom_fields.custom_label_25 = 1
29
- # deal.save
30
- # PipelineDeals::Deal.find(1).custom_fields.custom_label_25.should == 1
31
- # end
32
- # end
33
- # end
34
-
35
- # describe "source" do
36
- # it "should have a source" do
37
- # deal.source.should be_an_instance_of PipelineDeals::LeadSource
38
- # deal.source.name.should == "Cold Call"
39
- # end
40
-
41
- # it "should be able to update the source" do
42
- # VCR.use_cassette(:update_lead_source) do
43
- # source = PipelineDeals::LeadSource.last
44
- # deal.source_id = source.id
45
- # deal.save
46
- # deal.reload.source.name.should == "Website"
47
- # end
48
- # end
49
- # end
50
-
51
- # describe "user" do
52
- # it "should have a user" do
53
- # deal.user.should be_an_instance_of(PipelineDeals::User)
54
- # end
55
- # end
56
-
57
- # describe "primary_contact" do
58
- # let(:deal_with_contact) { VCR.use_cassette(:deal_with_primary_contact) { PipelineDeals::Deal.find 2 } }
59
- # it "should have a primary contact" do
60
- # deal_with_contact.primary_contact.should be_an_instance_of PipelineDeals::Person
61
- # end
62
- # end
63
-
64
- # describe "company" do
65
- # let(:deal_with_company) { VCR.use_cassette(:deal_with_company) { PipelineDeals::Deal.find 81 } }
66
- # it "should have a company" do
67
- # deal_with_company.company.should be_an_instance_of PipelineDeals::Company
68
- # end
69
- # end
70
-
71
- # describe "deal_stage" do
72
- # it "should have a deal stage" do
73
- # deal.deal_stage.should be_an_instance_of PipelineDeals::DealStage
74
- # end
75
- # end
76
19
  end
77
-
@@ -1,87 +1,103 @@
1
1
  require 'spec_helper'
2
- PipelineDeals.api_key = ENV['PIPELINEDEALS_API_KEY']
2
+
3
3
  describe PipelineDeals::Deal do
4
4
  it_should_behave_like "a paginated collection"
5
5
 
6
6
  let(:docs_obj) { deal }
7
+ let(:cals_obj) { deal }
8
+ let(:notes_obj) { deal }
7
9
  let(:people_obj) { VCR.use_cassette(:deal_with_primary_contact) { PipelineDeals::Deal.find 2 } }
8
10
  it_should_behave_like "an object that can have documents"
9
11
  it_should_behave_like "an object that can have people"
12
+ it_should_behave_like "an object that can have notes"
13
+ it_should_behave_like "an object that can have calendar_entries"
10
14
 
11
15
  let(:deal) { VCR.use_cassette(:get_a_deal) { PipelineDeals::Deal.find 1 } }
16
+ let(:deal_with_contact) { VCR.use_cassette(:deal_with_primary_contact) { PipelineDeals::Deal.find 2 } }
17
+ let(:deal_with_company) { VCR.use_cassette(:deal_with_company) { PipelineDeals::Deal.find 81 } }
12
18
 
13
- describe "filtering" do
14
- it "should be able to filter on stage" do
19
+ it "creates a deal" do
20
+ VCR.use_cassette(:deal_create) do
21
+ new_deal = PipelineDeals::Deal.create(:name => 'a new deal')
22
+ new_deal.attributes.keys.include?(:id)
23
+ end
24
+ end
25
+
26
+ describe "filters" do
27
+ it "on stage" do
15
28
  VCR.use_cassette(:deals_filtered_by_stage) do
16
- deals = PipelineDeals::Deal.where(conditions: {deal_stage: [2,4]})
17
- deals.size.should == 3
18
- deals.all? {|deal| [2,4].include?(deal.deal_stage_id) }
29
+ deals = PipelineDeals::Deal.where(conditions: { deal_stage: [2,4] })
30
+ expect(deals.size).to eq 3
31
+ expect(deals.map(&:deal_stage_id)).to include(2)
32
+ expect(deals.map(&:deal_stage_id)).to include(4)
19
33
  end
20
34
  end
21
- end
22
35
 
36
+ it "on numeric custom field" do
37
+ VCR.use_cassette(:deals_filtered_by_custom_field) do
38
+ deals = PipelineDeals::Deal.where(conditions: {custom_label_11: { from: 3, to: 7 }})
39
+ expect(deals.size).to eq(1)
40
+ deals.all? {|deal| deal.custom_fields.custom_label_11 >= 3 && deal.custom_fields.custom_label_11 <+ 7 }
41
+ end
42
+ end
43
+
44
+ it "on picklist custom field" do
45
+ VCR.use_cassette(:deals_filtered_by_custom_field) do
46
+ deals = PipelineDeals::Deal.where(conditions: {custom_label_12: [19,20]})
47
+ expect(deals.size).to eq 1
48
+ deals.all? { |deal| ([19,20] & deal.custom_fields.custom_label_12).any? }
49
+ end
50
+ end
51
+ end
23
52
 
24
53
  describe "associations" do
25
- it "should have a deal stage" do
26
- deal.deal_stage.should be_an_instance_of PipelineDeals::DealStage
27
- deal.deal_stage.name.should == "Qualified Lead"
54
+ it "has a deal stage" do
55
+ expect(deal.deal_stage).to be_an_instance_of PipelineDeals::DealStage
56
+ expect(deal.deal_stage.name).to eq "Qualified Lead"
28
57
  end
29
58
 
30
- describe "custom fields" do
31
- it "should have custom fields" do
32
- deal.custom_fields.should be_an_instance_of PipelineDeals::Deal::CustomFields
33
- deal.custom_fields.custom_label_25.should == 2
34
- end
59
+ it "has custom fields" do
60
+ expect(deal.custom_fields).to be_an_instance_of PipelineDeals::Deal::CustomFields
61
+ expect(deal.custom_fields.custom_label_25).to eq 2
62
+ end
35
63
 
36
- it "should be able to update custom fields" do
37
- VCR.use_cassette(:update_deal) do
38
- deal.custom_fields.custom_label_25 = 1
39
- deal.save
40
- PipelineDeals::Deal.find(1).custom_fields.custom_label_25.should == 1
41
- end
64
+ it "can update custom fields" do
65
+ VCR.use_cassette(:update_deal) do
66
+ deal.custom_fields.custom_label_25 = 1
67
+ deal.save
68
+ custom_label = PipelineDeals::Deal.find(1).custom_fields.custom_label_25
69
+ expect(custom_label).to eq 1
42
70
  end
43
71
  end
44
72
 
45
- describe "source" do
46
- it "should have a source" do
47
- deal.source.should be_an_instance_of PipelineDeals::LeadSource
48
- deal.source.name.should == "Cold Call"
49
- end
73
+ it "has a source" do
74
+ expect(deal.source).to be_an_instance_of PipelineDeals::LeadSource
75
+ expect(deal.source.name).to eq "Cold Call"
76
+ end
50
77
 
51
- it "should be able to update the source" do
52
- VCR.use_cassette(:update_lead_source) do
53
- source = PipelineDeals::LeadSource.last
54
- deal.source_id = source.id
55
- deal.save
56
- deal.reload.source.name.should == "Website"
57
- end
78
+ it "can update source" do
79
+ VCR.use_cassette(:update_lead_source) do
80
+ source = PipelineDeals::LeadSource.last
81
+ deal.source_id = source.id
82
+ deal.save
83
+ expect(deal.reload.source.name).to eq "Website"
58
84
  end
59
85
  end
60
86
 
61
- describe "user" do
62
- it "should have a user" do
63
- deal.user.should be_an_instance_of(PipelineDeals::User)
64
- end
87
+ it "has a user" do
88
+ expect(deal.user).to be_an_instance_of(PipelineDeals::User)
65
89
  end
66
90
 
67
- describe "primary_contact" do
68
- let(:deal_with_contact) { VCR.use_cassette(:deal_with_primary_contact) { PipelineDeals::Deal.find 2 } }
69
- it "should have a primary contact" do
70
- deal_with_contact.primary_contact.should be_an_instance_of PipelineDeals::Person
71
- end
91
+ it "has a primary contact" do
92
+ expect(deal_with_contact.primary_contact).to be_an_instance_of PipelineDeals::Person
72
93
  end
73
94
 
74
- describe "company" do
75
- let(:deal_with_company) { VCR.use_cassette(:deal_with_company) { PipelineDeals::Deal.find 81 } }
76
- it "should have a company" do
77
- deal_with_company.company.should be_an_instance_of PipelineDeals::Company
78
- end
95
+ it "has a company" do
96
+ expect(deal_with_company.company).to be_an_instance_of PipelineDeals::Company
79
97
  end
80
98
 
81
- describe "deal_stage" do
82
- it "should have a deal stage" do
83
- deal.deal_stage.should be_an_instance_of PipelineDeals::DealStage
84
- end
99
+ it "has a deal stage" do
100
+ expect(deal.deal_stage).to be_an_instance_of PipelineDeals::DealStage
85
101
  end
86
102
  end
87
103
  end