workarea-salesforce_esp 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  3. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.github/workflows/ci.yml +54 -0
  6. data/.gitignore +24 -0
  7. data/.rubocop.yml +2 -0
  8. data/CHANGELOG.md +9 -0
  9. data/Gemfile +17 -0
  10. data/LICENSE +52 -0
  11. data/README.md +60 -0
  12. data/Rakefile +57 -0
  13. data/app/assets/config/salesforce_esp_manifest.js +0 -0
  14. data/app/assets/images/salesforce_esp/.keep +0 -0
  15. data/app/assets/javascripts/salesforce_esp/.keep +0 -0
  16. data/app/assets/stylesheets/salesforce_esp/.keep +0 -0
  17. data/app/controllers/.keep +0 -0
  18. data/app/helpers/.keep +0 -0
  19. data/app/mailers/.keep +0 -0
  20. data/app/models/.keep +0 -0
  21. data/app/views/.keep +0 -0
  22. data/app/workers/workarea/salesforce_esp/save_email_signup.rb +28 -0
  23. data/bin/rails +25 -0
  24. data/config/initializers/workarea.rb +6 -0
  25. data/config/routes.rb +2 -0
  26. data/lib/workarea/salesforce_esp.rb +55 -0
  27. data/lib/workarea/salesforce_esp/bogus_gateway.rb +33 -0
  28. data/lib/workarea/salesforce_esp/engine.rb +10 -0
  29. data/lib/workarea/salesforce_esp/gateway.rb +116 -0
  30. data/lib/workarea/salesforce_esp/response.rb +34 -0
  31. data/lib/workarea/salesforce_esp/subscriber.rb +15 -0
  32. data/lib/workarea/salesforce_esp/version.rb +5 -0
  33. data/test/dummy/.ruby-version +1 -0
  34. data/test/dummy/Rakefile +6 -0
  35. data/test/dummy/app/assets/config/manifest.js +3 -0
  36. data/test/dummy/app/assets/images/.keep +0 -0
  37. data/test/dummy/app/assets/javascripts/application.js +14 -0
  38. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  39. data/test/dummy/app/controllers/application_controller.rb +2 -0
  40. data/test/dummy/app/controllers/concerns/.keep +0 -0
  41. data/test/dummy/app/helpers/application_helper.rb +2 -0
  42. data/test/dummy/app/jobs/application_job.rb +2 -0
  43. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  44. data/test/dummy/app/models/concerns/.keep +0 -0
  45. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  46. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  47. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  48. data/test/dummy/bin/bundle +3 -0
  49. data/test/dummy/bin/rails +4 -0
  50. data/test/dummy/bin/rake +4 -0
  51. data/test/dummy/bin/setup +28 -0
  52. data/test/dummy/bin/update +28 -0
  53. data/test/dummy/bin/yarn +11 -0
  54. data/test/dummy/config.ru +5 -0
  55. data/test/dummy/config/application.rb +34 -0
  56. data/test/dummy/config/boot.rb +5 -0
  57. data/test/dummy/config/environment.rb +5 -0
  58. data/test/dummy/config/environments/development.rb +52 -0
  59. data/test/dummy/config/environments/production.rb +83 -0
  60. data/test/dummy/config/environments/test.rb +45 -0
  61. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  62. data/test/dummy/config/initializers/assets.rb +14 -0
  63. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  64. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  65. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  66. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  67. data/test/dummy/config/initializers/inflections.rb +16 -0
  68. data/test/dummy/config/initializers/mime_types.rb +4 -0
  69. data/test/dummy/config/initializers/workarea.rb +5 -0
  70. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  71. data/test/dummy/config/locales/en.yml +33 -0
  72. data/test/dummy/config/puma.rb +37 -0
  73. data/test/dummy/config/routes.rb +5 -0
  74. data/test/dummy/config/spring.rb +6 -0
  75. data/test/dummy/db/seeds.rb +2 -0
  76. data/test/dummy/lib/assets/.keep +0 -0
  77. data/test/dummy/log/.keep +0 -0
  78. data/test/dummy/package.json +5 -0
  79. data/test/gateways/gateway_test.rb +38 -0
  80. data/test/teaspoon_env.rb +6 -0
  81. data/test/test_helper.rb +10 -0
  82. data/workarea-salesforce_esp.gemspec +22 -0
  83. metadata +152 -0
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ mount Workarea::Core::Engine => '/'
3
+ mount Workarea::Admin::Engine => '/admin', as: 'admin'
4
+ mount Workarea::Storefront::Engine => '/', as: 'storefront'
5
+ end
@@ -0,0 +1,6 @@
1
+ %w[
2
+ .ruby-version
3
+ .rbenv-vars
4
+ tmp/restart.txt
5
+ tmp/caching-dev.txt
6
+ ].each { |path| Spring.watch(path) }
@@ -0,0 +1,2 @@
1
+ require 'workarea/seeds'
2
+ Workarea::Seeds.run
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "dummy",
3
+ "private": true,
4
+ "dependencies": {}
5
+ }
@@ -0,0 +1,38 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ class GatewayTest < TestCase
5
+ setup :set_gateway
6
+ setup :set_list_id
7
+
8
+ def set_gateway
9
+ @gateway = Workarea::SalesforceEsp.gateway
10
+ end
11
+
12
+ def set_list_id
13
+ @list_id = 856
14
+ end
15
+
16
+ def test_subscribe
17
+ email = 'uniquetest@weblinc.com'
18
+ Workarea.with_config do |config|
19
+ config.salesforce.default_list = '90'
20
+ config.salesforce.token_endpoint = 'https://mc2j61z17stbfqsy1m5qdm9x8rn4.auth.marketingcloudapis.com'
21
+
22
+ response = @gateway.subscribe(email, {}, @list_id)
23
+ assert_instance_of(SalesforceEsp::Response, response)
24
+ assert(response.success?)
25
+ end
26
+ end
27
+
28
+ def test_unsubscribe
29
+ email = 'unsubscribetest@weblinc.com'
30
+
31
+ subscribe = @gateway.subscribe(email, {}, @list_id)
32
+ assert(subscribe.success?)
33
+
34
+ unsubscribe = @gateway.unsubscribe(email, @list_id)
35
+ assert(unsubscribe.success?)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,6 @@
1
+ require 'workarea/testing/teaspoon'
2
+
3
+ Teaspoon.configure do |config|
4
+ config.root = Workarea::SalesforceEsp::Engine.root
5
+ Workarea::Teaspoon.apply(config)
6
+ end
@@ -0,0 +1,10 @@
1
+ # Configure Rails Environment
2
+ ENV['RAILS_ENV'] = 'test'
3
+
4
+ require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
5
+ require 'rails/test_help'
6
+ require 'workarea/test_help'
7
+
8
+ # Filter out Minitest backtrace while allowing backtrace from other libraries
9
+ # to be shown.
10
+ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
@@ -0,0 +1,22 @@
1
+ $:.push File.expand_path("lib", __dir__)
2
+
3
+ # Maintain your gem's version:
4
+ require "workarea/salesforce_esp/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "workarea-salesforce_esp"
9
+ spec.version = Workarea::SalesforceEsp::VERSION
10
+ spec.authors = ["Jeff Yucis"]
11
+ spec.email = ["jyucis@workarea.com"]
12
+ spec.homepage = "https://www.workarea.com/"
13
+ spec.summary = "Sales force cloud marketing integration"
14
+ spec.description = "Integration with sales force cloud marketing."
15
+ spec.license = "Business Software License"
16
+
17
+
18
+ spec.files = `git ls-files`.split("\n")
19
+
20
+ spec.add_dependency 'workarea', '~> 3.x'
21
+ spec.add_dependency 'sfmc-fuelsdk-ruby', '1.3.0'
22
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: workarea-salesforce_esp
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Yucis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: workarea
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.x
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.x
27
+ - !ruby/object:Gem::Dependency
28
+ name: sfmc-fuelsdk-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.0
41
+ description: Integration with sales force cloud marketing.
42
+ email:
43
+ - jyucis@workarea.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
49
+ - ".github/ISSUE_TEMPLATE/documentation-request.md"
50
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
51
+ - ".github/workflows/ci.yml"
52
+ - ".gitignore"
53
+ - ".rubocop.yml"
54
+ - CHANGELOG.md
55
+ - Gemfile
56
+ - LICENSE
57
+ - README.md
58
+ - Rakefile
59
+ - app/assets/config/salesforce_esp_manifest.js
60
+ - app/assets/images/salesforce_esp/.keep
61
+ - app/assets/javascripts/salesforce_esp/.keep
62
+ - app/assets/stylesheets/salesforce_esp/.keep
63
+ - app/controllers/.keep
64
+ - app/helpers/.keep
65
+ - app/mailers/.keep
66
+ - app/models/.keep
67
+ - app/views/.keep
68
+ - app/workers/workarea/salesforce_esp/save_email_signup.rb
69
+ - bin/rails
70
+ - config/initializers/workarea.rb
71
+ - config/routes.rb
72
+ - lib/workarea/salesforce_esp.rb
73
+ - lib/workarea/salesforce_esp/bogus_gateway.rb
74
+ - lib/workarea/salesforce_esp/engine.rb
75
+ - lib/workarea/salesforce_esp/gateway.rb
76
+ - lib/workarea/salesforce_esp/response.rb
77
+ - lib/workarea/salesforce_esp/subscriber.rb
78
+ - lib/workarea/salesforce_esp/version.rb
79
+ - test/dummy/.ruby-version
80
+ - test/dummy/Rakefile
81
+ - test/dummy/app/assets/config/manifest.js
82
+ - test/dummy/app/assets/images/.keep
83
+ - test/dummy/app/assets/javascripts/application.js
84
+ - test/dummy/app/assets/stylesheets/application.css
85
+ - test/dummy/app/controllers/application_controller.rb
86
+ - test/dummy/app/controllers/concerns/.keep
87
+ - test/dummy/app/helpers/application_helper.rb
88
+ - test/dummy/app/jobs/application_job.rb
89
+ - test/dummy/app/mailers/application_mailer.rb
90
+ - test/dummy/app/models/concerns/.keep
91
+ - test/dummy/app/views/layouts/application.html.erb
92
+ - test/dummy/app/views/layouts/mailer.html.erb
93
+ - test/dummy/app/views/layouts/mailer.text.erb
94
+ - test/dummy/bin/bundle
95
+ - test/dummy/bin/rails
96
+ - test/dummy/bin/rake
97
+ - test/dummy/bin/setup
98
+ - test/dummy/bin/update
99
+ - test/dummy/bin/yarn
100
+ - test/dummy/config.ru
101
+ - test/dummy/config/application.rb
102
+ - test/dummy/config/boot.rb
103
+ - test/dummy/config/environment.rb
104
+ - test/dummy/config/environments/development.rb
105
+ - test/dummy/config/environments/production.rb
106
+ - test/dummy/config/environments/test.rb
107
+ - test/dummy/config/initializers/application_controller_renderer.rb
108
+ - test/dummy/config/initializers/assets.rb
109
+ - test/dummy/config/initializers/backtrace_silencers.rb
110
+ - test/dummy/config/initializers/content_security_policy.rb
111
+ - test/dummy/config/initializers/cookies_serializer.rb
112
+ - test/dummy/config/initializers/filter_parameter_logging.rb
113
+ - test/dummy/config/initializers/inflections.rb
114
+ - test/dummy/config/initializers/mime_types.rb
115
+ - test/dummy/config/initializers/workarea.rb
116
+ - test/dummy/config/initializers/wrap_parameters.rb
117
+ - test/dummy/config/locales/en.yml
118
+ - test/dummy/config/puma.rb
119
+ - test/dummy/config/routes.rb
120
+ - test/dummy/config/spring.rb
121
+ - test/dummy/db/seeds.rb
122
+ - test/dummy/lib/assets/.keep
123
+ - test/dummy/log/.keep
124
+ - test/dummy/package.json
125
+ - test/gateways/gateway_test.rb
126
+ - test/teaspoon_env.rb
127
+ - test/test_helper.rb
128
+ - workarea-salesforce_esp.gemspec
129
+ homepage: https://www.workarea.com/
130
+ licenses:
131
+ - Business Software License
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubygems_version: 3.0.3
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: Sales force cloud marketing integration
152
+ test_files: []