postman_mta 0.1.1 → 0.1.2

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: d204a94e4b429c874c194ebcfddbc02969cc92c2
4
- data.tar.gz: 4b42a3e90b282fd6a78cbae5153d16f269900776
3
+ metadata.gz: b309a9971701fffbe7b109643b4b73d8ae3f425f
4
+ data.tar.gz: 758fa3e2ff2ce4fb0bda965cd3553472f60af739
5
5
  SHA512:
6
- metadata.gz: 23c96c6b8108320788c4b358be7444f09cfa43f3381dd642eb4d37346bd14f8640e539a57a3811defd8061e652a15d80388e02bd5edbafafd229a6b38982b7cb
7
- data.tar.gz: d2e16e3f811071a3654198ae354bd5873f7f4b6d1b9d7ece0c980da317005d9fab13f4bca634eacc7432711190a8088bdf5d9b521b6467df06cdc4c078b00144
6
+ metadata.gz: 3763172291f97da79b59eafcd4cff608be6214207405c9cb74f603a4d6a5cfb992a6af1afcb4087e60cf8e813e3fb1d0c6c0895ac3b690e38a368b0bbf9eed86
7
+ data.tar.gz: 7cfe0a78718469feba6dd2167c3f8709ae5ebb7c90efb01b4e761f2685b8d0a41eb470e5949dd106c7c58559bf4be7a8b869f92c95f04d11f594b8c711ef469a
data/Gemfile CHANGED
@@ -6,6 +6,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
  gemspec
7
7
 
8
8
  group :development, :test do
9
+ gem 'api_matchers', '~> 0.6.2'
9
10
  gem 'rails', '~> 5.0'
10
11
  gem 'rspec-rails', '~> 3.5', '>= 3.5.2'
11
12
  gem 'sqlite3', '~> 1.3', '>= 1.3.13'
@@ -0,0 +1,15 @@
1
+ module PostmanMta
2
+ module Stats
3
+ class MessagesController < ApplicationController
4
+ def unread
5
+ render message.unread_stats
6
+ end
7
+
8
+ private
9
+
10
+ def message
11
+ @message ||= PostmanMta::Message.new
12
+ end
13
+ end
14
+ end
15
+ end
@@ -7,5 +7,9 @@ module PostmanMta
7
7
  def create(params)
8
8
  post('/api/v1/messages', body: params)
9
9
  end
10
+
11
+ def unread_stats
12
+ get('/api/v1/stats/messages/unread')
13
+ end
10
14
  end
11
15
  end
data/config/routes.rb CHANGED
@@ -14,5 +14,11 @@ PostmanMta::Engine.routes.draw do
14
14
  resources :tags, only: [:create, :destroy]
15
15
  end
16
16
 
17
+ namespace :stats do
18
+ resources :messages, only: [] do
19
+ match :unread, on: :collection, via: :get
20
+ end
21
+ end
22
+
17
23
  resources :routes, only: :index
18
24
  end
@@ -18,9 +18,13 @@ module PostmanMta
18
18
  request_method: request_type.upcase, path: path
19
19
  ).headers
20
20
 
21
- response = self.class.send(request_type.downcase, path, { headers: headers }.merge(options))
21
+ response = self.class.send(
22
+ request_type.downcase,
23
+ path,
24
+ { headers: headers, format: :json }.merge(options)
25
+ )
22
26
 
23
- { json: response.parsed_response.as_json, status: response.code }
27
+ { json: response.parsed_response, status: response.code }
24
28
  end
25
29
  end
26
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PostmanMta
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
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.1
4
+ version: 0.1.2
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-14 00:00:00.000000000 Z
11
+ date: 2017-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -123,6 +123,7 @@ files:
123
123
  - app/controllers/postman_mta/labels_controller.rb
124
124
  - app/controllers/postman_mta/messages_controller.rb
125
125
  - app/controllers/postman_mta/routes_controller.rb
126
+ - app/controllers/postman_mta/stats/messages_controller.rb
126
127
  - app/controllers/postman_mta/tags_controller.rb
127
128
  - app/models/postman_mta/application_model.rb
128
129
  - app/models/postman_mta/conversation.rb