Class: IrisRails::Post
- Inherits:
-
Object
- Object
- IrisRails::Post
- Defined in:
- lib/generators/lib/iris_rails.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#author_id ⇒ Object
Returns the value of attribute author_id.
-
#banner_image ⇒ Object
Returns the value of attribute banner_image.
-
#banner_text ⇒ Object
Returns the value of attribute banner_text.
-
#call_to_action_content ⇒ Object
Returns the value of attribute call_to_action_content.
-
#call_to_action_link ⇒ Object
Returns the value of attribute call_to_action_link.
-
#call_to_action_link_description ⇒ Object
Returns the value of attribute call_to_action_link_description.
-
#closure_text ⇒ Object
Returns the value of attribute closure_text.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#first_introduction ⇒ Object
Returns the value of attribute first_introduction.
-
#internal_links ⇒ Object
Returns the value of attribute internal_links.
-
#keyphrase ⇒ Object
Returns the value of attribute keyphrase.
-
#main_title ⇒ Object
Returns the value of attribute main_title.
-
#meta_description ⇒ Object
Returns the value of attribute meta_description.
-
#ordered_topics ⇒ Object
Returns the value of attribute ordered_topics.
-
#publish_date ⇒ Object
Returns the value of attribute publish_date.
-
#published ⇒ Object
Returns the value of attribute published.
-
#published_at ⇒ Object
Returns the value of attribute published_at.
-
#score ⇒ Object
Returns the value of attribute score.
-
#second_introduction ⇒ Object
Returns the value of attribute second_introduction.
-
#secondary_title ⇒ Object
Returns the value of attribute secondary_title.
-
#seo_title ⇒ Object
Returns the value of attribute seo_title.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attr = {}) ⇒ Post
constructor
A new instance of Post.
Constructor Details
#initialize(attr = {}) ⇒ Post
Returns a new instance of Post.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# 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 |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def @author end |
#author_id ⇒ Object
Returns the value of attribute author_id.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def @author_id end |
#banner_image ⇒ Object
Returns the value of attribute banner_image.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def @banner_image end |
#banner_text ⇒ Object
Returns the value of attribute banner_text.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def @banner_text end |
#call_to_action_content ⇒ Object
Returns the value of attribute call_to_action_content.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def call_to_action_content @call_to_action_content end |
#call_to_action_link ⇒ Object
Returns the value of attribute call_to_action_link.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def call_to_action_link @call_to_action_link end |
#call_to_action_link_description ⇒ Object
Returns the value of attribute call_to_action_link_description.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def call_to_action_link_description @call_to_action_link_description end |
#closure_text ⇒ Object
Returns the value of attribute closure_text.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def closure_text @closure_text end |
#created_at ⇒ Object
Returns the value of attribute created_at.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def created_at @created_at end |
#first_introduction ⇒ Object
Returns the value of attribute first_introduction.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def first_introduction @first_introduction end |
#internal_links ⇒ Object
Returns the value of attribute internal_links.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def internal_links @internal_links end |
#keyphrase ⇒ Object
Returns the value of attribute keyphrase.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def keyphrase @keyphrase end |
#main_title ⇒ Object
Returns the value of attribute main_title.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def main_title @main_title end |
#meta_description ⇒ Object
Returns the value of attribute meta_description.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def @meta_description end |
#ordered_topics ⇒ Object
Returns the value of attribute ordered_topics.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def ordered_topics @ordered_topics end |
#publish_date ⇒ Object
Returns the value of attribute publish_date.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def publish_date @publish_date end |
#published ⇒ Object
Returns the value of attribute published.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def published @published end |
#published_at ⇒ Object
Returns the value of attribute published_at.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def published_at @published_at end |
#score ⇒ Object
Returns the value of attribute score.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def score @score end |
#second_introduction ⇒ Object
Returns the value of attribute second_introduction.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def second_introduction @second_introduction end |
#secondary_title ⇒ Object
Returns the value of attribute secondary_title.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def secondary_title @secondary_title end |
#seo_title ⇒ Object
Returns the value of attribute seo_title.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def seo_title @seo_title end |
#slug ⇒ Object
Returns the value of attribute slug.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def slug @slug end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
52 53 54 |
# File 'lib/generators/lib/iris_rails.rb', line 52 def updated_at @updated_at end |
Class Method Details
.all ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# 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) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# 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']) = [] response['related_posts'].each do || << self.new() end post. = response['data']['author'] account = IrisRails::Account.new( {account_name: response['account_name'], template: response['template']} ) return post, , account end |