Class: SeoSnippet

Inherits:
Object
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::Model
Defined in:
app/services/seo_snippet.rb

Constant Summary collapse

DEFAULT_PARAMS =
{
  "corporate_contacts_attributes" => {"0" => {}},
  "label" => "seo_snippet",
  "context" => "http://schema.org",
  "type" => "Organization"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ SeoSnippet

Returns a new instance of SeoSnippet.



20
21
22
23
# File 'app/services/seo_snippet.rb', line 20

def initialize(params={})
  params = DEFAULT_PARAMS.merge(params)
  super # calls (amongst other methods): corporate_contacts_attributes=(attrs)
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def context
  @context
end

#corporate_contactsObject

Returns the value of attribute corporate_contacts.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def corporate_contacts
  @corporate_contacts
end

#corporate_contacts_attributesObject

Returns the value of attribute corporate_contacts_attributes.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def corporate_contacts_attributes
  @corporate_contacts_attributes
end

#facebook_urlObject

Returns the value of attribute facebook_url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def facebook_url
  @facebook_url
end

#google_plus_urlObject

Returns the value of attribute google_plus_url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def google_plus_url
  @google_plus_url
end

#instagram_urlObject

Returns the value of attribute instagram_url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def instagram_url
  @instagram_url
end

#labelObject

Returns the value of attribute label.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def label
  @label
end

#linkedin_urlObject

Returns the value of attribute linkedin_url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def linkedin_url
  @linkedin_url
end

#logoObject

Returns the value of attribute logo.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def 
  @logo
end

#pinterest_urlObject

Returns the value of attribute pinterest_url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def pinterest_url
  @pinterest_url
end

#twitter_urlObject

Returns the value of attribute twitter_url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def twitter_url
  @twitter_url
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def type
  @type
end

#urlObject

Returns the value of attribute url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def url
  @url
end

#youtube_urlObject

Returns the value of attribute youtube_url.



12
13
14
# File 'app/services/seo_snippet.rb', line 12

def youtube_url
  @youtube_url
end

Instance Method Details

#corporate_contacts_validatorObject



31
32
33
34
35
36
37
38
39
40
41
# File 'app/services/seo_snippet.rb', line 31

def corporate_contacts_validator
  error_hash = {}
  @corporate_contacts.each do |contact|
    unless contact.valid?
      contact.errors.messages.each do |error_name, error_message|
        error_hash[error_name] = error_message.join
      end
    end
  end
  return error_hash
end