Class: Kippt::RootClips

Inherits:
Clips
  • Object
show all
Defined in:
lib/kippt/root_clips.rb

Overview

The root “/clips” resource that exposes features like feed, favorites and search.

Constant Summary collapse

VALID_SEARCH_PARAMETERS =
[:q, :list, :is_starred]

Instance Attribute Summary

Attributes inherited from Clips

#base_uri

Instance Method Summary collapse

Methods inherited from Clips

#collection_class, #object_class, valid_filter_parameters

Methods included from CollectionResource

#build, #create, #destroy_resource, #save_resource

Methods included from ReadCollectionResource

#[], #fetch

Constructor Details

#initialize(client) ⇒ RootClips

Returns a new instance of RootClips.



8
9
10
# File 'lib/kippt/root_clips.rb', line 8

def initialize(client)
  super(client, "clips")
end

Instance Method Details

#favoritesObject



16
17
18
# File 'lib/kippt/root_clips.rb', line 16

def favorites
  Kippt::Clips.new(client, "clips/favorites")
end

#feedObject



12
13
14
# File 'lib/kippt/root_clips.rb', line 12

def feed
  Kippt::Clips.new(client, "clips/feed")
end

#search(parameters) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/kippt/root_clips.rb', line 20

def search(parameters)
  if parameters.is_a?(String)
    search({:q => parameters})
  else
    validate_search_parameters(parameters)

    Kippt::ClipCollection.new(
      client.get("search/clips", parameters).body,
      client)
  end
end