Class: TecDoc::GenericArticle
- Inherits:
-
Object
- Object
- TecDoc::GenericArticle
- Defined in:
- lib/tec_doc/generic_article.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#scope ⇒ Object
Returns the value of attribute scope.
Class Method Summary collapse
-
.all(options = {}) ⇒ Array<TecDoc::GenericArticle>
Get generic articles.
Instance Method Summary collapse
-
#articles(options = {}) ⇒ Object
Generic article linked articles.
-
#initialize(attributes = {}, scope = {}) ⇒ GenericArticle
constructor
A new instance of GenericArticle.
Constructor Details
#initialize(attributes = {}, scope = {}) ⇒ GenericArticle
Returns a new instance of GenericArticle.
30 31 32 33 34 |
# File 'lib/tec_doc/generic_article.rb', line 30 def initialize(attributes = {}, scope = {}) @id = (attributes[:id] || attributes[:generic_article_id]).to_i @name = attributes[:article_norm_name] @scope = scope end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/tec_doc/generic_article.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/tec_doc/generic_article.rb', line 3 def name @name end |
#scope ⇒ Object
Returns the value of attribute scope.
4 5 6 |
# File 'lib/tec_doc/generic_article.rb', line 4 def scope @scope end |
Class Method Details
.all(options = {}) ⇒ Array<TecDoc::GenericArticle>
Get generic articles
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/tec_doc/generic_article.rb', line 18 def self.all( = {}) [:result_mode] = 2 [:sort_mode] = 2 = { :lang => I18n.locale.to_s, :country => TecDoc.client.country }.merge() TecDoc.client.request(:get_generic_articles_by_manufacturer6, ).map do |attributes| new(attributes, ) end end |
Instance Method Details
#articles(options = {}) ⇒ Object
Generic article linked articles
37 38 39 40 41 42 43 44 45 |
# File 'lib/tec_doc/generic_article.rb', line 37 def articles( = {}) = { :linking_target_type => scope[:linking_target_type], :linking_target_id => scope[:linking_target_id] }.merge().merge({ :generic_article_id => { :array => { :id => [id] } } }) Article.all() end |