Sha256: 4a724e8cc40fd05c66d8340e087bc4aa5c87f55cdd55a66c076e62981f477e19

Contents?: true

Size: 815 Bytes

Versions: 7

Compression:

Stored size: 815 Bytes

Contents

module Services
  module Trello
    module Webhooks
      class Create
        def initialize(callback_url:, id_model:)
          @callback_url = callback_url
          @id_model = id_model
        end

        def call
          response = ::HTTParty.post(
            "https://api.trello.com/1/tokens/"\
            "#{TrelloToken.instance.token}/webhooks/?key="\
            "#{ENV["TRELLO_KEY"]}",
            query: {
              description: "test",
              callbackURL: @callback_url,
              idModel: @id_model
            },
            headers: { "Content-Type" => "application/x-www-form-urlencoded" }
          )

          parsed_body = JSON.parse(response.body)
          return false if parsed_body['id'].nil?

          JSON.parse(response.body)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb
hubspot-api-client-8.0.1 sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb
hubspot-api-client-8.0.0 sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb
hubspot-api-client-7.3.0 sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb
hubspot-api-client-7.2.0 sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb
hubspot-api-client-7.1.1 sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb
hubspot-api-client-7.1.0 sample-apps/trello-integration-app/app/lib/services/trello/webhooks/create.rb