This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
239 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ApiKey < ApplicationRecord | ||
belongs_to :user | ||
|
||
before_create :generate_key | ||
|
||
private | ||
|
||
def generate_key | ||
self.key = SecureRandom.hex(20) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
class Exchange < ApplicationRecord | ||
has_many :operating_hours | ||
has_many :holidays | ||
has_many :transactions, as: :transactable, dependent: :destroy | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class Transaction < ApplicationRecord | ||
belongs_to :user | ||
belongs_to :transactable, polymorphic: true, optional: true | ||
|
||
after_create :update_user_balance | ||
|
||
def update_user_balance | ||
user.balance += self.amount | ||
user.save | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,59 @@ | ||
<div> | ||
<h1 class="text-4xl font-bold">Dashboard</h1> | ||
</div> | ||
<div class="flex flex-col w-full max-w-3xl prose"> | ||
<h1 class="m-0 text-3xl font-medium">Overview</h1> | ||
|
||
<h2 class="m-0 mt-3 text-2xl font-medium">Your API Key</h2> | ||
<pre class="my-4 text-base"><code><%= current_user.api_keys.first.key %></code></pre> | ||
<p class="mt-0 text-sm text-gray-500">Remember that your API key is a secret!. If someone gains access to your API key, they could potentially incur charges on your behalf.</p> | ||
<!-- | ||
<h2 class="m-0 my-4 text-2xl font-medium">Pricing</h2> | ||
<p class="text-sm font-normal text-gray-500 ">Pricing is based on usage. On a base level, we charge $0.000015 per character of content you send in for processing. That's obviously borderline useless for figuring out spending, though. 🙃</p> | ||
<p class="m-0 text-sm font-normal text-gray-500 ">Basically, <b>it translates to about $0.75 per 10,000 words</b>.</p> | ||
<p class="text-sm font-normal text-gray-500">Each API call you make will return the number of credits you used.</p> | ||
<h2 class="m-0 my-4 text-2xl font-medium">Get to know the Detangle API</h2> | ||
<div class="grid w-full grid-cols-2 gap-4"> | ||
<%= link_to 'https://docs.detangle.ai', class: 'flex space-x-2 no-underline border border-gray-200 hover:border-gray-300 rounded-xl p-3' do %> | ||
<div class="text-2xl">👋</div> | ||
<div> | ||
<h3 class="m-0 text-base font-normal">Introduction</h3> | ||
<p class="m-0 text-sm font-normal text-gray-500">Get started with the Detangle API</p> | ||
</div> | ||
<% end %> | ||
<%= link_to 'https://docs.detangle.ai/reference/create-summarization', class: 'flex space-x-2 no-underline border border-gray-200 hover:border-gray-300 rounded-xl p-3' do %> | ||
<div class="text-2xl">✍️</div> | ||
<div> | ||
<h3 class="m-0 text-base font-normal">Summarization</h3> | ||
<p class="m-0 text-sm font-normal text-gray-500">Learn how to summarize files</p> | ||
</div> | ||
<% end %> | ||
<%= link_to 'https://docs.detangle.ai/reference/create-extraction', class: 'flex space-x-2 no-underline border border-gray-200 hover:border-gray-300 rounded-xl p-3' do %> | ||
<div class="text-2xl">🔍</div> | ||
<div> | ||
<h3 class="m-0 text-base font-normal">Extraction</h3> | ||
<p class="m-0 text-sm font-normal text-gray-500">Pull any data from your documents</p> | ||
</div> | ||
<% end %> | ||
<%= link_to 'https://docs.detangle.ai/reference/create-anonymization', class: 'flex space-x-2 no-underline border border-gray-200 hover:border-gray-300 rounded-xl p-3' do %> | ||
<div class="text-2xl">🫥</div> | ||
<div> | ||
<h3 class="m-0 text-base font-normal">Anonymization</h3> | ||
<p class="m-0 text-sm font-normal text-gray-500">Anonymize any sensitive data</p> | ||
</div> | ||
<% end %> | ||
<%= link_to 'https://docs.detangle.ai/reference/create-sentiment-analysis', class: 'flex space-x-2 no-underline border border-gray-200 hover:border-gray-300 rounded-xl p-3' do %> | ||
<div class="text-2xl">👍</div> | ||
<div> | ||
<h3 class="m-0 text-base font-normal">Sentiment Analysis</h3> | ||
<p class="m-0 text-sm font-normal text-gray-500">Analyze the sentiment of any string of text</p> | ||
</div> | ||
<% end %> | ||
<%= link_to 'https://zapier.com/developer/public-invite/190090/35f7dba89abf244e654914044b0c8cc3/', class: 'flex space-x-2 no-underline border border-gray-200 hover:border-gray-300 rounded-xl p-3 items-start' do %> | ||
<%= image_tag('https://logo.clearbit.com/zapier.com', alt: 'Zapier Logo', class: 'm-0 mt-1 h-5 w-5') %> | ||
<div> | ||
<h3 class="m-0 text-base font-normal">Zapier</h3> | ||
<p class="m-0 text-sm font-normal text-gray-500">Connect to thousands of services using Zapier!</p> | ||
</div> | ||
<% end %> | ||
</div> | ||
--> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class CreateApiKeys < ActiveRecord::Migration[7.2] | ||
def change | ||
create_table :api_keys, id: :uuid do |t| | ||
t.references :user, null: false, foreign_key: true, type: :uuid | ||
t.string :key | ||
|
||
t.timestamps | ||
|
||
t.index :key, unique: true | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddBalanceToUsers < ActiveRecord::Migration[7.2] | ||
def change | ||
add_column :users, :balance, :integer, default: 0 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class CreateTransactions < ActiveRecord::Migration[7.2] | ||
def change | ||
create_table :transactions, id: :uuid do |t| | ||
t.references :user, null: false, foreign_key: true, type: :uuid | ||
t.integer :amount | ||
t.string :description | ||
t.datetime :transaction_timestamp | ||
t.references :transactable, polymorphic: true, null: true, type: :uuid | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
one: | ||
user: one | ||
key: MyString | ||
|
||
two: | ||
user: two | ||
key: MyString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
one: | ||
user: one | ||
amount: 9.99 | ||
description: MyString | ||
|
||
two: | ||
user: two | ||
amount: 9.99 | ||
description: MyString |
Oops, something went wrong.