Sha256: 5cac7ba535ffa10b3d64b48453e7b40244bfd6b35c64071d5ca2cd2733c3f32c
Contents?: true
Size: 713 Bytes
Versions: 4
Compression:
Stored size: 713 Bytes
Contents
# frozen_string_literal: true require_relative 'lazy_model' module Redd module Models # A reddit user. class WikiPage < LazyModel # Make a Wikipage from its title and subreddit. # @option hash [String] :title the page's title # @option hash [Subreddit] :subreddit the page's subreddit # @return [WikiPage] def self.from_response(client, hash) title = hash.fetch(:title) if hash.key?(:subreddit) sr_name = hash[:subreddit].display_name new(client, hash) { |c| c.get("/r/#{sr_name}/wiki/#{title}").body[:data] } else new(client, hash) { |c| c.get("/wiki/#{title}").body[:data] } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
redd-0.8.1 | lib/redd/models/wiki_page.rb |
redd-0.8.0 | lib/redd/models/wiki_page.rb |
redd-0.8.0.pre.2 | lib/redd/models/wiki_page.rb |
redd-0.8.0.pre.1 | lib/redd/models/wiki_page.rb |