Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions lib/discourse_chatbot/functions/stock_data_function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ def name

def description
<<~EOS
An API for MarketStack stock data

You need to call it using the stock ticker.#{' '}
An API for MarketStack stock data. You need to call it using the stock ticker. You can optionally also provide a specific date.
EOS
end

def parameters
[
{ name: 'ticker', type: String, description: "ticker for share or stock query" },
{ name: 'date', type: String, description: "date for data in format YYYY-MM-DD" }
]
end

Expand All @@ -46,8 +45,7 @@ def process(args)
api_response = JSON.parse(json)

ticker = api_response['data'][0]['symbol']

uri = URI("http://api.marketstack.com/v1/eod/latest")
uri = args[parameters[1][:name]].blank? ? URI("http://api.marketstack.com/v1/eod/latest") : URI("http://api.marketstack.com/v1/eod/#{args[parameters[1][:name]]}")

params = {
access_key: "#{SiteSetting.chatbot_marketstack_key}",
Expand Down
2 changes: 1 addition & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true
# name: discourse-chatbot
# about: a plugin that allows you to have a conversation with a configurable chatbot in Discourse Chat, Topics and Private Messages
# version: 0.28
# version: 0.29
# authors: merefield
# url: https://github.com/merefield/discourse-chatbot

Expand Down