Sha256: 4ea86acede0523e81df61e703eaff817ee9aab79a88b7a0fe60c89178446eebe
Contents?: true
Size: 717 Bytes
Versions: 1
Compression:
Stored size: 717 Bytes
Contents
# frozen_string_literal: true require "jwt" module RiseAi class CustomTrigger < Resource BASE_URL = "https://workflows.rise-ai.com/" def self.create(shopify_domain, body) url = BASE_URL + "triggers?shop_url=#{shopify_domain}" payload = {"shop_url" => shopify_domain} token = JWT.encode(payload, RiseAi.config.client_secret, "HS256") headers = {"Authorization" => "Bearer #{token}"} response = CustomTrigger.new.post_request(url, body: body, headers: headers) JSON.parse(response.body)["trigger"] end def self.execute(trigger_key, body) url = BASE_URL + "execute/#{trigger_key}" CustomTrigger.new.post_request(url, body: body) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rise_ai-0.1.3 | lib/rise_ai/resources/custom_trigger.rb |