workarea-zendesk 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) 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 +22 -0
  7. data/.rubocop.yml +3 -0
  8. data/CHANGELOG.md +13 -0
  9. data/Gemfile +15 -0
  10. data/LICENSE +52 -0
  11. data/README.md +73 -0
  12. data/Rakefile +57 -0
  13. data/app/assets/images/zendesk/.keep +0 -0
  14. data/app/assets/javascripts/zendesk/.keep +0 -0
  15. data/app/assets/stylesheets/zendesk/.keep +0 -0
  16. data/app/controllers/.keep +0 -0
  17. data/app/helpers/.keep +0 -0
  18. data/app/lib/workarea/zendesk/bogus_gateway.rb +57 -0
  19. data/app/lib/workarea/zendesk/gateway.rb +53 -0
  20. data/app/lib/workarea/zendesk/response.rb +27 -0
  21. data/app/mailers/.keep +0 -0
  22. data/app/models/.keep +0 -0
  23. data/app/views/workarea/storefront/_zendesk_web_widget.html.haml +2 -0
  24. data/app/workers/zendesk/create_inquiry_request.rb +46 -0
  25. data/bin/rails +25 -0
  26. data/config/initializers/append_points.rb +4 -0
  27. data/config/initializers/workarea.rb +8 -0
  28. data/config/routes.rb +2 -0
  29. data/lib/workarea/zendesk.rb +38 -0
  30. data/lib/workarea/zendesk/engine.rb +10 -0
  31. data/lib/workarea/zendesk/version.rb +5 -0
  32. data/test/dummy/.ruby-version +1 -0
  33. data/test/dummy/Rakefile +6 -0
  34. data/test/dummy/app/assets/config/manifest.js +3 -0
  35. data/test/dummy/app/assets/images/.keep +0 -0
  36. data/test/dummy/app/assets/javascripts/application.js +14 -0
  37. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  38. data/test/dummy/app/controllers/application_controller.rb +2 -0
  39. data/test/dummy/app/controllers/concerns/.keep +0 -0
  40. data/test/dummy/app/helpers/application_helper.rb +2 -0
  41. data/test/dummy/app/jobs/application_job.rb +2 -0
  42. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  43. data/test/dummy/app/models/concerns/.keep +0 -0
  44. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  45. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  46. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  47. data/test/dummy/bin/bundle +3 -0
  48. data/test/dummy/bin/rails +4 -0
  49. data/test/dummy/bin/rake +4 -0
  50. data/test/dummy/bin/setup +25 -0
  51. data/test/dummy/bin/update +25 -0
  52. data/test/dummy/config.ru +5 -0
  53. data/test/dummy/config/application.rb +34 -0
  54. data/test/dummy/config/boot.rb +5 -0
  55. data/test/dummy/config/environment.rb +5 -0
  56. data/test/dummy/config/environments/development.rb +52 -0
  57. data/test/dummy/config/environments/production.rb +83 -0
  58. data/test/dummy/config/environments/test.rb +45 -0
  59. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  60. data/test/dummy/config/initializers/assets.rb +12 -0
  61. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  62. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  63. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  64. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  65. data/test/dummy/config/initializers/inflections.rb +16 -0
  66. data/test/dummy/config/initializers/mime_types.rb +4 -0
  67. data/test/dummy/config/initializers/workarea.rb +5 -0
  68. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  69. data/test/dummy/config/locales/en.yml +33 -0
  70. data/test/dummy/config/puma.rb +34 -0
  71. data/test/dummy/config/routes.rb +5 -0
  72. data/test/dummy/config/spring.rb +6 -0
  73. data/test/dummy/db/seeds.rb +2 -0
  74. data/test/dummy/lib/assets/.keep +0 -0
  75. data/test/dummy/log/.keep +0 -0
  76. data/test/integration/workarea/storefront/zendesk_integration_test.rb +24 -0
  77. data/test/lib/workarea/zendesk/gateway_test.rb +64 -0
  78. data/test/support/workarea/zendesk_api_config.rb +19 -0
  79. data/test/teaspoon_env.rb +6 -0
  80. data/test/test_helper.rb +10 -0
  81. data/test/vcr_cassettes/zendesk/create_request.yml +87 -0
  82. data/test/vcr_cassettes/zendesk/create_request_error.yml +81 -0
  83. data/workarea-zendesk.gemspec +20 -0
  84. metadata +139 -0
