rsalesloft 0.1

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 (81) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.rspec +3 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +22 -0
  6. data/Rakefile +1 -0
  7. data/lib/rsalesloft.rb +11 -0
  8. data/lib/rsalesloft/config.rb +17 -0
  9. data/lib/rsalesloft/connection.rb +44 -0
  10. data/lib/rsalesloft/resources.rb +32 -0
  11. data/lib/rsalesloft/resources/accounts.rb +31 -0
  12. data/lib/rsalesloft/resources/actions.rb +19 -0
  13. data/lib/rsalesloft/resources/activities.rb +9 -0
  14. data/lib/rsalesloft/resources/cadence_memberships.rb +31 -0
  15. data/lib/rsalesloft/resources/cadences.rb +19 -0
  16. data/lib/rsalesloft/resources/call_data_records.rb +19 -0
  17. data/lib/rsalesloft/resources/call_dispositions.rb +9 -0
  18. data/lib/rsalesloft/resources/call_instructions.rb +19 -0
  19. data/lib/rsalesloft/resources/call_sentiments.rb +9 -0
  20. data/lib/rsalesloft/resources/caller_ids.rb +9 -0
  21. data/lib/rsalesloft/resources/calls.rb +23 -0
  22. data/lib/rsalesloft/resources/crm_activities.rb +19 -0
  23. data/lib/rsalesloft/resources/crm_activity_fields.rb +9 -0
  24. data/lib/rsalesloft/resources/custom_fields.rb +31 -0
  25. data/lib/rsalesloft/resources/email_templates.rb +19 -0
  26. data/lib/rsalesloft/resources/emails.rb +19 -0
  27. data/lib/rsalesloft/resources/imports.rb +31 -0
  28. data/lib/rsalesloft/resources/live_website_tracking_parameters.rb +9 -0
  29. data/lib/rsalesloft/resources/notes.rb +31 -0
  30. data/lib/rsalesloft/resources/ongoing_actions.rb +9 -0
  31. data/lib/rsalesloft/resources/people.rb +31 -0
  32. data/lib/rsalesloft/resources/person_stages.rb +31 -0
  33. data/lib/rsalesloft/resources/recording_settings.rb +9 -0
  34. data/lib/rsalesloft/resources/steps.rb +19 -0
  35. data/lib/rsalesloft/resources/successes.rb +9 -0
  36. data/lib/rsalesloft/resources/tags.rb +9 -0
  37. data/lib/rsalesloft/resources/team_templates.rb +19 -0
  38. data/lib/rsalesloft/resources/teams.rb +9 -0
  39. data/lib/rsalesloft/resources/users.rb +23 -0
  40. data/readme.md +44 -0
  41. data/rsalesloft.gemspec +27 -0
  42. data/spec/fixtures/tags/list_tags.json +6 -0
  43. data/spec/fixtures/team_templates/fetch_team_template.json +25 -0
  44. data/spec/fixtures/team_templates/list_team_templates.json +27 -0
  45. data/spec/fixtures/teams/fetch_current_team.json +19 -0
  46. data/spec/fixtures/users/fetch_current_user.json +40 -0
  47. data/spec/fixtures/users/fetch_user.json +40 -0
  48. data/spec/fixtures/users/list_users.json +42 -0
  49. data/spec/lib/rsalesloft/resources/accounts_spec.rb +0 -0
  50. data/spec/lib/rsalesloft/resources/actions_spec.rb +0 -0
  51. data/spec/lib/rsalesloft/resources/activities_spec.rb +0 -0
  52. data/spec/lib/rsalesloft/resources/cadence_memberships_spec.rb +0 -0
  53. data/spec/lib/rsalesloft/resources/cadences_spec.rb +0 -0
  54. data/spec/lib/rsalesloft/resources/call_data_records_spec.rb +0 -0
  55. data/spec/lib/rsalesloft/resources/call_dispositions_spec.rb +0 -0
  56. data/spec/lib/rsalesloft/resources/call_instructions_spec.rb +0 -0
  57. data/spec/lib/rsalesloft/resources/call_sentiments_spec.rb +0 -0
  58. data/spec/lib/rsalesloft/resources/caller_ids_spec.rb +0 -0
  59. data/spec/lib/rsalesloft/resources/calls_spec.rb +0 -0
  60. data/spec/lib/rsalesloft/resources/crm_activities_spec.rb +0 -0
  61. data/spec/lib/rsalesloft/resources/crm_activity_fields_spec.rb +0 -0
  62. data/spec/lib/rsalesloft/resources/custom_fields_spec.rb +0 -0
  63. data/spec/lib/rsalesloft/resources/email_templates_spec.rb +0 -0
  64. data/spec/lib/rsalesloft/resources/emails_spec.rb +0 -0
  65. data/spec/lib/rsalesloft/resources/imports_spec.rb +0 -0
  66. data/spec/lib/rsalesloft/resources/live_website_tracking_parameters_spec.rb +0 -0
  67. data/spec/lib/rsalesloft/resources/me_spec.rb +0 -0
  68. data/spec/lib/rsalesloft/resources/notes_spec.rb +0 -0
  69. data/spec/lib/rsalesloft/resources/ongoing_actions_spec.rb +0 -0
  70. data/spec/lib/rsalesloft/resources/people_spec.rb +0 -0
  71. data/spec/lib/rsalesloft/resources/person_stages_spec.rb +0 -0
  72. data/spec/lib/rsalesloft/resources/recording_settings_spec.rb +0 -0
  73. data/spec/lib/rsalesloft/resources/steps_spec.rb +0 -0
  74. data/spec/lib/rsalesloft/resources/successes_spec.rb +0 -0
  75. data/spec/lib/rsalesloft/resources/tags_spec.rb +0 -0
  76. data/spec/lib/rsalesloft/resources/team_spec.rb +0 -0
  77. data/spec/lib/rsalesloft/resources/team_templates_spec.rb +0 -0
  78. data/spec/lib/rsalesloft/resources/users_spec.rb +0 -0
  79. data/spec/lib/rsalesloft_spec.rb +2 -0
  80. data/spec/spec_helper.rb +12 -0
  81. metadata +286 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a26fcec6a2a061437b751646c77300289172acb
