From 1a6be6b4858db82e360ebbd9fd84b3bef629f054 Mon Sep 17 00:00:00 2001 From: Khalil Fazal Date: Sat, 30 Jun 2018 15:20:04 -0400 Subject: [PATCH 1/6] Added Submission::link --- lib/redd/models/submission.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/redd/models/submission.rb b/lib/redd/models/submission.rb index 6969f1d..a8744f5 100644 --- a/lib/redd/models/submission.rb +++ b/lib/redd/models/submission.rb @@ -102,6 +102,11 @@ def set_suggested_sort(suggested) # rubocop:disable Naming/AccessorMethodName client.post('/api/set_suggested_sort', id: read_attribute(:name), sort: suggested) end + # @return [String] the **absolute** url to the submission + def link + "https://www.reddit.com#{permalink}" + end + # @!attribute [r] sort_order # @return [Symbol] the comment sort order property :sort_order, :nil From b96f59c24abc619bfc0f4dd0c80c0251ebb9d153 Mon Sep 17 00:00:00 2001 From: Khalil Fazal Date: Sat, 30 Jun 2018 15:24:17 -0400 Subject: [PATCH 2/6] Added Comment::comment_link the method names are confusing. Why does Comment::link return the link to the submission instead? --- lib/redd/models/comment.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/redd/models/comment.rb b/lib/redd/models/comment.rb index 3aa234f..e0f8b18 100644 --- a/lib/redd/models/comment.rb +++ b/lib/redd/models/comment.rb @@ -205,6 +205,11 @@ class Comment < Model # @return [Boolean] whether the comment is distinguished property :distinguished?, from: :distinguished + # @return [String] the link to this specific comment + def comment_link + link.link + id + end + private def lazer_reload From d3980b140c9361695fec5ca749a8db10dff0ae12 Mon Sep 17 00:00:00 2001 From: Khalil Fazal Date: Sat, 30 Jun 2018 15:30:11 -0400 Subject: [PATCH 3/6] Update comment.rb removed whitespace --- lib/redd/models/comment.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/redd/models/comment.rb b/lib/redd/models/comment.rb index e0f8b18..810b84b 100644 --- a/lib/redd/models/comment.rb +++ b/lib/redd/models/comment.rb @@ -209,7 +209,7 @@ class Comment < Model def comment_link link.link + id end - + private def lazer_reload From f193f8dba820efb874ee9ca60cf47c69b2314706 Mon Sep 17 00:00:00 2001 From: Khalil Fazal Date: Sat, 30 Jun 2018 15:31:36 -0400 Subject: [PATCH 4/6] Update submission.rb removed whitespace --- lib/redd/models/submission.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/redd/models/submission.rb b/lib/redd/models/submission.rb index a8744f5..f93f6b3 100644 --- a/lib/redd/models/submission.rb +++ b/lib/redd/models/submission.rb @@ -106,7 +106,7 @@ def set_suggested_sort(suggested) # rubocop:disable Naming/AccessorMethodName def link "https://www.reddit.com#{permalink}" end - + # @!attribute [r] sort_order # @return [Symbol] the comment sort order property :sort_order, :nil From da844ecc9564f92493f313263bdfdff42d5fbd83 Mon Sep 17 00:00:00 2001 From: Khalil Fazal Date: Tue, 28 Aug 2018 09:21:14 -0400 Subject: [PATCH 5/6] Update comment.rb Suggestion from Stephan Meijer: Reddit calls a submission also a link. Please suffix your functions with _url instead of _link. --- lib/redd/models/comment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/redd/models/comment.rb b/lib/redd/models/comment.rb index 810b84b..a382abe 100644 --- a/lib/redd/models/comment.rb +++ b/lib/redd/models/comment.rb @@ -205,8 +205,8 @@ class Comment < Model # @return [Boolean] whether the comment is distinguished property :distinguished?, from: :distinguished - # @return [String] the link to this specific comment - def comment_link + # @return [String] the url to this specific comment + def comment_url link.link + id end From 332da0872a6e48f4efb126d97de4ef290b61a73f Mon Sep 17 00:00:00 2001 From: Khalil Fazal Date: Tue, 28 Aug 2018 09:49:31 -0400 Subject: [PATCH 6/6] Update submission.rb --- lib/redd/models/submission.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/redd/models/submission.rb b/lib/redd/models/submission.rb index f93f6b3..0f4a84e 100644 --- a/lib/redd/models/submission.rb +++ b/lib/redd/models/submission.rb @@ -103,7 +103,7 @@ def set_suggested_sort(suggested) # rubocop:disable Naming/AccessorMethodName end # @return [String] the **absolute** url to the submission - def link + def url "https://www.reddit.com#{permalink}" end