Class: Iknow::Sentence

Inherits:
Base
  • Object
show all
Defined in:
lib/iknow/model/sentence.rb

Constant Summary collapse

ATTRIBUTES =
[:sound, :image, :text]
WRITABLE_ATTRIBUTES =
[:sound, :image]

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

attributes, #attributes, deserialize, #deserialize

Constructor Details

#initialize(params = {}) ⇒ Sentence

Returns a new instance of Sentence.



18
19
20
21
22
# File 'lib/iknow/model/sentence.rb', line 18

def initialize(params = {})
  @sound = params['sound']
  @image = params['image']
  @text  = params['text']
end

Class Method Details

.matching(keyword, params = {}) ⇒ Object



12
13
14
15
16
# File 'lib/iknow/model/sentence.rb', line 12

def self.matching(keyword, params = {})
  params[:keyword] = keyword
  response = Iknow::RestClient::Sentence.matching(params)
  self.deserialize(response) || []
end

.recent(params = {}) ⇒ Object



7
8
9
10
# File 'lib/iknow/model/sentence.rb', line 7

def self.recent(params = {})
  response = Iknow::RestClient::Sentence.recent(params)
  self.deserialize(response) || []
end