class IrisRails::Post
Attributes
call_to_action_content[RW]
call_to_action_link[RW]
call_to_action_link_description[RW]
closure_text[RW]
created_at[RW]
first_introduction[RW]
internal_links[RW]
keyphrase[RW]
main_title[RW]
meta_description[RW]
ordered_topics[RW]
publish_date[RW]
published[RW]
published_at[RW]
score[RW]
second_introduction[RW]
secondary_title[RW]
seo_title[RW]
slug[RW]
updated_at[RW]
Public Class Methods
all()
click to toggle source
# File lib/generators/lib/iris_rails.rb, line 104 def self.all url = IrisRails.indexUrl response = RestClient.get(url, @headers) response = JSON.parse(response.body) puts response posts = [] response['data'].each do |post| posts << self.new(post) end account = IrisRails::Account.new( {account_name: response['account_name'], template: response['template'], account_title: response['account_title'], account_description: response['account_description'], account_keyword: response['account_keyword']} ) return posts, account end
find(slug)
click to toggle source
# File lib/generators/lib/iris_rails.rb, line 86 def self.find(slug) url = IrisRails.postUrl(slug) response = RestClient.get(url, @headers) response = JSON.parse(response.body) puts 'data' post = self.new(response['data']) related_posts = [] response['related_posts'].each do |related_post| related_posts << self.new(related_post) end post.author = response['data']['author'] account = IrisRails::Account.new( {account_name: response['account_name'], template: response['template']} ) return post, related_posts, account end
new(attr = {})
click to toggle source
# File lib/generators/lib/iris_rails.rb, line 59 def initialize(attr = {}) @main_title = attr["main_title"] @slug = attr["slug"] @created_at = attr["created_at"] @updated_at = attr["updated_at"] @banner_image = attr["banner_image"] @banner_text = attr["banner_text"] @secondary_title = attr["secondary_title"] @first_introduction = attr["first_introduction"] @internal_links = attr["internal_links"] @second_introduction = attr["second_introduction"] @call_to_action_content = attr["call_to_action_content"] @call_to_action_link = attr["call_to_action_link"] @call_to_action_link_description = attr["call_to_action_link_description"] @closure_text = attr["closure_text"] @published = attr["published"] @keyphrase = attr["keyphrase"] @meta_description = attr["meta_description"] @seo_title = attr["seo_title"] @publish_date = attr["publish_date"] @published_at = attr["published_at"] @score = attr["score"] @author_id = attr["author_id"] @author = attr["author"] @ordered_topics = attr["ordered_topics"] end