class Trendious::Entry

Attributes

entry[R]

Public Class Methods

new(hash) click to toggle source
# File lib/trendious/entry.rb, line 7
def initialize hash
  @entry = hash

  @entry.keys.each do |k|
    self.class.instance_eval do
      define_method(k) do
        @entry[k]
      end
    end
  end
end

Public Instance Methods

read() click to toggle source
# File lib/trendious/entry.rb, line 27
def read
  uri = URI.join "http://api.moviepilot.com", "/v4/", type_path, id.to_s
  
  JSON.parse(Net::HTTP.get(uri))
end
type_path() click to toggle source
# File lib/trendious/entry.rb, line 23
def type_path
  "#{type.pluralize}/"
end