hubspot-api-client 7.0.0 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/hubspot/version.rb +1 -1
  4. data/sample-apps/trello-integration-app/.env.template +7 -0
  5. data/sample-apps/trello-integration-app/.gitignore +35 -0
  6. data/sample-apps/trello-integration-app/.rspec +1 -0
  7. data/sample-apps/trello-integration-app/.ruby-version +1 -0
  8. data/sample-apps/trello-integration-app/Dockerfile +22 -0
  9. data/sample-apps/trello-integration-app/Gemfile +38 -0
  10. data/sample-apps/trello-integration-app/Gemfile.lock +314 -0
  11. data/sample-apps/trello-integration-app/README.md +31 -0
  12. data/sample-apps/trello-integration-app/Rakefile +6 -0
  13. data/sample-apps/trello-integration-app/app/assets/config/manifest.js +3 -0
  14. data/sample-apps/trello-integration-app/app/assets/images/.keep +0 -0
  15. data/sample-apps/trello-integration-app/app/assets/images/right-arrow.png +0 -0
  16. data/sample-apps/trello-integration-app/app/assets/javascripts/application.js +22 -0
  17. data/sample-apps/trello-integration-app/app/assets/javascripts/cable.js +13 -0
  18. data/sample-apps/trello-integration-app/app/assets/javascripts/channels/.keep +0 -0
  19. data/sample-apps/trello-integration-app/app/assets/javascripts/jquery-spinner.min.js +11071 -0
  20. data/sample-apps/trello-integration-app/app/assets/javascripts/lodash.js +15972 -0
  21. data/sample-apps/trello-integration-app/app/assets/javascripts/mappings.js +78 -0
  22. data/sample-apps/trello-integration-app/app/assets/javascripts/typeahead.bundle.min.js +8 -0
  23. data/sample-apps/trello-integration-app/app/assets/stylesheets/application.css +46 -0
  24. data/sample-apps/trello-integration-app/app/assets/stylesheets/authorization.scss +34 -0
  25. data/sample-apps/trello-integration-app/app/assets/stylesheets/jquery-spinner.css +33 -0
  26. data/sample-apps/trello-integration-app/app/assets/stylesheets/mappings.scss +55 -0
  27. data/sample-apps/trello-integration-app/app/assets/stylesheets/navigation.scss +43 -0
  28. data/sample-apps/trello-integration-app/app/assets/stylesheets/search_frame.scss +81 -0
  29. data/sample-apps/trello-integration-app/app/controllers/application_controller.rb +38 -0
  30. data/sample-apps/trello-integration-app/app/controllers/concerns/.keep +0 -0
  31. data/sample-apps/trello-integration-app/app/controllers/concerns/exception_handler.rb +12 -0
  32. data/sample-apps/trello-integration-app/app/controllers/home_controller.rb +20 -0
  33. data/sample-apps/trello-integration-app/app/controllers/mappings_controller.rb +64 -0
  34. data/sample-apps/trello-integration-app/app/controllers/oauth/authorization_controller.rb +28 -0
  35. data/sample-apps/trello-integration-app/app/controllers/trello/cards_controller.rb +94 -0
  36. data/sample-apps/trello-integration-app/app/controllers/trello/webhooks_controller.rb +30 -0
  37. data/sample-apps/trello-integration-app/app/helpers/application_helper.rb +2 -0
  38. data/sample-apps/trello-integration-app/app/helpers/oauth/authorization_helper.rb +11 -0
  39. data/sample-apps/trello-integration-app/app/lib/services/hubspot/authorization/authorize.rb +17 -0
  40. data/sample-apps/trello-integration-app/app/lib/services/hubspot/authorization/get_authorization_uri.rb +35 -0
  41. data/sample-apps/trello-integration-app/app/lib/services/hubspot/authorization/tokens/base.rb +21 -0
  42. data/sample-apps/trello-integration-app/app/lib/services/hubspot/authorization/tokens/generate.rb +28 -0
  43. data/sample-apps/trello-integration-app/app/lib/services/hubspot/authorization/tokens/refresh.rb +35 -0
  44. data/sample-apps/trello-integration-app/app/lib/services/hubspot/deals/get_by_id.rb +15 -0
  45. data/sample-apps/trello-integration-app/app/lib/services/hubspot/deals/update.rb +17 -0
  46. data/sample-apps/trello-integration-app/app/lib/services/hubspot/extensions_cards/create.rb +82 -0
  47. data/sample-apps/trello-integration-app/app/lib/services/hubspot/pipelines/get_all.rb +11 -0
  48. data/sample-apps/trello-integration-app/app/lib/services/hubspot/pipelines/get_by_id.rb +15 -0
  49. data/sample-apps/trello-integration-app/app/lib/services/trello/authorization/authorize.rb +20 -0
  50. data/sample-apps/trello-integration-app/app/lib/services/trello/boards/get_all.rb +11 -0
  51. data/sample-apps/trello-integration-app/app/lib/services/trello/boards/get_by_id.rb +19 -0
  52. data/sample-apps/trello-integration-app/app/lib/services/trello/cards/format.rb +78 -0
  53. data/sample-apps/trello-integration-app/app/lib/services/trello/cards/get_by_id.rb +15 -0
  54. data/sample-apps/trello-integration-app/app/lib/services/trello/cards/search.rb +15 -0
  55. data/sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb +31 -0
  56. data/sample-apps/trello-integration-app/app/lib/services/trello/webhooks/delete.rb +17 -0
  57. data/sample-apps/trello-integration-app/app/lib/services/trello/webhooks/update.rb +19 -0
  58. data/sample-apps/trello-integration-app/app/models/application_record.rb +3 -0
  59. data/sample-apps/trello-integration-app/app/models/concerns/.keep +0 -0
  60. data/sample-apps/trello-integration-app/app/models/deal_association.rb +2 -0
  61. data/sample-apps/trello-integration-app/app/models/extension_card.rb +4 -0
  62. data/sample-apps/trello-integration-app/app/models/hubspot_token.rb +19 -0
  63. data/sample-apps/trello-integration-app/app/models/mapping.rb +2 -0
  64. data/sample-apps/trello-integration-app/app/models/trello_token.rb +19 -0
  65. data/sample-apps/trello-integration-app/app/models/webhook.rb +2 -0
  66. data/sample-apps/trello-integration-app/app/views/home/index.html.erb +23 -0
  67. data/sample-apps/trello-integration-app/app/views/home/success.html.erb +11 -0
  68. data/sample-apps/trello-integration-app/app/views/layouts/application.html.erb +23 -0
  69. data/sample-apps/trello-integration-app/app/views/mappings/_mapping.html.erb +13 -0
  70. data/sample-apps/trello-integration-app/app/views/mappings/index.html.erb +44 -0
  71. data/sample-apps/trello-integration-app/app/views/oauth/authorization/login.html.erb +42 -0
  72. data/sample-apps/trello-integration-app/app/views/shared/_header.html.erb +15 -0
  73. data/sample-apps/trello-integration-app/app/views/trello/cards/search_frame.html.erb +69 -0
  74. data/sample-apps/trello-integration-app/app/views/trello/cards/search_frame_success.html.erb +7 -0
  75. data/sample-apps/trello-integration-app/bin/bundle +3 -0
  76. data/sample-apps/trello-integration-app/bin/rails +9 -0
  77. data/sample-apps/trello-integration-app/bin/rake +9 -0
  78. data/sample-apps/trello-integration-app/bin/setup +36 -0
  79. data/sample-apps/trello-integration-app/bin/spring +17 -0
  80. data/sample-apps/trello-integration-app/bin/update +31 -0
  81. data/sample-apps/trello-integration-app/bin/yarn +11 -0
  82. data/sample-apps/trello-integration-app/config.ru +5 -0
  83. data/sample-apps/trello-integration-app/config/application.rb +20 -0
  84. data/sample-apps/trello-integration-app/config/boot.rb +3 -0
  85. data/sample-apps/trello-integration-app/config/cable.yml +10 -0
  86. data/sample-apps/trello-integration-app/config/database.yml +16 -0
  87. data/sample-apps/trello-integration-app/config/environment.rb +5 -0
  88. data/sample-apps/trello-integration-app/config/environments/development.rb +61 -0
  89. data/sample-apps/trello-integration-app/config/environments/production.rb +94 -0
  90. data/sample-apps/trello-integration-app/config/environments/test.rb +46 -0
  91. data/sample-apps/trello-integration-app/config/initializers/assets.rb +14 -0
  92. data/sample-apps/trello-integration-app/config/initializers/filter_parameter_logging.rb +4 -0
  93. data/sample-apps/trello-integration-app/config/initializers/hubspot-api-client.rb +3 -0
  94. data/sample-apps/trello-integration-app/config/initializers/mime_types.rb +1 -0
  95. data/sample-apps/trello-integration-app/config/initializers/omniauth.rb +11 -0
  96. data/sample-apps/trello-integration-app/config/initializers/trello.rb +1 -0
  97. data/sample-apps/trello-integration-app/config/initializers/wrap_parameters.rb +14 -0
  98. data/sample-apps/trello-integration-app/config/locales/en.yml +33 -0
  99. data/sample-apps/trello-integration-app/config/puma.rb +34 -0
  100. data/sample-apps/trello-integration-app/config/routes.rb +29 -0
  101. data/sample-apps/trello-integration-app/config/spring.rb +6 -0
  102. data/sample-apps/trello-integration-app/config/storage.yml +34 -0
  103. data/sample-apps/trello-integration-app/db/migrate/20200624132327_create_hubspot_tokens.rb +10 -0
  104. data/sample-apps/trello-integration-app/db/migrate/20200624132336_create_trello_tokens.rb +8 -0
  105. data/sample-apps/trello-integration-app/db/migrate/20200624132337_create_deal_associations.rb +8 -0
  106. data/sample-apps/trello-integration-app/db/migrate/20200702130530_create_extension_cards.rb +8 -0
  107. data/sample-apps/trello-integration-app/db/migrate/20200715143913_create_mappings.rb +12 -0
  108. data/sample-apps/trello-integration-app/db/migrate/20200727083656_create_webhooks.rb +9 -0
  109. data/sample-apps/trello-integration-app/db/schema.rb +52 -0
  110. data/sample-apps/trello-integration-app/db/seeds.rb +7 -0
  111. data/sample-apps/trello-integration-app/docker-compose.yml +41 -0
  112. data/sample-apps/trello-integration-app/docker-entrypoint.sh +8 -0
  113. data/sample-apps/trello-integration-app/lib/assets/.keep +0 -0
  114. data/sample-apps/trello-integration-app/lib/middlewares/trello_payload_params_handler.rb +18 -0
  115. data/sample-apps/trello-integration-app/lib/tasks/.keep +0 -0
  116. data/sample-apps/trello-integration-app/log/.keep +0 -0
  117. data/sample-apps/trello-integration-app/package.json +5 -0
  118. data/sample-apps/trello-integration-app/public/404.html +67 -0
  119. data/sample-apps/trello-integration-app/public/422.html +67 -0
  120. data/sample-apps/trello-integration-app/public/500.html +66 -0
  121. data/sample-apps/trello-integration-app/public/favicon.ico +0 -0
  122. data/sample-apps/trello-integration-app/public/robots.txt +1 -0
  123. data/sample-apps/trello-integration-app/tmp/.keep +0 -0
  124. metadata +218 -2
