Class: PostmanMta::Label

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conversation_id) ⇒ Label

Returns a new instance of Label.



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

def initialize(conversation_id)
  @conversation_id = conversation_id
end

Instance Attribute Details

#conversation_idObject (readonly)

Returns the value of attribute conversation_id.



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

def conversation_id
  @conversation_id
end

Instance Method Details

#create(params) ⇒ Object



13
14
15
# File 'app/models/postman_mta/label.rb', line 13

def create(params)
  post("/conversations/#{conversation_id}/labels", body: params)
end

#destroy(label_id) ⇒ Object



21
22
23
# File 'app/models/postman_mta/label.rb', line 21

def destroy(label_id)
  delete("/conversations/#{conversation_id}/labels/#{label_id}")
end

#index(params = {}) ⇒ Object



9
10
11
# File 'app/models/postman_mta/label.rb', line 9

def index(params = {})
  get('/labels', body: params)
end

#update(label_id, params) ⇒ Object



17
18
19
# File 'app/models/postman_mta/label.rb', line 17

def update(label_id, params)
  patch("/conversations/#{conversation_id}/labels/#{label_id}", body: params)
end