@@ -0,0 +1,19 @@
1
+ module Workarea
2
+ module ZendeskApiConfig
3
+ extend ActiveSupport::Concern
4
+ included do
5
+ setup do
6
+ @_old_creds = Rails.application.secrets.zendesk
7
+
8
+ Rails.application.secrets.zendesk = {
9
+ api_user_name: "email@example.com",
10
+ api_token: "yourtoken"
11
+ }
12
+ end
13
+
14
+ teardown do
15
+ Rails.application.secrets.zendesk = @_old_creds
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,6 @@
1
+ require 'workarea/testing/teaspoon'
2
+
3
+ Teaspoon.configure do |config|
4
+ config.root = Workarea::Zendesk::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,87 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://d3v-5752.zendesk.com/api/v2/requests.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"request":{"requester":{"name":"Bob Clams","email":"bclams@workarea.com"},"subject":"TEST
9
+ IGNORE ME","comment":{"body":"I''ve crashed my car on the internet super highway"}}}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ Authorization:
14
+ - Basic ZW1haWxAZXhhbXBsZS5jb20vdG9rZW46eW91cnRva2Vu
15
+ User-Agent:
16
+ - Faraday v0.15.4
17
+ Accept-Encoding:
18
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
19
+ Accept:
20
+ - "*/*"
21
+ response:
22
+ status:
23
+ code: 201
24
+ message: Created
25
+ headers:
26
+ Date:
27
+ - Mon, 14 Oct 2019 19:31:26 GMT
28
+ Content-Type:
29
+ - application/json; charset=UTF-8
30
+ Content-Length:
31
+ - '627'
32
+ Connection:
33
+ - keep-alive
34
+ Set-Cookie:
35
+ - __cfduid=d6497774e4367efb1dce1118376d8c70d1571081485; expires=Tue, 13-Oct-20
36
+ 19:31:25 GMT; path=/; domain=.d3v-5752.zendesk.com; HttpOnly
37
+ - __cfruid=7c507406e9a3d5e18ec7690fedd6290e176f8f51-1571081486; path=/; domain=.d3v-5752.zendesk.com;
38
+ HttpOnly
39
+ X-Zendesk-Api-Version:
40
+ - v2
41
+ X-Zendesk-Application-Version:
42
+ - v3010.64
43
+ X-Frame-Options:
44
+ - SAMEORIGIN
45
+ Location:
46
+ - https://d3v-5752.zendesk.com/api/v2/requests/33.json
47
+ Access-Control-Allow-Origin:
48
+ - "*"
49
+ Access-Control-Allow-Credentials:
50
+ - 'true'
51
+ Access-Control-Expose-Headers:
52
+ - X-Zendesk-API-Warn,X-Zendesk-User-Id,X-Zendesk-User-Session-Expires-At
53
+ X-Rate-Limit:
54
+ - '700'
55
+ X-Rate-Limit-Remaining:
56
+ - '700'
57
+ Strict-Transport-Security:
58
+ - max-age=31536000;
59
+ Etag:
60
+ - W/"bbd5d2a43f0cc508b6fb70b7cb1039cb"
61
+ Cache-Control:
62
+ - max-age=0, private, must-revalidate
63
+ X-Zendesk-Origin-Server:
64
+ - classic-app-server-79686774f-mfjl2
65
+ X-Request-Id:
66
+ - 525bf932eab1e6bc-EWR
67
+ X-Runtime:
68
+ - '0.891358'
69
+ X-Zendesk-Request-Id:
70
+ - e6f89e3c3d4d6cf79f53
71
+ X-Content-Type-Options:
72
+ - nosniff
73
+ Cf-Cache-Status:
74
+ - DYNAMIC
75
+ Expect-Ct:
76
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
77
+ Server:
78
+ - cloudflare
79
+ Cf-Ray:
80
+ - 525bf932eab1e6bc-EWR
81
+ body:
82
+ encoding: UTF-8
83
+ string: '{"request":{"url":"https://d3v-5752.zendesk.com/api/v2/requests/33.json","id":33,"status":"new","priority":null,"type":null,"subject":"TEST
84
+ IGNORE ME","description":"I''ve crashed my car on the internet super highway","organization_id":null,"via":{"channel":"api","source":{"from":{},"to":{},"rel":null}},"custom_fields":[],"requester_id":388560052351,"collaborator_ids":[],"email_cc_ids":[],"is_public":true,"due_at":null,"can_be_solved_by_me":false,"created_at":"2019-10-14T19:31:26Z","updated_at":"2019-10-14T19:31:26Z","recipient":null,"followup_source_id":null,"assignee_id":null,"ticket_form_id":360000438171,"fields":[]}}'
85
+ http_version:
86
+ recorded_at: Mon, 14 Oct 2019 19:31:26 GMT
87
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,81 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://d3v-5752.zendesk.com/api/v2/requests.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"request":{"requester":{"name":"Bob Clams","email":"bclams"},"subject":"TEST
9
+ IGNORE ME","comment":{"body":"I''ve crashed my car on the internet super highway"}}}'
10
+ headers:
11
+ Content-Type:
12
+ - application/json
13
+ Authorization:
14
+ - Basic ZW1haWxAZXhhbXBsZS5jb20vdG9rZW46eW91cnRva2Vu
15
+ User-Agent:
16
+ - Faraday v0.15.4
17
+ Accept-Encoding:
18
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
19
+ Accept:
20
+ - "*/*"
21
+ response:
22
+ status:
23
+ code: 422
24
+ message: Unprocessable Entity
25
+ headers:
26
+ Date:
27
+ - Tue, 15 Oct 2019 14:15:09 GMT
28
+ Content-Type:
29
+ - application/json; charset=UTF-8
30
+ Content-Length:
31
+ - '162'
32
+ Connection:
33
+ - keep-alive
34
+ Set-Cookie:
35
+ - __cfduid=d81f79bd0a9dbd53f19d0d9282c20653f1571148908; expires=Wed, 14-Oct-20
36
+ 14:15:08 GMT; path=/; domain=.d3v-5752.zendesk.com; HttpOnly
37
+ - __cfruid=75c894c17d0112b304d5b1fc416e3bf506914b22-1571148909; path=/; domain=.d3v-5752.zendesk.com;
38
+ HttpOnly
39
+ X-Zendesk-Api-Version:
40
+ - v2
41
+ X-Zendesk-Application-Version:
42
+ - v3010.65
43
+ X-Frame-Options:
44
+ - SAMEORIGIN
45
+ Access-Control-Allow-Origin:
46
+ - "*"
47
+ Access-Control-Allow-Credentials:
48
+ - 'true'
49
+ Access-Control-Expose-Headers:
50
+ - X-Zendesk-API-Warn,X-Zendesk-User-Id,X-Zendesk-User-Session-Expires-At
51
+ X-Rate-Limit:
52
+ - '700'
53
+ X-Rate-Limit-Remaining:
54
+ - '700'
55
+ Strict-Transport-Security:
56
+ - max-age=31536000;
57
+ Cache-Control:
58
+ - no-cache
59
+ X-Zendesk-Origin-Server:
60
+ - classic-app-server-569cc7685d-d7z64
61
+ X-Request-Id:
62
+ - 526267471cc6924c-SEA
63
+ X-Runtime:
64
+ - '0.478911'
65
+ X-Zendesk-Request-Id:
66
+ - 96be25382f09a3a1892d
67
+ Cf-Cache-Status:
68
+ - DYNAMIC
69
+ Expect-Ct:
70
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
71
+ Server:
72
+ - cloudflare
73
+ Cf-Ray:
74
+ - 526267471cc6924c-EWR
75
+ body:
76
+ encoding: UTF-8
77
+ string: '{"error":"RecordInvalid","description":"Record validation errors","details":{"requester":[{"description":"Requester:
78
+ Email: bclams is not properly formatted"}]}}'
79
+ http_version:
80
+ recorded_at: Tue, 15 Oct 2019 14:15:09 GMT
81
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path("lib", __dir__)
2
+
3
+ # Maintain your gem's version:
4
+ require "workarea/zendesk/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "workarea-zendesk"
9
+ spec.version = Workarea::Zendesk::VERSION
10
+ spec.authors = ["Jeff Yucis"]
11
+ spec.email = ["jyucis@workarea.com"]
12
+ spec.homepage = "https://github.com/workarea-commerce/workarea-zendesk"
13
+ spec.summary = "Zendesk Integration for Workarea Commerce"
14
+ spec.description = "Zendesk Help Desk integration for workarea commerce"
15
+ spec.license = "Business Software License"
16
+
17
+ spec.files = `git ls-files`.split("\n")
18
+
19
+ spec.add_dependency 'workarea', '~> 3.x'
20
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: workarea-zendesk
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: 2019-10-30 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
+ description: Zendesk Help Desk integration for workarea commerce
28
+ email:
29
+ - jyucis@workarea.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
35
+ - ".github/ISSUE_TEMPLATE/documentation-request.md"
36
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
37
+ - ".github/workflows/ci.yml"
38
+ - ".gitignore"
39
+ - ".rubocop.yml"
40
+ - CHANGELOG.md
41
+ - Gemfile
42
+ - LICENSE
43
+ - README.md
44
+ - Rakefile
45
+ - app/assets/images/zendesk/.keep
46
+ - app/assets/javascripts/zendesk/.keep
47
+ - app/assets/stylesheets/zendesk/.keep
48
+ - app/controllers/.keep
49
+ - app/helpers/.keep
50
+ - app/lib/workarea/zendesk/bogus_gateway.rb
51
+ - app/lib/workarea/zendesk/gateway.rb
52
+ - app/lib/workarea/zendesk/response.rb
53
+ - app/mailers/.keep
54
+ - app/models/.keep
55
+ - app/views/workarea/storefront/_zendesk_web_widget.html.haml
56
+ - app/workers/zendesk/create_inquiry_request.rb
57
+ - bin/rails
58
+ - config/initializers/append_points.rb
59
+ - config/initializers/workarea.rb
60
+ - config/routes.rb
61
+ - lib/workarea/zendesk.rb
62
+ - lib/workarea/zendesk/engine.rb
63
+ - lib/workarea/zendesk/version.rb
64
+ - test/dummy/.ruby-version
65
+ - test/dummy/Rakefile
66
+ - test/dummy/app/assets/config/manifest.js
67
+ - test/dummy/app/assets/images/.keep
68
+ - test/dummy/app/assets/javascripts/application.js
69
+ - test/dummy/app/assets/stylesheets/application.css
70
+ - test/dummy/app/controllers/application_controller.rb
71
+ - test/dummy/app/controllers/concerns/.keep
72
+ - test/dummy/app/helpers/application_helper.rb
73
+ - test/dummy/app/jobs/application_job.rb
74
+ - test/dummy/app/mailers/application_mailer.rb
75
+ - test/dummy/app/models/concerns/.keep
76
+ - test/dummy/app/views/layouts/application.html.erb
77
+ - test/dummy/app/views/layouts/mailer.html.erb
78
+ - test/dummy/app/views/layouts/mailer.text.erb
79
+ - test/dummy/bin/bundle
80
+ - test/dummy/bin/rails
81
+ - test/dummy/bin/rake
82
+ - test/dummy/bin/setup
83
+ - test/dummy/bin/update
84
+ - test/dummy/config.ru
85
+ - test/dummy/config/application.rb
86
+ - test/dummy/config/boot.rb
87
+ - test/dummy/config/environment.rb
88
+ - test/dummy/config/environments/development.rb
89
+ - test/dummy/config/environments/production.rb
90
+ - test/dummy/config/environments/test.rb
91
+ - test/dummy/config/initializers/application_controller_renderer.rb
92
+ - test/dummy/config/initializers/assets.rb
93
+ - test/dummy/config/initializers/backtrace_silencers.rb
94
+ - test/dummy/config/initializers/content_security_policy.rb
95
+ - test/dummy/config/initializers/cookies_serializer.rb
96
+ - test/dummy/config/initializers/filter_parameter_logging.rb
97
+ - test/dummy/config/initializers/inflections.rb
98
+ - test/dummy/config/initializers/mime_types.rb
99
+ - test/dummy/config/initializers/workarea.rb
100
+ - test/dummy/config/initializers/wrap_parameters.rb
101
+ - test/dummy/config/locales/en.yml
102
+ - test/dummy/config/puma.rb
103
+ - test/dummy/config/routes.rb
104
+ - test/dummy/config/spring.rb
105
+ - test/dummy/db/seeds.rb
106
+ - test/dummy/lib/assets/.keep
107
+ - test/dummy/log/.keep
108
+ - test/integration/workarea/storefront/zendesk_integration_test.rb
109
+ - test/lib/workarea/zendesk/gateway_test.rb
110
+ - test/support/workarea/zendesk_api_config.rb
111
+ - test/teaspoon_env.rb
112
+ - test/test_helper.rb
113
+ - test/vcr_cassettes/zendesk/create_request.yml
114
+ - test/vcr_cassettes/zendesk/create_request_error.yml
115
+ - workarea-zendesk.gemspec
116
+ homepage: https://github.com/workarea-commerce/workarea-zendesk
117
+ licenses:
118
+ - Business Software License
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubygems_version: 3.0.6
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Zendesk Integration for Workarea Commerce
139
+ test_files: []