diff --git a/app/builders/account_builder.rb b/app/builders/account_builder.rb index aae90bd72..598529637 100644 --- a/app/builders/account_builder.rb +++ b/app/builders/account_builder.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class AccountBuilder include CustomExceptions::Account @@ -59,7 +61,6 @@ class AccountBuilder else raise UserErrors.new({errors: @user.errors}) end - end def email_to_name(email) @@ -67,5 +68,4 @@ class AccountBuilder name.split(".").map {|n| n.capitalize }.join(" ") end - end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 2208849a4..548c2b1c0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -58,7 +58,7 @@ class ApplicationController < ActionController::Base def render_record_invalid(exception) render json: { - message: "#{exception.record.errors.full_messages.join(", ")}" + message: exception.record.errors.full_messages.join(", ") }, status: :unprocessable_entity end diff --git a/app/controllers/confirmations_controller.rb b/app/controllers/confirmations_controller.rb index c0a4006d2..7577d443f 100644 --- a/app/controllers/confirmations_controller.rb +++ b/app/controllers/confirmations_controller.rb @@ -2,7 +2,6 @@ class ConfirmationsController < Devise::ConfirmationsController skip_before_action :require_no_authentication, raise: false skip_before_action :authenticate_user!, raise: false - def create begin @confirmable = User.find_by(confirmation_token: params[:confirmation_token]) diff --git a/lib/constants/report.rb b/lib/constants/report.rb index ff2d95a42..34d0d3b40 100644 --- a/lib/constants/report.rb +++ b/lib/constants/report.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Constants::Report ACCOUNT_METRICS = [ :conversations_count, :incoming_messages_count, diff --git a/lib/custom_exceptions/account.rb b/lib/custom_exceptions/account.rb index 98ae9b39d..0e01c825f 100644 --- a/lib/custom_exceptions/account.rb +++ b/lib/custom_exceptions/account.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module CustomExceptions::Account class InvalidEmail < CustomExceptions::Base diff --git a/lib/custom_exceptions/base.rb b/lib/custom_exceptions/base.rb index da6da21c7..777b3e2a9 100644 --- a/lib/custom_exceptions/base.rb +++ b/lib/custom_exceptions/base.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CustomExceptions::Base < ::StandardError def to_hash diff --git a/lib/custom_exceptions/report.rb b/lib/custom_exceptions/report.rb index ff1429723..f7dbd6d21 100644 --- a/lib/custom_exceptions/report.rb +++ b/lib/custom_exceptions/report.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module CustomExceptions::Report class InvalidIdentity < CustomExceptions::Base def message diff --git a/lib/events/types.rb b/lib/events/types.rb index 3af5764e9..158312ee9 100644 --- a/lib/events/types.rb +++ b/lib/events/types.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Events::Types CONVERSATION_CREATED = 'conversation.created' CONVERSATION_RESOLVED = 'conversation.resolved' diff --git a/lib/integrations/facebook/delivery_status.rb b/lib/integrations/facebook/delivery_status.rb index d236c4e8e..ecd0bb7e1 100644 --- a/lib/integrations/facebook/delivery_status.rb +++ b/lib/integrations/facebook/delivery_status.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Integrations::Facebook::DeliveryStatus def initialize(params) diff --git a/lib/integrations/facebook/message_creator.rb b/lib/integrations/facebook/message_creator.rb index 713178002..5f070c713 100644 --- a/lib/integrations/facebook/message_creator.rb +++ b/lib/integrations/facebook/message_creator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Integrations::Facebook::MessageCreator attr_reader :response @@ -28,8 +30,8 @@ class Integrations::Facebook::MessageCreator def create_outgoing_message FacebookPage.where(page_id: response.sender_id).each do |page| - mb = Messages::Outgoing::EchoBuilder.new(response, page.inbox, true) - mb.perform + mb = Messages::Outgoing::EchoBuilder.new(response, page.inbox, true) + mb.perform end end diff --git a/lib/integrations/facebook/message_parser.rb b/lib/integrations/facebook/message_parser.rb index 6dff8e5d7..a7aa0f6e5 100644 --- a/lib/integrations/facebook/message_parser.rb +++ b/lib/integrations/facebook/message_parser.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Integrations::Facebook::MessageParser def initialize(response_json) diff --git a/lib/integrations/widget/incoming_message_builder.rb b/lib/integrations/widget/incoming_message_builder.rb index 8694c5ba6..947156560 100644 --- a/lib/integrations/widget/incoming_message_builder.rb +++ b/lib/integrations/widget/incoming_message_builder.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Integrations::Widget::IncomingMessageBuilder # params = { # contact_id: 1, diff --git a/lib/integrations/widget/outgoing_message_builder.rb b/lib/integrations/widget/outgoing_message_builder.rb index b6e6e98e2..ffc1dd1f7 100644 --- a/lib/integrations/widget/outgoing_message_builder.rb +++ b/lib/integrations/widget/outgoing_message_builder.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Integrations::Widget::OutgoingMessageBuilder # params = { # user_id: 1, diff --git a/lib/local_resource.rb b/lib/local_resource.rb index 74c60a596..147ce884a 100644 --- a/lib/local_resource.rb +++ b/lib/local_resource.rb @@ -1,38 +1,38 @@ class LocalResource - attr_reader :uri + attr_reader :uri - def initialize(uri) - @uri = uri - end + def initialize(uri) + @uri = uri + end - def file - @file ||= Tempfile.new(tmp_filename, tmp_folder, encoding: encoding).tap do |f| - io.rewind - f.write(io.read) - f.close - end - end + def file + @file ||= Tempfile.new(tmp_filename, tmp_folder, encoding: encoding).tap do |f| + io.rewind + f.write(io.read) + f.close + end + end - def io - @io ||= uri.open - end + def io + @io ||= uri.open + end - def encoding - io.rewind - io.read.encoding - end + def encoding + io.rewind + io.read.encoding + end - def tmp_filename - [ - Time.now.to_i.to_s, - Pathname.new(uri.path).extname - ] - end + def tmp_filename + [ + Time.now.to_i.to_s, + Pathname.new(uri.path).extname + ] + end - def tmp_folder - # If we're using Rails: - Rails.root.join('tmp') - # Otherwise: - # '/wherever/you/want' - end + def tmp_folder + # If we're using Rails: + Rails.root.join('tmp') + # Otherwise: + # '/wherever/you/want' + end end diff --git a/lib/reports/update_account_identity.rb b/lib/reports/update_account_identity.rb index 950146fdc..5a19f439f 100644 --- a/lib/reports/update_account_identity.rb +++ b/lib/reports/update_account_identity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Reports::UpdateAccountIdentity < Reports::UpdateIdentity attr_reader :account diff --git a/lib/reports/update_agent_identity.rb b/lib/reports/update_agent_identity.rb index 1d118735f..e40d8353e 100644 --- a/lib/reports/update_agent_identity.rb +++ b/lib/reports/update_agent_identity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Reports::UpdateAgentIdentity < Reports::UpdateIdentity attr_reader :agent diff --git a/lib/reports/update_identity.rb b/lib/reports/update_identity.rb index 436f3860f..bf8c00b2d 100644 --- a/lib/reports/update_identity.rb +++ b/lib/reports/update_identity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Reports::UpdateIdentity attr_reader :account, :identity diff --git a/lib/webhooks/chargebee.rb b/lib/webhooks/chargebee.rb index eef65fbc0..e8c38c6af 100644 --- a/lib/webhooks/chargebee.rb +++ b/lib/webhooks/chargebee.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Webhooks::Chargebee SUPPORTED_EVENTS = [:subscription_created, :subscription_trial_end_reminder,