Class: RiseAi::CustomTrigger
- Defined in:
- lib/rise_ai/resources/custom_trigger.rb
Constant Summary collapse
- BASE_URL =
"https://workflows.rise-ai.com/"
Class Method Summary collapse
Methods inherited from Resource
Class Method Details
.create(shopify_domain, body) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rise_ai/resources/custom_trigger.rb', line 9 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 |
.execute(trigger_key, body) ⇒ Object
20 21 22 23 24 |
# File 'lib/rise_ai/resources/custom_trigger.rb', line 20 def self.execute(trigger_key, body) url = BASE_URL + "execute/#{trigger_key}" CustomTrigger.new.post_request(url, body: body) end |