Skip to content

Commit

Permalink
Add domain-by-name API route; close #602
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtOfCode- committed Mar 11, 2019
1 parent 9e083b7 commit c03bdbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/api/api/spam_domains_api.rb
Expand Up @@ -6,6 +6,10 @@ class SpamDomainsAPI < API::Base
std_result SpamDomain.all.order(id: :desc), filter: FILTERS[:domains]
end

get 'name/:name' do
std_result SpamDomain.where(domain: params[:name]).order(id: :desc), filter: FILTERS[:domains]
end

get ':id/posts' do
std_result SpamDomain.find(params[:id]).posts.order(id: :desc), filter: FILTERS[:posts]
end
Expand Down
5 changes: 5 additions & 0 deletions app/api/docs/spam_domains.md
Expand Up @@ -17,6 +17,11 @@ Output format:
"has_more": true
}
---
/api/v2.0/domains/name/:name | Find a domain record by its domain name

Available tables: `spam_domains`.
Output format: identical to `/domains`.
---
/api/v2.0/domains/:id/posts | List all posts containing a specific domain.

Available tables: `posts`.
Expand Down

0 comments on commit c03bdbc

Please sign in to comment.