Class: MajesticSeo::Api::ItemInfo
- Inherits:
-
Object
- Object
- MajesticSeo::Api::ItemInfo
- Defined in:
- lib/majestic_seo/api/item_info.rb
Instance Attribute Summary collapse
-
#ac_rank ⇒ Object
Returns the value of attribute ac_rank.
-
#analysis_results_unit_cost ⇒ Object
Returns the value of attribute analysis_results_unit_cost.
-
#citation_flow ⇒ Object
Returns the value of attribute citation_flow.
-
#crawled ⇒ Object
Returns the value of attribute crawled.
-
#download_backlinks_analysis_results_unit_cost ⇒ Object
Returns the value of attribute download_backlinks_analysis_results_unit_cost.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#exact_external_edu_backlinks ⇒ Object
Returns the value of attribute exact_external_edu_backlinks.
-
#exact_external_gov_backlinks ⇒ Object
Returns the value of attribute exact_external_gov_backlinks.
-
#exact_referring_edu_domains ⇒ Object
Returns the value of attribute exact_referring_edu_domains.
-
#exact_referring_gov_domains ⇒ Object
Returns the value of attribute exact_referring_gov_domains.
-
#external_backlinks ⇒ Object
Returns the value of attribute external_backlinks.
-
#external_edu_backlinks ⇒ Object
Returns the value of attribute external_edu_backlinks.
-
#external_gov_backlinks ⇒ Object
Returns the value of attribute external_gov_backlinks.
-
#final_redirect_result ⇒ Object
Returns the value of attribute final_redirect_result.
-
#get_top_backlinks_analysis_results_unit_cost ⇒ Object
Returns the value of attribute get_top_backlinks_analysis_results_unit_cost.
-
#index ⇒ Object
Returns the value of attribute index.
-
#indexed_urls ⇒ Object
Returns the value of attribute indexed_urls.
-
#last_crawl_date ⇒ Object
Returns the value of attribute last_crawl_date.
-
#last_crawl_result ⇒ Object
Returns the value of attribute last_crawl_result.
-
#last_seen ⇒ Object
Returns the value of attribute last_seen.
-
#mappings ⇒ Object
Returns the value of attribute mappings.
-
#outbound_domain_links ⇒ Object
Returns the value of attribute outbound_domain_links.
-
#outbound_external_backliks ⇒ Object
Returns the value of attribute outbound_external_backliks.
-
#outbound_internal_backlinks ⇒ Object
Returns the value of attribute outbound_internal_backlinks.
-
#redirecting ⇒ Object
Returns the value of attribute redirecting.
-
#redirecting_to ⇒ Object
Returns the value of attribute redirecting_to.
-
#referring_domains ⇒ Object
Returns the value of attribute referring_domains.
-
#referring_edu_domains ⇒ Object
Returns the value of attribute referring_edu_domains.
-
#referring_gov_domains ⇒ Object
Returns the value of attribute referring_gov_domains.
-
#referring_ip_addresses ⇒ Object
Returns the value of attribute referring_ip_addresses.
-
#referring_subnets ⇒ Object
Returns the value of attribute referring_subnets.
-
#response ⇒ Object
Returns the value of attribute response.
-
#result_code ⇒ Object
Returns the value of attribute result_code.
-
#status ⇒ Object
Returns the value of attribute status.
-
#success ⇒ Object
Returns the value of attribute success.
-
#title ⇒ Object
Returns the value of attribute title.
-
#trust_flow ⇒ Object
Returns the value of attribute trust_flow.
-
#trust_metric ⇒ Object
Returns the value of attribute trust_metric.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(response = nil) ⇒ ItemInfo
constructor
This method returns a new instance of the Response class.
- #parse_item_info ⇒ Object
- #set_item_type ⇒ Object
- #set_result_status ⇒ Object
Constructor Details
#initialize(response = nil) ⇒ ItemInfo
This method returns a new instance of the Response class. If one of the parameters are not provided, it will default to nil.
50 51 52 53 54 55 56 57 58 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 85 86 87 88 89 90 91 92 93 |
# File 'lib/majestic_seo/api/item_info.rb', line 50 def initialize(response = nil) self.response = response self.mappings = { "ItemNum" => {:index => :integer}, "ItemType" => {:type => :integer}, "Item" => {:url => :string}, "ResultCode" => {:result_code => :string}, "Status" => {:status => :string}, "ExtBackLinks" => {:external_backlinks => :integer}, "RefDomains" => {:referring_domains => :integer}, "IndexedURLs" => {:indexed_urls => :integer}, "AnalysisResUnitsCost" => {:analysis_results_unit_cost => :integer}, "ACRank" => {:ac_rank => :integer}, "GetTopBackLinksAnalysisResUnitsCost" => {:get_top_backlinks_analysis_results_unit_cost => :integer}, "DownloadBacklinksAnalysisResUnitsCost" => {:download_backlinks_analysis_results_unit_cost => :integer}, "RefIPs" => {:referring_ip_addresses => :integer}, "RefSubNets" => {:referring_subnets => :integer}, "RefDomainsEDU" => {:referring_edu_domains => :integer}, "ExtBackLinksEDU" => {:external_edu_backlinks => :integer}, "RefDomainsGOV" => {:referring_gov_domains => :integer}, "ExtBackLinksGOV" => {:external_gov_backlinks => :integer}, "RefDomainsEDU_Exact" => {:exact_referring_edu_domains => :integer}, "ExtBackLinksEDU_Exact" => {:exact_external_edu_backlinks => :integer}, "RefDomainsGOV_Exact" => {:exact_referring_gov_domains => :integer}, "ExtBackLinksGOV_Exact" => {:exact_external_gov_backlinks => :integer}, "CrawledFlag" => {:crawled => :boolean}, "LastCrawlDate" => {:last_crawl_date => :date}, "LastCrawlResult" => {:last_crawl_result => :string}, "RedirectFlag" => {:redirecting => :boolean}, "FinalRedirectResult" => {:final_redirect_result => :string}, "LastSeen" => {:last_seen => :string}, "OutDomainsExternal" => {:outbound_domain_links => :integer}, "OutLinksExternal" => {:outbound_external_backliks => :integer}, "OutLinksInternal" => {:outbound_internal_backlinks => :integer}, "Title" => {:title => :string}, "RedirectTo" => {:redirecting_to => :string}, "CitationFlow" => {:citation_flow => :integer}, "TrustFlow" => {:trust_flow => :integer}, "TrustMetric" => {:trust_metric => :integer} } parse_item_info end |
Instance Attribute Details
#ac_rank ⇒ Object
Returns the value of attribute ac_rank.
38 39 40 |
# File 'lib/majestic_seo/api/item_info.rb', line 38 def ac_rank @ac_rank end |
#analysis_results_unit_cost ⇒ Object
Returns the value of attribute analysis_results_unit_cost.
38 39 40 |
# File 'lib/majestic_seo/api/item_info.rb', line 38 def analysis_results_unit_cost @analysis_results_unit_cost end |
#citation_flow ⇒ Object
Returns the value of attribute citation_flow.
46 47 48 |
# File 'lib/majestic_seo/api/item_info.rb', line 46 def citation_flow @citation_flow end |
#crawled ⇒ Object
Returns the value of attribute crawled.
43 44 45 |
# File 'lib/majestic_seo/api/item_info.rb', line 43 def crawled @crawled end |
#download_backlinks_analysis_results_unit_cost ⇒ Object
Returns the value of attribute download_backlinks_analysis_results_unit_cost.
39 40 41 |
# File 'lib/majestic_seo/api/item_info.rb', line 39 def download_backlinks_analysis_results_unit_cost @download_backlinks_analysis_results_unit_cost end |
#error_message ⇒ Object
Returns the value of attribute error_message.
37 38 39 |
# File 'lib/majestic_seo/api/item_info.rb', line 37 def @error_message end |
#exact_external_edu_backlinks ⇒ Object
Returns the value of attribute exact_external_edu_backlinks.
42 43 44 |
# File 'lib/majestic_seo/api/item_info.rb', line 42 def exact_external_edu_backlinks @exact_external_edu_backlinks end |
#exact_external_gov_backlinks ⇒ Object
Returns the value of attribute exact_external_gov_backlinks.
42 43 44 |
# File 'lib/majestic_seo/api/item_info.rb', line 42 def exact_external_gov_backlinks @exact_external_gov_backlinks end |
#exact_referring_edu_domains ⇒ Object
Returns the value of attribute exact_referring_edu_domains.
42 43 44 |
# File 'lib/majestic_seo/api/item_info.rb', line 42 def exact_referring_edu_domains @exact_referring_edu_domains end |
#exact_referring_gov_domains ⇒ Object
Returns the value of attribute exact_referring_gov_domains.
42 43 44 |
# File 'lib/majestic_seo/api/item_info.rb', line 42 def exact_referring_gov_domains @exact_referring_gov_domains end |
#external_backlinks ⇒ Object
Returns the value of attribute external_backlinks.
38 39 40 |
# File 'lib/majestic_seo/api/item_info.rb', line 38 def external_backlinks @external_backlinks end |
#external_edu_backlinks ⇒ Object
Returns the value of attribute external_edu_backlinks.
41 42 43 |
# File 'lib/majestic_seo/api/item_info.rb', line 41 def external_edu_backlinks @external_edu_backlinks end |
#external_gov_backlinks ⇒ Object
Returns the value of attribute external_gov_backlinks.
41 42 43 |
# File 'lib/majestic_seo/api/item_info.rb', line 41 def external_gov_backlinks @external_gov_backlinks end |
#final_redirect_result ⇒ Object
Returns the value of attribute final_redirect_result.
43 44 45 |
# File 'lib/majestic_seo/api/item_info.rb', line 43 def final_redirect_result @final_redirect_result end |
#get_top_backlinks_analysis_results_unit_cost ⇒ Object
Returns the value of attribute get_top_backlinks_analysis_results_unit_cost.
39 40 41 |
# File 'lib/majestic_seo/api/item_info.rb', line 39 def get_top_backlinks_analysis_results_unit_cost @get_top_backlinks_analysis_results_unit_cost end |
#index ⇒ Object
Returns the value of attribute index.
37 38 39 |
# File 'lib/majestic_seo/api/item_info.rb', line 37 def index @index end |
#indexed_urls ⇒ Object
Returns the value of attribute indexed_urls.
38 39 40 |
# File 'lib/majestic_seo/api/item_info.rb', line 38 def indexed_urls @indexed_urls end |
#last_crawl_date ⇒ Object
Returns the value of attribute last_crawl_date.
43 44 45 |
# File 'lib/majestic_seo/api/item_info.rb', line 43 def last_crawl_date @last_crawl_date end |
#last_crawl_result ⇒ Object
Returns the value of attribute last_crawl_result.
43 44 45 |
# File 'lib/majestic_seo/api/item_info.rb', line 43 def last_crawl_result @last_crawl_result end |
#last_seen ⇒ Object
Returns the value of attribute last_seen.
43 44 45 |
# File 'lib/majestic_seo/api/item_info.rb', line 43 def last_seen @last_seen end |
#mappings ⇒ Object
Returns the value of attribute mappings.
36 37 38 |
# File 'lib/majestic_seo/api/item_info.rb', line 36 def mappings @mappings end |
#outbound_domain_links ⇒ Object
Returns the value of attribute outbound_domain_links.
44 45 46 |
# File 'lib/majestic_seo/api/item_info.rb', line 44 def outbound_domain_links @outbound_domain_links end |
#outbound_external_backliks ⇒ Object
Returns the value of attribute outbound_external_backliks.
44 45 46 |
# File 'lib/majestic_seo/api/item_info.rb', line 44 def outbound_external_backliks @outbound_external_backliks end |
#outbound_internal_backlinks ⇒ Object
Returns the value of attribute outbound_internal_backlinks.
44 45 46 |
# File 'lib/majestic_seo/api/item_info.rb', line 44 def outbound_internal_backlinks @outbound_internal_backlinks end |
#redirecting ⇒ Object
Returns the value of attribute redirecting.
43 44 45 |
# File 'lib/majestic_seo/api/item_info.rb', line 43 def redirecting @redirecting end |
#redirecting_to ⇒ Object
Returns the value of attribute redirecting_to.
45 46 47 |
# File 'lib/majestic_seo/api/item_info.rb', line 45 def redirecting_to @redirecting_to end |
#referring_domains ⇒ Object
Returns the value of attribute referring_domains.
38 39 40 |
# File 'lib/majestic_seo/api/item_info.rb', line 38 def referring_domains @referring_domains end |
#referring_edu_domains ⇒ Object
Returns the value of attribute referring_edu_domains.
41 42 43 |
# File 'lib/majestic_seo/api/item_info.rb', line 41 def referring_edu_domains @referring_edu_domains end |
#referring_gov_domains ⇒ Object
Returns the value of attribute referring_gov_domains.
41 42 43 |
# File 'lib/majestic_seo/api/item_info.rb', line 41 def referring_gov_domains @referring_gov_domains end |
#referring_ip_addresses ⇒ Object
Returns the value of attribute referring_ip_addresses.
40 41 42 |
# File 'lib/majestic_seo/api/item_info.rb', line 40 def referring_ip_addresses @referring_ip_addresses end |
#referring_subnets ⇒ Object
Returns the value of attribute referring_subnets.
40 41 42 |
# File 'lib/majestic_seo/api/item_info.rb', line 40 def referring_subnets @referring_subnets end |
#response ⇒ Object
Returns the value of attribute response.
36 37 38 |
# File 'lib/majestic_seo/api/item_info.rb', line 36 def response @response end |
#result_code ⇒ Object
Returns the value of attribute result_code.
37 38 39 |
# File 'lib/majestic_seo/api/item_info.rb', line 37 def result_code @result_code end |
#status ⇒ Object
Returns the value of attribute status.
37 38 39 |
# File 'lib/majestic_seo/api/item_info.rb', line 37 def status @status end |
#success ⇒ Object
Returns the value of attribute success.
37 38 39 |
# File 'lib/majestic_seo/api/item_info.rb', line 37 def success @success end |
#title ⇒ Object
Returns the value of attribute title.
45 46 47 |
# File 'lib/majestic_seo/api/item_info.rb', line 45 def title @title end |
#trust_flow ⇒ Object
Returns the value of attribute trust_flow.
46 47 48 |
# File 'lib/majestic_seo/api/item_info.rb', line 46 def trust_flow @trust_flow end |
#trust_metric ⇒ Object
Returns the value of attribute trust_metric.
46 47 48 |
# File 'lib/majestic_seo/api/item_info.rb', line 46 def trust_metric @trust_metric end |
#type ⇒ Object
Returns the value of attribute type.
37 38 39 |
# File 'lib/majestic_seo/api/item_info.rb', line 37 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
37 38 39 |
# File 'lib/majestic_seo/api/item_info.rb', line 37 def url @url end |
Instance Method Details
#parse_item_info ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/majestic_seo/api/item_info.rb', line 95 def parse_item_info self.response.each do |api_column, api_value| mapping = self.mappings[api_column] value = (!api_value.nil? && !api_value.to_s.eql?("")) ? api_value.to_s : nil mapping.each do |column, data_type| converted_value = case data_type when :string then value when :integer then value.to_i when :date then value #Return it as a string for now - need to be able to retrieve a result with a date set to determine date parsing format when :boolean then (value.downcase.eql?("true")) end self.send("#{column}=", converted_value) end if (mapping && !mapping.empty? && value) end set_result_status set_item_type end |
#set_item_type ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/majestic_seo/api/item_info.rb', line 121 def set_item_type self.type = case self.type when 1 then :root_domain when 2 then :sub_domain when 3 then :url end end |
#set_result_status ⇒ Object
116 117 118 119 |
# File 'lib/majestic_seo/api/item_info.rb', line 116 def set_result_status self.success = (self.result_code && self.result_code.downcase.eql?("ok")) self. = (self.success) ? "" : self.result_code end |