postman_mta 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b309a9971701fffbe7b109643b4b73d8ae3f425f
4
- data.tar.gz: 758fa3e2ff2ce4fb0bda965cd3553472f60af739
3
+ metadata.gz: 9938693c472befa38327970aaf030b2e9503c3ce
4
+ data.tar.gz: 348e6ddb3215d6729219d91e690cf2b3c47bc53e
5
5
  SHA512:
6
- metadata.gz: 3763172291f97da79b59eafcd4cff608be6214207405c9cb74f603a4d6a5cfb992a6af1afcb4087e60cf8e813e3fb1d0c6c0895ac3b690e38a368b0bbf9eed86
7
- data.tar.gz: 7cfe0a78718469feba6dd2167c3f8709ae5ebb7c90efb01b4e761f2685b8d0a41eb470e5949dd106c7c58559bf4be7a8b869f92c95f04d11f594b8c711ef469a
6
+ metadata.gz: fba7a9a4fb3a8e42d2ba379b5b525591ab0834196cdb7678e5b7b650041815cd6acffb2317c68bab77d572687674c62a5f3e508aaa6e8538f37b18f45a035627
7
+ data.tar.gz: 38bbdf1a06e0a7384aaabfdb6caa068debb7971d08aa06aafb3505c0570f14e4b1d1b62e3f448aac0b1d331fff406a33f82f3e7d67a9e9ace7086200383cb9aa
@@ -0,0 +1,13 @@
1
+ module PostmanMta
2
+ class AttachmentsController < ApplicationController
3
+ def show
4
+ render attachment.find(params[:uuid])
5
+ end
6
+
7
+ private
8
+
9
+ def attachment
10
+ @attachment ||= PostmanMta::Attachment.new(params[:message_token])
11
+ end
12
+ end
13
+ end
@@ -18,6 +18,10 @@ module PostmanMta
18
18
  render conversation.mark_as_read(permitted_params)
19
19
  end
20
20
 
21
+ def unread
22
+ render conversation.mark_as_unread(permitted_params)
23
+ end
24
+
21
25
  def destroy
22
26
  render conversation.move_to_trash(params[:id])
23
27
  end
@@ -0,0 +1,13 @@
1
+ module PostmanMta
2
+ class Attachment < ApplicationModel
3
+ attr_reader :message_token
4
+
5
+ def initialize(message_token)
6
+ @message_token = message_token
7
+ end
8
+
9
+ def find(uuid)
10
+ get("/api/v1/messages/#{message_token}/attachments/#{uuid}")
11
+ end
12
+ end
13
+ end
@@ -21,7 +21,11 @@ module PostmanMta
21
21
  end
22
22
 
23
23
  def mark_as_read(params = {})
24
- patch('/api/v1/conversations/read', body: params)
24
+ patch('/api/v1/conversations/mark', body: params.merge(event: 'mark_as_read'))
25
+ end
26
+
27
+ def mark_as_unread(params = {})
28
+ patch('/api/v1/conversations/mark', body: params.merge(event: 'mark_as_unread'))
25
29
  end
26
30
 
27
31
  def move(params = {})
data/config/routes.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  PostmanMta::Engine.routes.draw do
2
- resources :messages, only: [:show, :create], param: :token
2
+ resources :messages, only: [:show, :create], param: :token do
3
+ resources :attachments, only: :show, param: :uuid
4
+ end
3
5
 
4
6
  resources :conversations, only: [:index, :show, :destroy] do
5
7
  [:inbox, :sent, :spam, :trash].each do |folder|
@@ -8,6 +10,7 @@ PostmanMta::Engine.routes.draw do
8
10
 
9
11
  match :starred, on: :collection, via: :get, to: 'conversations#index'
10
12
  match :read, on: :collection, via: [:put, :patch]
13
+ match :unread, on: :collection, via: [:put, :patch]
11
14
  match :move, on: :collection, via: [:put, :patch]
12
15
 
13
16
  resources :labels, only: [:create, :destroy]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostmanMta
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postman_mta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Malinovskiy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2017-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -119,6 +119,7 @@ files:
119
119
  - README.md
120
120
  - Rakefile
121
121
  - app/controllers/postman_mta/application_controller.rb
122
+ - app/controllers/postman_mta/attachments_controller.rb
122
123
  - app/controllers/postman_mta/conversations_controller.rb
123
124
  - app/controllers/postman_mta/labels_controller.rb
124
125
  - app/controllers/postman_mta/messages_controller.rb
@@ -126,6 +127,7 @@ files:
126
127
  - app/controllers/postman_mta/stats/messages_controller.rb
127
128
  - app/controllers/postman_mta/tags_controller.rb
128
129
  - app/models/postman_mta/application_model.rb
130
+ - app/models/postman_mta/attachment.rb
129
131
  - app/models/postman_mta/conversation.rb
130
132
  - app/models/postman_mta/label.rb
131
133
  - app/models/postman_mta/message.rb