@@ -0,0 +1,46 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure public file server for tests with Cache-Control for performance.
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = {
18
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19
+ }
20
+
21
+ # Show full error reports and disable caching.
22
+ config.consider_all_requests_local = true
23
+ config.action_controller.perform_caching = false
24
+
25
+ # Raise exceptions instead of rendering exception templates.
26
+ config.action_dispatch.show_exceptions = false
27
+
28
+ # Disable request forgery protection in test environment.
29
+ config.action_controller.allow_forgery_protection = false
30
+
31
+ # Store uploaded files on the local file system in a temporary directory
32
+ config.active_storage.service = :test
33
+
34
+ config.action_mailer.perform_caching = false
35
+
36
+ # Tell Action Mailer not to deliver emails to the real world.
37
+ # The :test delivery method accumulates sent emails in the
38
+ # ActionMailer::Base.deliveries array.
39
+ config.action_mailer.delivery_method = :test
40
+
41
+ # Print deprecation notices to the stderr.
42
+ config.active_support.deprecation = :stderr
43
+
44
+ # Raises error for missing translations
45
+ # config.action_view.raise_on_missing_translations = true
46
+ end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path.
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+ # Add Yarn node_modules folder to the asset load path.
9
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,3 @@
1
+ ::Hubspot.configure do |config|
2
+ config.api_key = { 'hapikey' => ENV['HUBSPOT_DEVELOPER_API_KEY'] }
3
+ end
@@ -0,0 +1 @@
1
+ Mime::Type.register "text/csv", :csv
@@ -0,0 +1,11 @@
1
+ Rails.application.config.middleware.use OmniAuth::Builder do
2
+ provider(
3
+ :trello,
4
+ ENV['TRELLO_KEY'],
5
+ ENV['TRELLO_SECRET'],
6
+ app_name: "test",
7
+ scope: 'read,write,account',
8
+ expiration: 'never',
9
+ callback_path: '/oauth/trello_callback'
10
+ )
11
+ end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,33 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at http://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
@@ -0,0 +1,34 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ threads threads_count, threads_count
9
+
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
+ #
12
+ port ENV.fetch("PORT") { 3000 }
13
+
14
+ # Specifies the `environment` that Puma will run in.
15
+ #
16
+ environment ENV.fetch("RAILS_ENV") { "development" }
17
+
18
+ # Specifies the number of `workers` to boot in clustered mode.
19
+ # Workers are forked webserver processes. If using threads and workers together
20
+ # the concurrency of the application would be max `threads` * `workers`.
21
+ # Workers do not work on JRuby or Windows (both of which do not support
22
+ # processes).
23
+ #
24
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25
+
26
+ # Use the `preload_app!` method when specifying a `workers` number.
27
+ # This directive tells Puma to first boot the application and load code
28
+ # before forking the application. This takes advantage of Copy On Write
29
+ # process behavior so workers use less memory.
30
+ #
31
+ # preload_app!
32
+
33
+ # Allow puma to be restarted by `rails restart` command.
34
+ plugin :tmp_restart
@@ -0,0 +1,29 @@
1
+ Rails.application.routes.draw do
2
+ namespace :trello do
3
+ resources :cards, only: %i(index) do
4
+ collection do
5
+ get 'search'
6
+ get 'search_frame'
7
+ get 'search_frame_success'
8
+ delete 'delete_association'
9
+ end
10
+ end
11
+ post 'cards/search_frame', to: 'cards#create_association'
12
+ get 'cards', to: 'cards#index'
13
+
14
+ post '/webhooks', to: 'webhooks#receive'
15
+ get '/webhooks', to: 'webhooks#complete'
16
+ end
17
+
18
+ resources :mappings
19
+
20
+ get '/oauth/hubspot', to: 'oauth/authorization#authorize_hubspot'
21
+ get '/oauth/hubspot_callback', to: 'oauth/authorization#hubspot_callback'
22
+ get '/auth/:provider/callback', to: 'oauth/authorization#trello_callback'
23
+ get '/oauth/trello_callback', to: 'oauth/authorization#trello_callback'
24
+ get '/login', to: 'oauth/authorization#login'
25
+
26
+ post '/create_card', to: 'home#create_card'
27
+ get '/success', to: 'home#success'
28
+ root to: 'home#index'
29
+ 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,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
@@ -0,0 +1,10 @@
1
+ class CreateHubspotTokens < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :hubspot_tokens do |t|
4
+ t.string :refresh_token
5
+ t.string :access_token
6
+ t.datetime :expires_in
7
+ t.datetime :expires_at
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ class CreateTrelloTokens < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :trello_tokens do |t|
4
+ t.string :token
5
+ t.string :secret
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class CreateDealAssociations < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :deal_associations do |t|
4
+ t.string :deal_id
5
+ t.string :card_id
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class CreateExtensionCards < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :extension_cards do |t|
4
+ t.string :card_id_key
5
+ t.string :card_id
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ class CreateMappings < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :mappings do |t|
4
+ t.string :board_id
5
+ t.string :board_list_id
6
+ t.string :pipeline_id
7
+ t.string :pipeline_stage_id
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ class CreateWebhooks < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :webhooks do |t|
4
+ t.string :webhook_id
5
+ t.string :card_id
6
+ t.string :url
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,52 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 2020_07_27_083656) do
14
+
15
+ create_table "deal_associations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
16
+ t.string "deal_id"
17
+ t.string "card_id"
18
+ end
19
+
20
+ create_table "extension_cards", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
21
+ t.string "card_id_key"
22
+ t.string "card_id"
23
+ end
24
+
25
+ create_table "hubspot_tokens", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
26
+ t.string "refresh_token"
27
+ t.string "access_token"
28
+ t.datetime "expires_in"
29
+ t.datetime "expires_at"
30
+ end
31
+
32
+ create_table "mappings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
33
+ t.string "board_id"
34
+ t.string "board_list_id"
35
+ t.string "pipeline_id"
36
+ t.string "pipeline_stage_id"
37
+ t.datetime "created_at", null: false
38
+ t.datetime "updated_at", null: false
39
+ end
40
+
41
+ create_table "trello_tokens", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
42
+ t.string "token"
43
+ t.string "secret"
44
+ end
45
+
46
+ create_table "webhooks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
47
+ t.string "webhook_id"
48
+ t.string "card_id"
49
+ t.string "url"
50
+ end
51
+
52
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
+ # Character.create(name: 'Luke', movie: movies.first)
@@ -0,0 +1,41 @@
1
+ version: '3.5'
2
+
3
+ services:
4
+ web:
5
+ env_file:
6
+ - .env
7
+ environment:
8
+ DB_HOST: db
9
+ DB_NAME: trello_integration
10
+ DB_USERNAME: trello_integration
11
+ DB_PASSWORD: trello_integration
12
+ build:
13
+ dockerfile: ./sample-apps/trello-integration-app/Dockerfile
14
+ context: ../../
15
+ depends_on:
16
+ - db
17
+ ports:
18
+ - 3000:3000
19
+ db:
20
+ image: mysql:8.0
21
+ command: mysqld --default-authentication-plugin=mysql_native_password
22
+ volumes:
23
+ - ./db/mysql:/var/lib/mysql
24
+ ports:
25
+ - 3306:3306
26
+ logging:
27
+ driver: none
28
+ environment:
29
+ MYSQL_ROOT_PASSWORD: root
30
+ MYSQL_DATABASE: trello_integration_development
31
+ MYSQL_USER: trello_integration
32
+ MYSQL_PASSWORD: trello_integration
33
+ ngrok:
34
+ image: gtriggiano/ngrok-tunnel
35
+ ports:
36
+ - 4040:4040
37
+ environment:
38
+ TARGET_HOST: web
39
+ TARGET_PORT: 3000
40
+ depends_on:
41
+ - web
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ # Remove a potentially pre-existing server.pid for Rails.
5
+ rm -f /myapp/tmp/pids/server.pid
6
+
7
+ # Then exec the container's main process (what's set as CMD in the Dockerfile).
8
+ exec "$@"
@@ -0,0 +1,18 @@
1
+ class TrelloPayloadParamsHandler
2
+ def initialize(app)
3
+ @app = app
4
+ end
5
+
6
+ def call(env)
7
+ params = env['rack.input'].gets
8
+ if params && params['action']
9
+ result = JSON.parse(params)
10
+ if result['action']
11
+ result['event'] = result['action']
12
+ result.delete('action')
13
+ env['action_dispatch.request.request_parameters'] = result
14
+ end
15
+ end
16
+ @app.call(env)
17
+ end
18
+ end