Module: VtApi::ApiV2::Comments
- Defined in:
- lib/vt_api/api/v2/comments.rb
Overview
VT API 2.0 for comments
Defined Under Namespace
Classes: Comment
Class Method Summary collapse
-
.get(resource:, before:) ⇒ Array<Comment>
Array of parsed comments.
- .parse_comments(api_resp) ⇒ Object
-
.put(resource:, text:) ⇒ Boolean
True if comment put successfully (‘response_code’ equals 1), false otherwise.
Class Method Details
.get(resource:, before:) ⇒ Array<Comment>
Returns Array of parsed comments.
36 37 38 39 40 |
# File 'lib/vt_api/api/v2/comments.rb', line 36 def self.get(resource:, before:) resp = ApiV2.provider.request 'comments.get', apikey: VtApi..token, resource: resource, before: before parse_comments resp end |
.parse_comments(api_resp) ⇒ Object
53 54 55 56 57 58 59 60 |
# File 'lib/vt_api/api/v2/comments.rb', line 53 def self.parse_comments(api_resp) # noinspection RubyResolve if api_resp.response_code.nil? || (api_resp.response_code != 1) [] else api_resp.comments.map { |comment| Comment.new comment.date, comment.text } end end |
.put(resource:, text:) ⇒ Boolean
Returns True if comment put successfully (‘response_code’ equals 1), false otherwise.
47 48 49 50 51 |
# File 'lib/vt_api/api/v2/comments.rb', line 47 def self.put(resource:, text:) resp = ApiV2.provider.request 'comments.put', apikey: VtApi..token, resource: resource, text: text resp.response_code == 1 end |