4
+ data.tar.gz: dfbc6b5c995b0a17ef3bd5c17f15e3d7d8ebc796
5
+ SHA512:
6
+ metadata.gz: '0963003daca6ef3847600d9152700c089bdede7c42ffee4d2af28ebd38e0409f5deccb21ee5059fdf35a1027381055193f1d7a01599cf983f59f6082e0cace0e'
7
+ data.tar.gz: af490bd370057083412c1bd258656359b536dbcf854b79ddfd4494b4ba28bce217c95a1e0d8b4f8717d5687f12e561de1e39da92bf4e6377167936b4a2d0a2b0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ .bundle
2
+ .yardoc
3
+ doc
4
+ pkg
5
+ Gemfile.lock
6
+ *.swp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format documentation
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Taylor Brooks
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/lib/rsalesloft.rb ADDED
@@ -0,0 +1,11 @@
1
+ require "rsalesloft/config"
2
+ require "rsalesloft/connection"
3
+ require "rsalesloft/resources"
4
+
5
+ module RSalesloft
6
+ VERSION = '0.1'
7
+
8
+ def self.configure(config = {})
9
+ RSalesloft::Config.configure(config)
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ module RSalesloft
2
+ class Config
3
+ class << self
4
+ attr_accessor :api_key
5
+
6
+ def configure(config)
7
+ @api_key = config[:api_key]
8
+
9
+ self
10
+ end
11
+
12
+ def reset!
13
+ @api_key = nil
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,44 @@
1
+ require "faraday"
2
+ require "faraday_middleware"
3
+ require "json"
4
+
5
+ module RSalesloft
6
+ class Connection
7
+ class << self
8
+ def get(path, options = {})
9
+ connection.get(
10
+ path, options
11
+ ).body
12
+ end
13
+
14
+ def post(path, req_body)
15
+ connection.post do |req|
16
+ req.url(path)
17
+ req.body = req_body
18
+ end.body
19
+ end
20
+
21
+ def put(path, options = {})
22
+ connection.put(path, options).body
23
+ end
24
+
25
+ def delete(path, options = {})
26
+ connection.delete(options).body
27
+ end
28
+
29
+ private
30
+
31
+ def connection
32
+ Faraday.new(url: "https://api.salesloft.com/v2", headers: {
33
+ accept: 'application/json',
34
+ 'Authorization' => "Bearer #{RSalesloft::Config.api_key}"
35
+ }) do |conn|
36
+ conn.request :json
37
+ conn.response :json
38
+ conn.response :logger
39
+ conn.adapter Faraday.default_adapter
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,32 @@
1
+ require "rsalesloft/resources/accounts"
2
+ require "rsalesloft/resources/actions"
3
+ require "rsalesloft/resources/activities"
4
+ require "rsalesloft/resources/cadence_memberships"
5
+ require "rsalesloft/resources/cadences"
6
+ require "rsalesloft/resources/call_data_records"
7
+ require "rsalesloft/resources/call_dispositions"
8
+ require "rsalesloft/resources/call_instructions"
9
+ require "rsalesloft/resources/call_sentiments"
10
+ require "rsalesloft/resources/caller_ids"
11
+ require "rsalesloft/resources/calls"
12
+ require "rsalesloft/resources/crm_activities"
13
+ require "rsalesloft/resources/crm_activity_fields"
14
+ require "rsalesloft/resources/custom_fields"
15
+ require "rsalesloft/resources/email_templates"
16
+ require "rsalesloft/resources/emails"
17
+ require "rsalesloft/resources/imports"
18
+ require "rsalesloft/resources/live_website_tracking_parameters"
19
+ require "rsalesloft/resources/notes"
20
+ require "rsalesloft/resources/ongoing_actions"
21
+ require "rsalesloft/resources/people"
22
+ require "rsalesloft/resources/person_stages"
23
+ require "rsalesloft/resources/recording_settings"
24
+ require "rsalesloft/resources/steps"
25
+ require "rsalesloft/resources/successes"
26
+ require "rsalesloft/resources/tags"
27
+ require "rsalesloft/resources/team_templates"
28
+ require "rsalesloft/resources/teams"
29
+ require "rsalesloft/resources/users"
30
+
31
+ module RSalesloft::Resources
32
+ end
@@ -0,0 +1,31 @@
1
+ module RSalesloft::Resources
2
+ class Accounts
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(accounts_path, query)
6
+ end
7
+
8
+ def create(options)
9
+ RSalesloft::Connection.post(accounts_path, options)
10
+ end
11
+
12
+ def delete(id)
13
+ RSalesloft::Connection.delete(accounts_path(id))
14
+ end
15
+
16
+ def fetch(id)
17
+ RSalesloft::Connection.get(accounts_path(id))
18
+ end
19
+
20
+ def update(id, options = {})
21
+ RSalesloft::Connection.put(accounts_path(id), options)
22
+ end
23
+
24
+ private
25
+
26
+ def accounts_path(id = nil)
27
+ id ? "accounts/#{id}/" : "accounts/"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,19 @@
1
+ module RSalesloft::Resources
2
+ class Actions
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(actions_path, query)
6
+ end
7
+
8
+ def fetch(id)
9
+ RSalesloft::Connection.get(actions_path(id))
10
+ end
11
+
12
+ private
13
+
14
+ def actions_path(id = nil)
15
+ id ? "actions/#{id}/" : "actions/"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module RSalesloft::Resources
2
+ class Activities
3
+ class << self
4
+ def create(options)
5
+ RSalesloft::Connection.post("activities/", options)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,31 @@
1
+ module RSalesloft::Resources
2
+ class CadenceMemberships
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(cadence_memberships_path, query)
6
+ end
7
+
8
+ def create(options)
9
+ RSalesloft::Connection.post(cadence_memberships_path, options)
10
+ end
11
+
12
+ def delete(id)
13
+ RSalesloft::Connection.delete(cadence_memberships_path(id))
14
+ end
15
+
16
+ def fetch(id)
17
+ RSalesloft::Connection.get(cadence_memberships_path(id))
18
+ end
19
+
20
+ def update(id, options = {})
21
+ RSalesloft::Connection.put(cadence_memberships_path(id), options)
22
+ end
23
+
24
+ private
25
+
26
+ def cadence_memberships_path(id = nil)
27
+ id ? "cadence_memberships/#{id}/" : "cadence_memberships/"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,19 @@
1
+ module RSalesloft::Resources
2
+ class Cadences
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(cadences_path, query)
6
+ end
7
+
8
+ def fetch(id)
9
+ RSalesloft::Connection.get(cadences_path(id))
10
+ end
11
+
12
+ private
13
+
14
+ def cadences_path(id = nil)
15
+ id ? "cadences/#{id}/" : "cadences/"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module RSalesloft::Resources
2
+ class CallDataRecords
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(call_data_records_path, query)
6
+ end
7
+
8
+ def fetch(id)
9
+ RSalesloft::Connection.get(call_data_records_path(id))
10
+ end
11
+
12
+ private
13
+
14
+ def call_data_records_path(id = nil)
15
+ id ? "call_data_records/#{id}/" : "call_data_records/"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module RSalesloft::Resources
2
+ class CallDispositions
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get("call_dispositions/", query)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,19 @@
1
+ module RSalesloft::Resources
2
+ class CallInstructions
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(call_instructions_path, query)
6
+ end
7
+
8
+ def fetch(id)
9
+ RSalesloft::Connection.get(call_instructions_path(id))
10
+ end
11
+
12
+ private
13
+
14
+ def call_instructions_path(id = nil)
15
+ id ? "action_details/call_instructions/#{id}/" : "action_details/call_instructions/"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module RSalesloft::Resources
2
+ class CallSentiments
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get("call_sentiments/", query)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module RSalesloft::Resources
2
+ class CallerIds
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get("phone_numbers/caller_ids/", query)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ module RSalesloft::Resources
2
+ class Calls
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(calls_path, query)
6
+ end
7
+
8
+ def create(options)
9
+ RSalesloft::Connection.post(calls_path, options)
10
+ end
11
+
12
+ def fetch(id)
13
+ RSalesloft::Connection.get(calls_path(id))
14
+ end
15
+
16
+ private
17
+
18
+ def calls_path(id = nil)
19
+ id ? "activities/calls/#{id}/" : "activities/calls/"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ module RSalesloft::Resources
2
+ class CrmActivities
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(crm_activities_path, query)
6
+ end
7
+
8
+ def fetch(id)
9
+ RSalesloft::Connection.get(crm_activities_path(id))
10
+ end
11
+
12
+ private
13
+
14
+ def crm_activities_path(id = nil)
15
+ id ? "crm_activities/#{id}/" : "crm_activities/"
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ module RSalesloft::Resources
2
+ class CrmActivityFields
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get("crm_activity_fields/", query)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,31 @@
1
+ module RSalesloft::Resources
2
+ class CustomFields
3
+ class << self
4
+ def list(query = {})
5
+ RSalesloft::Connection.get(custom_fields_path, query)
6
+ end
7
+
8
+ def create(options)
9
+ RSalesloft::Connection.post(custom_fields_path, options)
10
+ end
11
+
12
+ def delete(id)
13
+ RSalesloft::Connection.delete(custom_fields_path(id))
14
+ end
15
+
16
+ def fetch(id)
17
+ RSalesloft::Connection.get(custom_fields_path(id))
18
+ end
19
+
20
+ def update(id, options = {})
21
+ RSalesloft::Connection.put(custom_fields_path(id), options)
22
+ end
23
+
24
+ private
25
+
26
+ def custom_fields_path(id = nil)
27
+ id ? "custom_fields/#{id}/" : "custom_fields/"
28
+ end
29
+ end
30
+ end
31
+ end