-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d2b1dbb
commit 5171409
Showing
36 changed files
with
704 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2018 Auree Aubert | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require "rsalesloft/config" | ||
require "rsalesloft/connection" | ||
require "rsalesloft/resources" | ||
|
||
module RSalesloft | ||
VERSION = '0.1' | ||
|
||
def self.configure(config = {}) | ||
RSalesloft::Config.configure(config) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module RSalesloft | ||
class Config | ||
class << self | ||
attr_accessor :api_key | ||
|
||
def configure(config) | ||
@api_key = config[:api_key] | ||
|
||
self | ||
end | ||
|
||
def reset! | ||
@api_key = nil | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require "faraday" | ||
require "faraday_middleware" | ||
require "json" | ||
|
||
module RSalesloft | ||
class Connection | ||
class << self | ||
def get(path, options = {}) | ||
connection.get( | ||
path, options | ||
).body | ||
end | ||
|
||
def post(path, req_body) | ||
connection.post do |req| | ||
req.url(path) | ||
req.body = req_body | ||
end.body | ||
end | ||
|
||
def put(path, options = {}) | ||
connection.put(path, options).body | ||
end | ||
|
||
def delete(path, options = {}) | ||
connection.delete(options).body | ||
end | ||
|
||
private | ||
|
||
def connection | ||
Faraday.new(url: "https://api.salesloft.com/v2", headers: { | ||
accept: 'application/json', | ||
'Authorization' => "Bearer #{RSalesloft::Config.api_key}" | ||
}) do |conn| | ||
conn.request :json | ||
conn.response :json | ||
conn.response :logger | ||
conn.adapter Faraday.default_adapter | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require "rsalesloft/resources/accounts" | ||
require "rsalesloft/resources/actions" | ||
require "rsalesloft/resources/activities" | ||
require "rsalesloft/resources/cadence_memberships" | ||
require "rsalesloft/resources/cadences" | ||
require "rsalesloft/resources/call_data_records" | ||
require "rsalesloft/resources/call_dispositions" | ||
require "rsalesloft/resources/call_instructions" | ||
require "rsalesloft/resources/call_sentiments" | ||
require "rsalesloft/resources/caller_ids" | ||
require "rsalesloft/resources/calls" | ||
require "rsalesloft/resources/crm_activities" | ||
require "rsalesloft/resources/crm_activity_fields" | ||
require "rsalesloft/resources/custom_fields" | ||
require "rsalesloft/resources/email_templates" | ||
require "rsalesloft/resources/emails" | ||
require "rsalesloft/resources/imports" | ||
require "rsalesloft/resources/live_website_tracking_parameters" | ||
require "rsalesloft/resources/notes" | ||
require "rsalesloft/resources/ongoing_actions" | ||
require "rsalesloft/resources/people" | ||
require "rsalesloft/resources/person_stages" | ||
require "rsalesloft/resources/recording_settings" | ||
require "rsalesloft/resources/steps" | ||
require "rsalesloft/resources/successes" | ||
require "rsalesloft/resources/tags" | ||
require "rsalesloft/resources/team_templates" | ||
require "rsalesloft/resources/teams" | ||
require "rsalesloft/resources/users" | ||
|
||
module RSalesloft::Resources | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module RSalesloft::Resources | ||
class Accounts | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(accounts_path, query) | ||
end | ||
|
||
def create(options) | ||
RSalesloft::Connection.post(accounts_path, options) | ||
end | ||
|
||
def delete(id) | ||
RSalesloft::Connection.delete(accounts_path(id)) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(accounts_path(id)) | ||
end | ||
|
||
def update(id, options = {}) | ||
RSalesloft::Connection.put(accounts_path(id), options) | ||
end | ||
|
||
private | ||
|
||
def accounts_path(id = nil) | ||
id ? "accounts/#{id}/" : "accounts/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module RSalesloft::Resources | ||
class Actions | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(actions_path, query) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(actions_path(id)) | ||
end | ||
|
||
private | ||
|
||
def actions_path(id = nil) | ||
id ? "actions/#{id}/" : "actions/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module RSalesloft::Resources | ||
class Activities | ||
class << self | ||
def create(options) | ||
RSalesloft::Connection.post("activities/", options) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module RSalesloft::Resources | ||
class CadenceMemberships | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(cadence_memberships_path, query) | ||
end | ||
|
||
def create(options) | ||
RSalesloft::Connection.post(cadence_memberships_path, options) | ||
end | ||
|
||
def delete(id) | ||
RSalesloft::Connection.delete(cadence_memberships_path(id)) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(cadence_memberships_path(id)) | ||
end | ||
|
||
def update(id, options = {}) | ||
RSalesloft::Connection.put(cadence_memberships_path(id), options) | ||
end | ||
|
||
private | ||
|
||
def cadence_memberships_path(id = nil) | ||
id ? "cadence_memberships/#{id}/" : "cadence_memberships/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module RSalesloft::Resources | ||
class Cadences | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(cadences_path, query) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(cadences_path(id)) | ||
end | ||
|
||
private | ||
|
||
def cadences_path(id = nil) | ||
id ? "cadences/#{id}/" : "cadences/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module RSalesloft::Resources | ||
class CallDataRecords | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(call_data_records_path, query) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(call_data_records_path(id)) | ||
end | ||
|
||
private | ||
|
||
def call_data_records_path(id = nil) | ||
id ? "call_data_records/#{id}/" : "call_data_records/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module RSalesloft::Resources | ||
class CallDispositions | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get("call_dispositions/", query) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module RSalesloft::Resources | ||
class CallInstructions | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(call_instructions_path, query) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(call_instructions_path(id)) | ||
end | ||
|
||
private | ||
|
||
def call_instructions_path(id = nil) | ||
id ? "action_details/call_instructions/#{id}/" : "action_details/call_instructions/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module RSalesloft::Resources | ||
class CallSentiments | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get("call_sentiments/", query) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module RSalesloft::Resources | ||
class CallerIds | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get("phone_numbers/caller_ids/", query) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module RSalesloft::Resources | ||
class Calls | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(calls_path, query) | ||
end | ||
|
||
def create(options) | ||
RSalesloft::Connection.post(calls_path, options) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(calls_path(id)) | ||
end | ||
|
||
private | ||
|
||
def calls_path(id = nil) | ||
id ? "activities/calls/#{id}/" : "activities/calls/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module RSalesloft::Resources | ||
class CrmActivities | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get(crm_activities_path, query) | ||
end | ||
|
||
def fetch(id) | ||
RSalesloft::Connection.get(crm_activities_path(id)) | ||
end | ||
|
||
private | ||
|
||
def crm_activities_path(id = nil) | ||
id ? "crm_activities/#{id}/" : "crm_activities/" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module RSalesloft::Resources | ||
class CrmActivityFields | ||
class << self | ||
def list(query = {}) | ||
RSalesloft::Connection.get("crm_activity_fields/", query) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.