Class: Vk::DSL::Newsfeed::SearchResult

Inherits:
Object
  • Object
show all
Defined in:
lib/vk/dsl/newsfeed.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, options = {}) ⇒ SearchResult

Returns a new instance of SearchResult.

Parameters:

  • client (Vk::Client)
  • options (Hash) (defaults to: {})


73
74
75
76
# File 'lib/vk/dsl/newsfeed.rb', line 73

def initialize(client, options = {})
  @client = client
  @options = options
end

Instance Attribute Details

#optionsHash

Returns:

  • (Hash)


69
70
71
# File 'lib/vk/dsl/newsfeed.rb', line 69

def options
  @options
end

Instance Method Details

#fetch!Object



82
83
84
85
# File 'lib/vk/dsl/newsfeed.rb', line 82

def fetch!
  result
  self
end

#groupsArray<Vk::Group>

Returns:



100
101
102
# File 'lib/vk/dsl/newsfeed.rb', line 100

def groups
  @groups ||= result['groups'].map { |group| Vk::Group.new(group) }
end

#itemsArray<SearchItem>

Returns:



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_fromString

Returns:

  • (String)


105
106
107
# File 'lib/vk/dsl/newsfeed.rb', line 105

def next_from
  @next_from ||= result['next_from']
end

#next_pageSearchResult

Returns:



110
111
112
# File 'lib/vk/dsl/newsfeed.rb', line 110

def next_page
  self.class.new(@client, options.merge(start_from: next_from))
end

#profilesArray<Vk::User>

Returns:



95
96
97
# File 'lib/vk/dsl/newsfeed.rb', line 95

def profiles
  @profiles ||= result['profiles'].map { |user| Vk::User.new(user) }
end

#resultObject



78
79
80
# File 'lib/vk/dsl/newsfeed.rb', line 78

def result
  @result ||= @client.request('newsfeed.search', @options)
end