Class: Smartfm::Sentence

Inherits:
Base
  • Object
show all
Includes:
ActsAsLikable, MediaSupport, PublicContent
Defined in:
lib/smartfm/models/sentence.rb

Constant Summary collapse

ATTRIBUTES =
[:sound, :image, :square_image, :text, :language, :id, :transliterations, :translations, :item, :list, :user]
READONLY_ATTRIBUTES =
[:id, :user]

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActsAsLikable

#like!, #likes, #unlike!

Methods included from MediaSupport

#add_image, #add_sound, #attribution_params

Methods included from PublicContent

included

Methods inherited from Base

attributes, #attributes

Constructor Details

#initialize(params = {}) ⇒ Sentence

Returns a new instance of Sentence.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/smartfm/models/sentence.rb', line 14

def initialize(params = {})
  params[:translations] = [params[:translation]] if params[:translation]
  params[:transliterations] = [params[:transliteration]] if params[:transliteration]
  @id               = params[:id]
  @item             = params[:item]
  @list             = params[:list]
  @sound            = params[:sound]
  @image            = params[:image]
  @square_image     = params[:square_image]
  @text             = params[:text]
  @language         = params[:language]
  @transliterations = params[:transliterations]
  @translations     = self.deserialize(params[:translations], :as => Smartfm::Sentence)
  @user             = self.deserialize(params[:user],         :as => Smartfm::User)
end

Class Method Details

.rest_clientObject



11
# File 'lib/smartfm/models/sentence.rb', line 11

def self.rest_client; Smartfm::RestClient::Sentence; end

Instance Method Details

#rest_clientObject



12
# File 'lib/smartfm/models/sentence.rb', line 12

def rest_client; self.class.rest_client; end