diff --git a/lib/micropub/post.rb b/lib/micropub/post.rb index f4ecff8..6e0b6f3 100644 --- a/lib/micropub/post.rb +++ b/lib/micropub/post.rb @@ -19,7 +19,7 @@ module Micropub end def title - params["title"] + params["name"] end def path diff --git a/lib/micropub/post_json_parser.rb b/lib/micropub/post_json_parser.rb index 66d5eab..e9bec88 100644 --- a/lib/micropub/post_json_parser.rb +++ b/lib/micropub/post_json_parser.rb @@ -6,7 +6,7 @@ module Micropub def params { - "title" => title, + "name" => name, "content" => content, "category" => category, }.compact @@ -16,8 +16,8 @@ module Micropub attr_accessor :data - def title - data.dig("properties", "title", 0) + def name + data.dig("properties", "name", 0) end def content diff --git a/test/lib/micropub/models/post_json_parser_test.rb b/test/lib/micropub/post_json_parser_test.rb similarity index 100% rename from test/lib/micropub/models/post_json_parser_test.rb rename to test/lib/micropub/post_json_parser_test.rb diff --git a/test/lib/micropub/models/post_test.rb b/test/lib/micropub/post_test.rb similarity index 97% rename from test/lib/micropub/models/post_test.rb rename to test/lib/micropub/post_test.rb index 1599602..8d8f8b4 100644 --- a/test/lib/micropub/models/post_test.rb +++ b/test/lib/micropub/post_test.rb @@ -5,7 +5,7 @@ require "micropub/post" describe Micropub::Post do describe "#id" do it "parameterizes the title" do - post = Micropub::Post.new("title" => "My amazing post") + post = Micropub::Post.new("name" => "My amazing post") _(post.id).must_equal "my-amazing-post" end @@ -34,7 +34,7 @@ describe Micropub::Post do describe "#title" do it "returns the title" do - post = Micropub::Post.new("title" => "My great post") + post = Micropub::Post.new("name" => "My great post") _(post.title).must_equal "My great post" end @@ -208,7 +208,7 @@ describe Micropub::Post do it "returns a post formatted for hugo with a title" do post = Micropub::Post.new( - "title" => "Welcome!", + "name" => "Welcome!", "content" => "Hallo, Earth!", "published" => "2019-11-12", "category" => ["one", "two", "three"], diff --git a/test/requests/create_post_test.rb b/test/requests/create_post_test.rb index 99a1835..9453665 100644 --- a/test/requests/create_post_test.rb +++ b/test/requests/create_post_test.rb @@ -21,7 +21,7 @@ describe "create post" do it "creates a post with a title" do post "/micropub/main", { - title: "My money's in that office, right?", + name: "My money's in that office, right?", content: <<~CONTENT, If she start giving me some bullshit about it ain"t there, and we got to go someplace else and get it, I"m gonna shoot you in the head then