Class: Vk::DSL::Newsfeed::SearchResult
- Inherits:
-
Object
- Object
- Vk::DSL::Newsfeed::SearchResult
- Defined in:
- lib/vk/dsl/newsfeed.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #fetch! ⇒ Object
- #groups ⇒ Array<Vk::Group>
-
#initialize(client, options = {}) ⇒ SearchResult
constructor
A new instance of SearchResult.
- #items ⇒ Array<SearchItem>
- #next_from ⇒ String
- #next_page ⇒ SearchResult
- #profiles ⇒ Array<Vk::User>
- #result ⇒ Object
Constructor Details
#initialize(client, options = {}) ⇒ SearchResult
Returns a new instance of SearchResult.
73 74 75 76 |
# File 'lib/vk/dsl/newsfeed.rb', line 73 def initialize(client, = {}) @client = client @options = end |
Instance Attribute Details
#options ⇒ Hash
69 70 71 |
# File 'lib/vk/dsl/newsfeed.rb', line 69 def @options end |
Instance Method Details
#fetch! ⇒ Object
82 83 84 85 |
# File 'lib/vk/dsl/newsfeed.rb', line 82 def fetch! result self end |
#groups ⇒ Array<Vk::Group>
100 101 102 |
# File 'lib/vk/dsl/newsfeed.rb', line 100 def groups @groups ||= result['groups'].map { |group| Vk::Group.new(group) } end |
#items ⇒ Array<SearchItem>
88 89 90 91 92 |
# File 'lib/vk/dsl/newsfeed.rb', line 88 def items @items ||= result['items'].map do |item| SearchItem.new(item).as_search_result_of(self) end end |
#next_from ⇒ String
105 106 107 |
# File 'lib/vk/dsl/newsfeed.rb', line 105 def next_from @next_from ||= result['next_from'] end |
#next_page ⇒ SearchResult
110 111 112 |
# File 'lib/vk/dsl/newsfeed.rb', line 110 def next_page self.class.new(@client, .merge(start_from: next_from)) end |
#profiles ⇒ Array<Vk::User>
95 96 97 |
# File 'lib/vk/dsl/newsfeed.rb', line 95 def profiles @profiles ||= result['profiles'].map { |user| Vk::User.new(user) } end |
#result ⇒ Object
78 79 80 |
# File 'lib/vk/dsl/newsfeed.rb', line 78 def result @result ||= @client.request('newsfeed.search', @options) end |