Class: PostmanMta::Bookmark

Inherits:
ApplicationModel show all
Defined in:
app/models/postman_mta/bookmark.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target_type, target_id) ⇒ Bookmark

Returns a new instance of Bookmark.



5
6
7
8
# File 'app/models/postman_mta/bookmark.rb', line 5

def initialize(target_type, target_id)
  @target_type = target_type
  @target_id = target_id
end

Instance Attribute Details

#target_idObject (readonly)

Returns the value of attribute target_id.



3
4
5
# File 'app/models/postman_mta/bookmark.rb', line 3

def target_id
  @target_id
end

#target_typeObject (readonly)

Returns the value of attribute target_type.



3
4
5
# File 'app/models/postman_mta/bookmark.rb', line 3

def target_type
  @target_type
end

Instance Method Details

#create(params) ⇒ Object



10
11
12
# File 'app/models/postman_mta/bookmark.rb', line 10

def create(params)
  post("/#{target_type}/#{target_id}/bookmarks", body: params)
end

#destroy(bookmark_id) ⇒ Object



14
15
16
# File 'app/models/postman_mta/bookmark.rb', line 14

def destroy(bookmark_id)
  delete("/#{target_type}/#{target_id}/bookmarks/#{bookmark_id}")
end