Class: FedenaSdk::News

Inherits:
Model
  • Object
show all
Defined in:
lib/fedena_sdk/news.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Model

attr_accessor, #attributes, #attributes_hash, get, #get, #initialize, #post, post, request, #request

Constructor Details

This class inherits a constructor from FedenaSdk::Model

Instance Attribute Details

#authorObject

Returns the value of attribute author.



3
4
5
# File 'lib/fedena_sdk/news.rb', line 3

def author
  @author
end

#contentObject

Returns the value of attribute content.



3
4
5
# File 'lib/fedena_sdk/news.rb', line 3

def content
  @content
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/fedena_sdk/news.rb', line 3

def title
  @title
end

Class Method Details

.all(_count = nil) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/fedena_sdk/news.rb', line 4

def self.all(_count = nil)
  url = '/api/news'
  hash = get(url)
  hash['news_detail']['news'].map do |news_hash|
    new news_hash
  end
end

Instance Method Details

#author_userObject



12
13
14
# File 'lib/fedena_sdk/news.rb', line 12

def author_user
  User.find(@author)
end