Class: TecDoc::ArticleDocument
- Inherits:
-
Object
- Object
- TecDoc::ArticleDocument
- Defined in:
- lib/tec_doc/article_document.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#file_type_name ⇒ Object
Returns the value of attribute file_type_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#link_id ⇒ Object
Returns the value of attribute link_id.
-
#type_id ⇒ Object
Returns the value of attribute type_id.
-
#type_name ⇒ Object
Returns the value of attribute type_name.
Class Method Summary collapse
-
.all(options = {}) ⇒ Array<TecDoc::ArticleDocument>
Find document descriptions to an article.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(attributes = {}) ⇒ ArticleDocument
constructor
A new instance of ArticleDocument.
- #url ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ ArticleDocument
Returns a new instance of ArticleDocument.
24 25 26 27 28 29 30 31 |
# File 'lib/tec_doc/article_document.rb', line 24 def initialize(attributes = {}) @id = attributes[:doc_id].to_i @link_id = attributes[:doc_link_id].to_i @file_name = attributes[:doc_file_name].to_s @file_type_name = attributes[:doc_file_type_name].to_s @type_id = attributes[:doc_type_id].to_i @type_name = attributes[:doc_type_name].to_s end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'lib/tec_doc/article_document.rb', line 3 def description @description end |
#file_name ⇒ Object
Returns the value of attribute file_name.
3 4 5 |
# File 'lib/tec_doc/article_document.rb', line 3 def file_name @file_name end |
#file_type_name ⇒ Object
Returns the value of attribute file_type_name.
3 4 5 |
# File 'lib/tec_doc/article_document.rb', line 3 def file_type_name @file_type_name end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/tec_doc/article_document.rb', line 3 def id @id end |
#link_id ⇒ Object
Returns the value of attribute link_id.
3 4 5 |
# File 'lib/tec_doc/article_document.rb', line 3 def link_id @link_id end |
#type_id ⇒ Object
Returns the value of attribute type_id.
3 4 5 |
# File 'lib/tec_doc/article_document.rb', line 3 def type_id @type_id end |
#type_name ⇒ Object
Returns the value of attribute type_name.
3 4 5 |
# File 'lib/tec_doc/article_document.rb', line 3 def type_name @type_name end |
Class Method Details
.all(options = {}) ⇒ Array<TecDoc::ArticleDocument>
Find document descriptions to an article
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/tec_doc/article_document.rb', line 13 def self.all( = {}) = { :country => TecDoc.client.country, :lang => I18n.locale.to_s }.merge() response = TecDoc.client.request(:get_article_documents, ) response.map do |attributes| new attributes end end |
Instance Method Details
#content ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/tec_doc/article_document.rb', line 40 def content request = TecDoc.client.connection.http request.url = url request.body = nil request.headers = {} response = HTTPI.post(request) response.raw_body end |
#url ⇒ Object
33 34 35 36 37 38 |
# File 'lib/tec_doc/article_document.rb', line 33 def url base_url = TecDoc.client.connection.wsdl.endpoint.gsub("/services/TecdocToCatWL", "") provider = TecDoc.client.provider thumbnail_flag = self.is_a?(ArticleThumbnail) ? "1" : "0" "#{base_url}/documents/#{provider}/#{id}/#{thumbnail_flag}" end |