module Phcpresspro require 'httparty' class Phcpressproindexapi include HTTParty format :json base_uri 'phcnetworks.net' attr_accessor :id, :psttitle, :psttext, :pststatus, :pstimage def initialize(response) @phc_press_pro_id = response['phcpresspro_article_post']['id'] @phc_press_pro_psttitle = response['phcpresspro_article_post']['psttitle'] @phc_press_pro_psttext = response['phcpresspro_article_post']['psttext'] @phc_press_pro_pststatus = response['phcpresspro_article_post']['pststatus'] @phc_press_pro_pstimage = response['phcpresspro_article_post']['pstimage'] end def self.get_phcpresspro_index_api response = get("/cms/api/v1/posts.json") if response.success? new(response) else raise response.response end end end end