Checkin cleanup
This commit is contained in:
@@ -13,10 +13,11 @@ module Adamantium
|
|||||||
include Dry::Monads[:result]
|
include Dry::Monads[:result]
|
||||||
|
|
||||||
def call(post)
|
def call(post)
|
||||||
|
syndication_sources = post.delete(:syndication_sources)
|
||||||
post_params = prepare_params(params: post)
|
post_params = prepare_params(params: post)
|
||||||
created_post = post_repo.create(post_params)
|
created_post = post_repo.create(post_params)
|
||||||
|
|
||||||
post[:syndication_sources].each do |url|
|
syndication_sources.each do |url|
|
||||||
add_post_syndication_source.call(created_post.id, :swarm, url)
|
add_post_syndication_source.call(created_post.id, :swarm, url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -75,6 +75,7 @@ module Adamantium
|
|||||||
|
|
||||||
def places_listing(limit: nil)
|
def places_listing(limit: nil)
|
||||||
posts
|
posts
|
||||||
|
.where(post_type: "checkin")
|
||||||
.exclude(location: nil)
|
.exclude(location: nil)
|
||||||
.published
|
.published
|
||||||
.combine(:tags)
|
.combine(:tags)
|
||||||
|
@@ -59,8 +59,107 @@ RSpec.describe "Post creation", :db, :requests do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "checkins" do
|
||||||
|
it "is successful" do
|
||||||
|
json = '{
|
||||||
|
"type": [
|
||||||
|
"h-entry"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"published": [
|
||||||
|
"2023-02-25T10:24:30+11:00"
|
||||||
|
],
|
||||||
|
"syndication": [
|
||||||
|
"https://www.swarmapp.com/user/1390949/checkin/63f9472ed36fa977ac188903"
|
||||||
|
],
|
||||||
|
"content": [
|
||||||
|
"Coffee time!!"
|
||||||
|
],
|
||||||
|
"category": [
|
||||||
|
"check-in"
|
||||||
|
],
|
||||||
|
"checkin": [
|
||||||
|
{
|
||||||
|
"type": [
|
||||||
|
"h-card"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"name": [
|
||||||
|
"St Rose"
|
||||||
|
],
|
||||||
|
"url": [
|
||||||
|
"https://foursquare.com/v/527da837498e9d7fee64bb75",
|
||||||
|
"http://www.strose.com.au"
|
||||||
|
],
|
||||||
|
"tel": [
|
||||||
|
"(03) 9331 4488"
|
||||||
|
],
|
||||||
|
"latitude": [
|
||||||
|
-37.75627
|
||||||
|
],
|
||||||
|
"longitude": [
|
||||||
|
144.91555
|
||||||
|
],
|
||||||
|
"street-address": [
|
||||||
|
"19 Rose St"
|
||||||
|
],
|
||||||
|
"locality": [
|
||||||
|
"Essendon"
|
||||||
|
],
|
||||||
|
"region": [
|
||||||
|
"VIC"
|
||||||
|
],
|
||||||
|
"country-name": [
|
||||||
|
"Australia"
|
||||||
|
],
|
||||||
|
"postal-code": [
|
||||||
|
"3040"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"value": "https://foursquare.com/v/527da837498e9d7fee64bb75"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"location": [
|
||||||
|
{
|
||||||
|
"type": [
|
||||||
|
"h-adr"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"latitude": [
|
||||||
|
-37.75627
|
||||||
|
],
|
||||||
|
"longitude": [
|
||||||
|
144.91555
|
||||||
|
],
|
||||||
|
"street-address": [
|
||||||
|
"19 Rose St"
|
||||||
|
],
|
||||||
|
"locality": [
|
||||||
|
"Essendon"
|
||||||
|
],
|
||||||
|
"region": [
|
||||||
|
"VIC"
|
||||||
|
],
|
||||||
|
"country-name": [
|
||||||
|
"Australia"
|
||||||
|
],
|
||||||
|
"postal-code": [
|
||||||
|
"3040"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
params = JSON.parse(json, symbolize_names: true)
|
||||||
|
|
||||||
|
post "/micropub", params
|
||||||
|
expect(last_response).to be_successful
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "auth" do
|
context "auth" do
|
||||||
it "does not allow multiple auth methods" do
|
xit "does not allow multiple auth methods" do
|
||||||
params = {
|
params = {
|
||||||
access_token: "foo"
|
access_token: "foo"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user