openstax_salesforce 3.1.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -46
- data/Rakefile +2 -5
- data/config/initializers/openstax_salesforce.rb +11 -36
- data/db/migrate/0_install_openstax_salesforce.rb +1 -0
- data/db/migrate/1_drop_openstax_salesforce_users.rb +14 -0
- data/lib/openstax/salesforce/active_force.rb +0 -4
- data/lib/openstax/salesforce/client.rb +11 -17
- data/lib/openstax/salesforce/engine.rb +5 -3
- data/lib/openstax/salesforce/remote/campaign.rb +0 -2
- data/lib/openstax/salesforce/remote/campaign_member.rb +0 -1
- data/lib/openstax/salesforce/remote/opportunity.rb +0 -2
- data/lib/openstax/salesforce/remote/school.rb +5 -1
- data/lib/openstax/salesforce/remote/term_year.rb +0 -2
- data/lib/openstax/salesforce/remote/tutor_course_period.rb +0 -2
- data/lib/openstax/salesforce/spec_helpers.rb +142 -26
- data/lib/openstax/salesforce/version.rb +1 -1
- data/lib/openstax_salesforce.rb +13 -29
- data/lib/tasks/openstax_salesforce_tasks.rake +1 -26
- metadata +15 -182
- data/app/controllers/openstax/salesforce/application_controller.rb +0 -7
- data/app/controllers/openstax/salesforce/settings_controller.rb +0 -20
- data/app/helpers/openstax/salesforce/application_helper.rb +0 -11
- data/app/models/openstax/salesforce/user.rb +0 -31
- data/app/views/openstax/salesforce/settings/show.html.erb +0 -33
- data/config/initializers/omniauth.rb +0 -8
- data/config/routes.rb +0 -11
- data/lib/openstax/salesforce/spec_helpers/salesforce_proxy.rb +0 -121
- data/lib/openstax/salesforce/user_missing.rb +0 -3
- data/spec/client_spec.rb +0 -10
- data/spec/dummy/README.md +0 -28
- data/spec/dummy/Rakefile +0 -6
- data/spec/dummy/app/assets/javascripts/application.js +0 -13
- data/spec/dummy/app/assets/stylesheets/application.css +0 -15
- data/spec/dummy/app/controllers/application_controller.rb +0 -5
- data/spec/dummy/app/helpers/application_helper.rb +0 -2
- data/spec/dummy/app/views/layouts/application.html.erb +0 -14
- data/spec/dummy/bin/bundle +0 -3
- data/spec/dummy/bin/rails +0 -4
- data/spec/dummy/bin/rake +0 -4
- data/spec/dummy/bin/setup +0 -29
- data/spec/dummy/config.ru +0 -4
- data/spec/dummy/config/application.rb +0 -25
- data/spec/dummy/config/boot.rb +0 -5
- data/spec/dummy/config/database.yml +0 -25
- data/spec/dummy/config/environment.rb +0 -5
- data/spec/dummy/config/environments/development.rb +0 -41
- data/spec/dummy/config/environments/production.rb +0 -79
- data/spec/dummy/config/environments/test.rb +0 -42
- data/spec/dummy/config/initializers/assets.rb +0 -11
- data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/dummy/config/initializers/inflections.rb +0 -16
- data/spec/dummy/config/initializers/mime_types.rb +0 -4
- data/spec/dummy/config/initializers/session_store.rb +0 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/spec/dummy/config/locales/en.yml +0 -23
- data/spec/dummy/config/routes.rb +0 -4
- data/spec/dummy/config/secrets.yml +0 -22
- data/spec/dummy/db/schema.rb +0 -25
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -2673
- data/spec/dummy/public/404.html +0 -67
- data/spec/dummy/public/422.html +0 -67
- data/spec/dummy/public/500.html +0 -66
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/user.rb +0 -17
- data/spec/openstax/salesforce/controllers/application_controller_spec.rb +0 -22
- data/spec/openstax/salesforce/controllers/settings_controller_spec.rb +0 -80
- data/spec/openstax/salesforce/remote/opportunity_spec.rb +0 -11
- data/spec/openstax/salesforce/remote/term_year_spec.rb +0 -81
- data/spec/openstax/salesforce/remote/tutor_course_period_spec.rb +0 -30
- data/spec/openstax/salesforce/spec_helpers_spec.rb +0 -31
- data/spec/rails_helper.rb +0 -99
- data/spec/routing_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -86
@@ -1,33 +0,0 @@
|
|
1
|
-
<div class="salesforce-settings">
|
2
|
-
|
3
|
-
<%= page_heading(self, "Salesforce Setup") %>
|
4
|
-
|
5
|
-
<p>When Accounts makes calls to Salesforce's API, it must do so on behalf of a
|
6
|
-
specific Salesforce user. At any one time, Accounts has information for either
|
7
|
-
zero or one such user. Use the link below to set the current user that Accounts
|
8
|
-
acts as when calling the Salesforce API.</p>
|
9
|
-
|
10
|
-
<% @user = OpenStax::Salesforce::User.first %>
|
11
|
-
|
12
|
-
<div style="margin: 30px 0px">
|
13
|
-
<p>
|
14
|
-
<% if @user.present? %>
|
15
|
-
The current Salesforce user is <b><%= @user.name || "[Unknown Name]" %></b>.
|
16
|
-
<% else %>
|
17
|
-
There <b>is no</b> Salesforce user currently set.
|
18
|
-
<% end %>
|
19
|
-
</p>
|
20
|
-
</div>
|
21
|
-
|
22
|
-
<%= link_to "Set Salesforce User",
|
23
|
-
"/auth/salesforce?redirect_uri=#{main_app.auth_salesforce_callback_url}",
|
24
|
-
id: "sign_in", class: 'btn btn-primary' %>
|
25
|
-
|
26
|
-
<%= link_to "Clear Salesforce User",
|
27
|
-
destroy_user_settings_path,
|
28
|
-
class: 'btn btn-danger pull-right',
|
29
|
-
method: :delete %>
|
30
|
-
|
31
|
-
<hr/>
|
32
|
-
|
33
|
-
</div>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
2
|
-
unless OpenStax::Salesforce.configuration.skip_automatic_omniauth_setup
|
3
|
-
provider :salesforce,
|
4
|
-
OpenStax::Salesforce.configuration.salesforce_client_key,
|
5
|
-
OpenStax::Salesforce.configuration.salesforce_client_secret,
|
6
|
-
client_options: OpenStax::Salesforce.configuration.salesforce_client_options
|
7
|
-
end
|
8
|
-
end
|
data/config/routes.rb
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
module OpenStax::Salesforce::SpecHelpers
|
2
|
-
class SalesforceProxy
|
3
|
-
|
4
|
-
include OpenStax::Salesforce::Remote
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
end
|
8
|
-
|
9
|
-
# Used to filter records to the scope of one spec
|
10
|
-
def reset_unique_token(token = SecureRandom.hex(10))
|
11
|
-
@unique_token = token
|
12
|
-
end
|
13
|
-
|
14
|
-
def clear_unique_token
|
15
|
-
@unique_token = nil
|
16
|
-
end
|
17
|
-
|
18
|
-
def new_contact(first_name: nil, last_name: nil, school_name: "JP University",
|
19
|
-
email: nil, email_alt: nil, faculty_verified: nil, school_type: nil)
|
20
|
-
ensure_schools_exist([school_name])
|
21
|
-
|
22
|
-
Contact.new(
|
23
|
-
first_name: first_name || Faker::Name.first_name,
|
24
|
-
last_name: last_name!(last_name),
|
25
|
-
school_id: school_id(school_name),
|
26
|
-
email: email,
|
27
|
-
email_alt: email_alt,
|
28
|
-
faculty_verified: faculty_verified,
|
29
|
-
school_type: school_type
|
30
|
-
).tap do |contact|
|
31
|
-
if !contact.save
|
32
|
-
raise "Could not save SF contact: #{contact.errors}"
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def new_lead(email:, status: nil, last_name: nil, source: nil, school_name: "JP University")
|
38
|
-
Lead.new(
|
39
|
-
email: email,
|
40
|
-
status: status,
|
41
|
-
last_name: last_name!(last_name),
|
42
|
-
school: school_name,
|
43
|
-
source: source
|
44
|
-
).tap do |lead|
|
45
|
-
if !lead.save
|
46
|
-
raise "Could not save SF lead: #{lead.errors}"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def new_campaign(name: SecureRandom.hex(8))
|
52
|
-
Campaign.new(
|
53
|
-
name: name
|
54
|
-
).tap do |campaign|
|
55
|
-
if !campaign.save
|
56
|
-
raise "Could not save SF Campaign: #{campaign.errors}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
def new_campaign_member(contact_id:, campaign_id:)
|
62
|
-
CampaignMember.new(
|
63
|
-
contact_id: contact_id,
|
64
|
-
campaign_id: campaign_id
|
65
|
-
).tap do |campaign_member|
|
66
|
-
if !campaign_member.save
|
67
|
-
raise "Could not save SF Campaign Member: #{campaign_member.errors}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def last_name!(input)
|
73
|
-
"#{input || Faker::Name.last_name}#{@unique_token if @unique_token.present?}"
|
74
|
-
end
|
75
|
-
|
76
|
-
def ensure_books_exist(book_names)
|
77
|
-
book_names.each do |book_name|
|
78
|
-
if books.none? {|bb| bb.name == book_name}
|
79
|
-
book = Book.new(name: book_name)
|
80
|
-
book.save!
|
81
|
-
books.push(book)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
def ensure_schools_exist(school_names)
|
87
|
-
school_names.compact.each do |school_name|
|
88
|
-
if schools.none? {|ss| ss.name == school_name}
|
89
|
-
school = School.new(name: school_name)
|
90
|
-
school.save!
|
91
|
-
schools.push(school)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def books
|
97
|
-
@books ||= Book.all
|
98
|
-
end
|
99
|
-
|
100
|
-
def book(name)
|
101
|
-
books.find { |bb| bb.name == name }
|
102
|
-
end
|
103
|
-
|
104
|
-
def book_id(name)
|
105
|
-
book(name).id
|
106
|
-
end
|
107
|
-
|
108
|
-
def schools
|
109
|
-
@schools ||= School.all
|
110
|
-
end
|
111
|
-
|
112
|
-
def school_id(name)
|
113
|
-
school(name).try(:id)
|
114
|
-
end
|
115
|
-
|
116
|
-
def school(name)
|
117
|
-
schools.find { |ss| ss.name == name }
|
118
|
-
end
|
119
|
-
|
120
|
-
end
|
121
|
-
end
|
data/spec/client_spec.rb
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
|
3
|
-
RSpec.describe OpenStax::Salesforce::Client do
|
4
|
-
|
5
|
-
it 'raises when there is no SF user' do
|
6
|
-
allow(OpenStax::Salesforce::User).to receive(:first) { nil }
|
7
|
-
expect{ described_class.new }.to raise_error(OpenStax::Salesforce::UserMissing)
|
8
|
-
end
|
9
|
-
|
10
|
-
end
|
data/spec/dummy/README.md
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
== README
|
2
|
-
|
3
|
-
This README would normally document whatever steps are necessary to get the
|
4
|
-
application up and running.
|
5
|
-
|
6
|
-
Things you may want to cover:
|
7
|
-
|
8
|
-
* Ruby version
|
9
|
-
|
10
|
-
* System dependencies
|
11
|
-
|
12
|
-
* Configuration
|
13
|
-
|
14
|
-
* Database creation
|
15
|
-
|
16
|
-
* Database initialization
|
17
|
-
|
18
|
-
* How to run the test suite
|
19
|
-
|
20
|
-
* Services (job queues, cache servers, search engines, etc.)
|
21
|
-
|
22
|
-
* Deployment instructions
|
23
|
-
|
24
|
-
* ...
|
25
|
-
|
26
|
-
|
27
|
-
Please feel free to use a different markup language if you do not plan to run
|
28
|
-
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// compiled file.
|
9
|
-
//
|
10
|
-
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
-
// about supported directives.
|
12
|
-
//
|
13
|
-
//= require_tree .
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Dummy</title>
|
5
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
6
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
data/spec/dummy/bin/bundle
DELETED
data/spec/dummy/bin/rails
DELETED
data/spec/dummy/bin/rake
DELETED
data/spec/dummy/bin/setup
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require 'pathname'
|
3
|
-
|
4
|
-
# path to your application root.
|
5
|
-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
-
|
7
|
-
Dir.chdir APP_ROOT do
|
8
|
-
# This script is a starting point to setup your application.
|
9
|
-
# Add necessary setup steps to this file:
|
10
|
-
|
11
|
-
puts "== Installing dependencies =="
|
12
|
-
system "gem install bundler --conservative"
|
13
|
-
system "bundle check || bundle install"
|
14
|
-
|
15
|
-
# puts "\n== Copying sample files =="
|
16
|
-
# unless File.exist?("config/database.yml")
|
17
|
-
# system "cp config/database.yml.sample config/database.yml"
|
18
|
-
# end
|
19
|
-
|
20
|
-
puts "\n== Preparing database =="
|
21
|
-
system "bin/rake db:setup"
|
22
|
-
|
23
|
-
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system "rm -f log/*"
|
25
|
-
system "rm -rf tmp/cache"
|
26
|
-
|
27
|
-
puts "\n== Restarting application server =="
|
28
|
-
system "touch tmp/restart.txt"
|
29
|
-
end
|
data/spec/dummy/config.ru
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require File.expand_path('../boot', __FILE__)
|
2
|
-
|
3
|
-
require 'rails/all'
|
4
|
-
|
5
|
-
Bundler.require(*Rails.groups)
|
6
|
-
require "openstax_salesforce"
|
7
|
-
|
8
|
-
module Dummy
|
9
|
-
class Application < Rails::Application
|
10
|
-
# Initialize configuration defaults for originally generated Rails version.
|
11
|
-
config.load_defaults 5.2
|
12
|
-
|
13
|
-
# Settings in config/environments/* take precedence over those specified here.
|
14
|
-
# Application configuration should go into files in config/initializers
|
15
|
-
# -- all .rb files in that directory are automatically loaded.
|
16
|
-
|
17
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
18
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
19
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
20
|
-
|
21
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
22
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
23
|
-
# config.i18n.default_locale = :de
|
24
|
-
end
|
25
|
-
end
|
data/spec/dummy/config/boot.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite version 3.x
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem 'sqlite3'
|
6
|
-
#
|
7
|
-
default: &default
|
8
|
-
adapter: sqlite3
|
9
|
-
pool: 5
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
development:
|
13
|
-
<<: *default
|
14
|
-
database: db/development.sqlite3
|
15
|
-
|
16
|
-
# Warning: The database defined as "test" will be erased and
|
17
|
-
# re-generated from your development database when you run "rake".
|
18
|
-
# Do not set this db to the same as development or production.
|
19
|
-
test:
|
20
|
-
<<: *default
|
21
|
-
database: db/test.sqlite3
|
22
|
-
|
23
|
-
production:
|
24
|
-
<<: *default
|
25
|
-
database: db/production.sqlite3
|
@@ -1,41 +0,0 @@
|
|
1
|
-
Rails.application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
-
|
4
|
-
# In the development environment your application's code is reloaded on
|
5
|
-
# every request. This slows down response time but is perfect for development
|
6
|
-
# since you don't have to restart the web server when you make code changes.
|
7
|
-
config.cache_classes = false
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports and disable caching.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
config.action_controller.perform_caching = false
|
15
|
-
|
16
|
-
# Don't care if the mailer can't send.
|
17
|
-
config.action_mailer.raise_delivery_errors = false
|
18
|
-
|
19
|
-
# Print deprecation notices to the Rails logger.
|
20
|
-
config.active_support.deprecation = :log
|
21
|
-
|
22
|
-
# Raise an error on page load if there are pending migrations.
|
23
|
-
config.active_record.migration_error = :page_load
|
24
|
-
|
25
|
-
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
-
# This option may cause significant delays in view rendering with a large
|
27
|
-
# number of complex assets.
|
28
|
-
config.assets.debug = true
|
29
|
-
|
30
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
-
# yet still be able to expire them through the digest params.
|
32
|
-
config.assets.digest = true
|
33
|
-
|
34
|
-
# Adds additional error checking when serving assets at runtime.
|
35
|
-
# Checks for improperly declared sprockets dependencies.
|
36
|
-
# Raises helpful error messages.
|
37
|
-
config.assets.raise_runtime_errors = true
|
38
|
-
|
39
|
-
# Raises error for missing translations
|
40
|
-
# config.action_view.raise_on_missing_translations = true
|
41
|
-
end
|