Class: InfomemeClient::EntityHash::Meme

Inherits:
InfomemeClient::EntityHash show all
Defined in:
lib/infomeme_client/entity_hash/meme.rb

Instance Method Summary collapse

Methods inherited from InfomemeClient::EntityHash

#freeze, #id, #method_missing, #respond_to?, #to_hash

Constructor Details

#initialize(meme, client) ⇒ Meme

Returns a new instance of Meme.



2
3
4
5
6
# File 'lib/infomeme_client/entity_hash/meme.rb', line 2

def initialize(meme, client)
  super(meme, true)
  @client = client
  freeze
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class InfomemeClient::EntityHash

Instance Method Details

#activateObject



22
23
24
# File 'lib/infomeme_client/entity_hash/meme.rb', line 22

def activate
  @client.activate_meme(id)
end

#comment(comment) ⇒ Object



46
47
48
# File 'lib/infomeme_client/entity_hash/meme.rb', line 46

def comment(comment)
  @client.comment(id, comment)
end

#confirmObject



18
19
20
# File 'lib/infomeme_client/entity_hash/meme.rb', line 18

def confirm
  @client.confirm_meme(id)
end

#deactivateObject



26
27
28
# File 'lib/infomeme_client/entity_hash/meme.rb', line 26

def deactivate
  @client.deactivate_meme(id)
end

#deleteObject



14
15
16
# File 'lib/infomeme_client/entity_hash/meme.rb', line 14

def delete
  @client.delete_meme(id)
end

#rate(rating) ⇒ Object



42
43
44
# File 'lib/infomeme_client/entity_hash/meme.rb', line 42

def rate(rating)
  @client.rate(id, rating)
end

#review(reveiw) ⇒ Object



38
39
40
# File 'lib/infomeme_client/entity_hash/meme.rb', line 38

def review(reveiw)
  @client.review id, review
end

#update(options = {}) ⇒ Object

todo: have_access?, published_by_me?, confirmed?, inactive?, incomplete?, has_upload?, etc.



10
11
12
# File 'lib/infomeme_client/entity_hash/meme.rb', line 10

def update(options = {})
  @client.update_meme(id, options)
end

#upload(file) ⇒ Object



34
35
36
# File 'lib/infomeme_client/entity_hash/meme.rb', line 34

def upload(file)
  @client.upload(id, file)
end

#upload_url(raw = false) ⇒ Object



30
31
32
# File 'lib/infomeme_client/entity_hash/meme.rb', line 30

def upload_url(raw = false)
  @client.upload_for_meme(id, raw)
end