Module: Hacker::News

Defined in:
lib/hacker/news/items.rb,
lib/hacker/news/client.rb,
lib/hacker/news/errors.rb,
lib/hacker/news/version.rb

Defined Under Namespace

Classes: Client, Comment, CommentTreeNode, Error, HttpError, Item, Job, JsonError, Poll, PollOpt, Story, TimeoutError, TransportError, Updates, User

Constant Summary collapse

VERSION =

Gem version. Lockstep with the sibling libraries in this monorepo.

'0.1.0'

Instance Attribute Summary collapse

Instance Attribute Details

#idString (readonly)

Returns case-sensitive username.

Returns:

  • (String)

    case-sensitive username.



125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/hacker/news/items.rb', line 125

User = Struct.new(:id, :created, :karma, :about, :submitted, keyword_init: true) do
  # @param h [Hash]
  # @return [User]
  def self.from_hash(h)
    new(
      id: h['id'],
      created: h['created'],
      karma: h['karma'],
      about: h['about'],
      submitted: h['submitted'] || []
    )
  end
end