diff --git a/.circleci/config.yml b/.circleci/config.yml index 80de6487b..cda5ce44b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -65,9 +65,6 @@ jobs: SCREENSHOTLAYER_API_KEY: fake_api_key MLH_LHD_API_KEY: fake_api_key - - AIRTABLE_KEY: ENV-airtable_key - AIRTABLE_BASE: ENV-airtable_base # Service container image available at `host: localhost` diff --git a/Gemfile b/Gemfile index 01e400007..39e00e732 100644 --- a/Gemfile +++ b/Gemfile @@ -35,9 +35,6 @@ gem 'terminal-table', '~> 1.7' gem 'timezone', '~> 1.0' gem 'wkhtmltopdf-binary', '~> 0.12.3' -# Reason we're importing from GitHub: https://github.com/Airtable/airtable-ruby/issues/14#issuecomment-281893486 -gem 'airtable', github: 'Airtable/airtable-ruby' - gem 'rails_autoscale_agent', '~> 0.3.1' group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index babfcb5c6..be902efd8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,3 @@ -GIT - remote: git://github.com/Airtable/airtable-ruby.git - revision: 041a8baf8ae59279630912d6ff329faa64398cb2 - specs: - airtable (0.1.1) - activesupport (>= 3.0) - httparty (~> 0.14.0) - GEM remote: https://rubygems.org/ specs: @@ -144,8 +136,6 @@ GEM htmlentities (4.3.4) http-cookie (1.0.3) domain_name (~> 0.5) - httparty (0.14.0) - multi_xml (>= 0.5.2) i18n (1.3.0) concurrent-ruby (~> 1.0) jmespath (1.4.0) @@ -174,7 +164,6 @@ GEM mini_portile2 (2.4.0) minitest (5.11.3) msgpack (1.2.4) - multi_xml (0.6.0) multipart-post (2.0.0) nenv (0.3.0) netrc (0.11.0) @@ -354,7 +343,6 @@ PLATFORMS DEPENDENCIES active_model_serializers (~> 0.10.2) - airtable! analytics-ruby aws-sdk-s3 (~> 1.8, >= 1.8.2) bootsnap (~> 1.3) diff --git a/app/jobs/send_application_to_airtable_job.rb b/app/jobs/send_application_to_airtable_job.rb deleted file mode 100644 index 20a28e56d..000000000 --- a/app/jobs/send_application_to_airtable_job.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -class SendApplicationToAirtableJob < ApplicationJob - queue_as :default - - def perform(new_club_application) - club_record = Airtable::Record.new("High School Name": - new_club_application.high_school_name) - - table('Clubs').create club_record - - poc = new_club_application.leader_profiles.find_by(user_id: - new_club_application.point_of_contact_id) - leader_record = Airtable::Record.new( - "Full Name": poc.leader_name, - "Email": poc.leader_email, - "Clubs": [club_record.id] - ) - - table('Leaders').create leader_record - - note_record = Airtable::Record.new( - "Type": ['Application submitted', 'Note'], - "Club": [club_record.id], - "Date": Time.zone.today.to_s, - "Notes": 'Application submitted (and added to Airtable by API)' - ) - - table('History').create note_record - end - - private - - def client - @client ||= Airtable::Client.new(Rails.application.secrets.airtable_key) - end - - def table(table_name) - client.table Rails.application.secrets.airtable_base, table_name - end -end diff --git a/app/models/new_club_application.rb b/app/models/new_club_application.rb index b88e76c10..cc5e1d4dd 100644 --- a/app/models/new_club_application.rb +++ b/app/models/new_club_application.rb @@ -113,10 +113,6 @@ def submit! end ApplicantMailer.application_submission_staff(self).deliver_later - - # Send to Zapier - SendApplicationToAirtableJob.perform_later(self) - ApplicantMailer.application_submission_json(self).deliver_later true diff --git a/config/secrets.yml b/config/secrets.yml index 5b441c30c..1ec36f1d6 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -91,9 +91,6 @@ common: &common # MLH Local Hack Day API Key mlh_lhd_api_key: <%= ENV.fetch("MLH_LHD_API_KEY") %> - airtable_key: <%= ENV.fetch("AIRTABLE_KEY") %> - airtable_base: <%= ENV.fetch("AIRTABLE_BASE") %> - development: <<: *common secret_key_base: 6d02f9126a44347e07442fddf774b6a434a85b86e23629eab947c9c101b8aa878ad8fe5dadba26a3341f1a16f480068ae5234861cb7b913f526a0e96a21fcc7d diff --git a/spec/models/new_club_application_spec.rb b/spec/models/new_club_application_spec.rb index 479a1098c..92f5d4f1a 100644 --- a/spec/models/new_club_application_spec.rb +++ b/spec/models/new_club_application_spec.rb @@ -315,9 +315,7 @@ end it 'sends confirmation emails to applicants and staff' do - VCR.use_cassette('airtable') do - perform_enqueued_jobs { subject.submit! } - end + perform_enqueued_jobs { subject.submit! } # three emails to applicants and two to staff (regular & JSON) expect(ApplicantMailer.deliveries.length).to eq(3 + 2) diff --git a/spec/vcr/airtable.yml b/spec/vcr/airtable.yml deleted file mode 100644 index 12191c44d..000000000 --- a/spec/vcr/airtable.yml +++ /dev/null @@ -1,151 +0,0 @@ ---- -http_interactions: -- request: - method: post - uri: https://api.airtable.com/v0/ENV-airtable_base/Clubs - body: - encoding: UTF-8 - string: '{"fields":{"High School Name":"Samuelview High School"}}' - headers: - Authorization: - - Bearer ENV-airtable_key - Content-Type: - - application/json - response: - status: - code: 200 - message: OK - headers: - Access-Control-Allow-Headers: - - authorization,content-length,content-type,user-agent,x-airtable-application-id,x-airtable-user-agent,x-api-version,x-requested-with - Access-Control-Allow-Methods: - - DELETE,GET,OPTIONS,PATCH,POST,PUT - Access-Control-Allow-Origin: - - "*" - Content-Type: - - application/json; charset=utf-8 - Date: - - Fri, 15 Mar 2019 08:19:52 GMT - Etag: - - W/"9a-HEaiZrWyM3ZkkGWf8TxKNMStfBE" - Server: - - Tengine - Set-Cookie: - - brw=brwUrIiPcY9xHNrq8; path=/; expires=Sun, 15 Mar 2020 08:19:51 GMT; domain=.airtable.com; - httponly - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Vary: - - Accept-Encoding - Content-Length: - - '154' - Connection: - - keep-alive - body: - encoding: UTF-8 - string: '{"id":"rec4zKpyq6gMDJzhy","fields":{"High School Name":"Samuelview - High School","Name":"Samuelview High School"},"createdTime":"2019-03-15T08:19:52.114Z"}' - http_version: - recorded_at: Fri, 15 Mar 2019 08:19:52 GMT -- request: - method: post - uri: https://api.airtable.com/v0/ENV-airtable_base/Leaders - body: - encoding: UTF-8 - string: '{"fields":{"Full Name":"Refugio Beatty","Email":"walterbosco@kemmer.co","Clubs":["rec4zKpyq6gMDJzhy"]}}' - headers: - Authorization: - - Bearer ENV-airtable_key - Content-Type: - - application/json - response: - status: - code: 200 - message: OK - headers: - Access-Control-Allow-Headers: - - authorization,content-length,content-type,user-agent,x-airtable-application-id,x-airtable-user-agent,x-api-version,x-requested-with - Access-Control-Allow-Methods: - - DELETE,GET,OPTIONS,PATCH,POST,PUT - Access-Control-Allow-Origin: - - "*" - Content-Type: - - application/json; charset=utf-8 - Date: - - Fri, 15 Mar 2019 08:19:52 GMT - Etag: - - W/"a9-XsNUBULYolMMffeYlrPwU7mLD14" - Server: - - Tengine - Set-Cookie: - - brw=brw3qL7RzgqLUMC04; path=/; expires=Sun, 15 Mar 2020 08:19:52 GMT; domain=.airtable.com; - httponly - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Vary: - - Accept-Encoding - Content-Length: - - '169' - Connection: - - keep-alive - body: - encoding: UTF-8 - string: '{"id":"recqC6ytrbuBteWg1","fields":{"Full Name":"Refugio Beatty","Email":"walterbosco@kemmer.co","Clubs":["rec4zKpyq6gMDJzhy"]},"createdTime":"2019-03-15T08:19:52.623Z"}' - http_version: - recorded_at: Fri, 15 Mar 2019 08:19:52 GMT -- request: - method: post - uri: https://api.airtable.com/v0/ENV-airtable_base/History - body: - encoding: UTF-8 - string: '{"fields":{"Type":["Application submitted","Note"],"Club":["rec4zKpyq6gMDJzhy"],"Date":"2019-03-15","Notes":"Application - submitted (and added to Airtable by API)"}}' - headers: - Authorization: - - Bearer ENV-airtable_key - Content-Type: - - application/json - response: - status: - code: 200 - message: OK - headers: - Access-Control-Allow-Headers: - - authorization,content-length,content-type,user-agent,x-airtable-application-id,x-airtable-user-agent,x-api-version,x-requested-with - Access-Control-Allow-Methods: - - DELETE,GET,OPTIONS,PATCH,POST,PUT - Access-Control-Allow-Origin: - - "*" - Content-Type: - - application/json; charset=utf-8 - Date: - - Fri, 15 Mar 2019 08:19:53 GMT - Etag: - - W/"162-VjTUV69yLgfWVRugIJSramHWS/k" - Server: - - Tengine - Set-Cookie: - - brw=brwpnScYY1nDv8S7I; path=/; expires=Sun, 15 Mar 2020 08:19:53 GMT; domain=.airtable.com; - httponly - Strict-Transport-Security: - - max-age=31536000; includeSubDomains; preload - Vary: - - Accept-Encoding - Content-Length: - - '354' - Connection: - - keep-alive - body: - encoding: ASCII-8BIT - string: !binary |- - eyJpZCI6InJlY3pSdVV2Tnd1VHBrNFR6IiwiZmllbGRzIjp7IlR5cGUiOlsi - Tm90ZSIsIkFwcGxpY2F0aW9uIHN1Ym1pdHRlZCJdLCJOYW1lIjoiTm90ZSwg - QXBwbGljYXRpb24gc3VibWl0dGVk4oCTIEFwcGxpY2F0aW9uIHN1Ym1pdHRl - ZCAoYW5kIGFkZGVkIHRvIEFpcnRhYmxlIGJ5IEFQSSkiLCJDbHViIjpbInJl - YzR6S3B5cTZnTURKemh5Il0sIkxlYWRlciI6WyJyZWNxQzZ5dHJidUJ0ZVdn - MSJdLCJEYXRlIjoiMjAxOS0wMy0xNSIsIk5vdGVzIjoiQXBwbGljYXRpb24g - c3VibWl0dGVkIChhbmQgYWRkZWQgdG8gQWlydGFibGUgYnkgQVBJKSJ9LCJj - cmVhdGVkVGltZSI6IjIwMTktMDMtMTVUMDg6MTk6NTMuMTI5WiJ9 - http_version: - recorded_at: Fri, 15 Mar 2019 08:19:53 GMT -recorded_with: VCR 3.0.3