pwush 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: bbc86008ce68b74d9f004f72c452d6458de62f17
4
- data.tar.gz: 467405180fde374bf6bd672160294e81fc538a21
3
+ metadata.gz: 22d0bcf8f10581b86a57bec19d9be46789ae2526
4
+ data.tar.gz: a91b7167f647bc13e721c7db740dd9a5c6d7d1a4
5
5
  SHA512:
6
- metadata.gz: cf52e958afdbe38d46085286b2b2a41bfb9483c8d95c72bdcf8a062dbb44afdc112293dfb9ff40f83500ffd9bf9c02d89acb450ddf8b1b9a91b1b4dfed8688cc
7
- data.tar.gz: eb452d4402a7236228251abd0fc419d741ac115169ad6ecbde7ac7f11abffc8f0c12e64acd7cb900945b5637ce9bd81058cdc055f13025d1e627d81bdbc23522
6
+ metadata.gz: 67589be9e41d1eeeed1ccfed5784dda484443e59c6945bccafcf4782a7a71824d95afa0960c75489c53f3fb13b6824da4d8f82716f2e1fb231a4a629cdc191d5
7
+ data.tar.gz: 28053d3ff938381bd1184d1c3a6ddd73e609a3acf809594b6672035ad097b1e0cf46ea52cbb7259f171c728098ff75608bde04861f920915ce94c329b3cee979
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pwush (0.1.1)
4
+ pwush (0.1.2)
5
5
  dry-monads (~> 0.4)
6
6
  dry-struct (~> 0.4)
7
7
  dry-types (~> 0.12)
@@ -20,7 +20,7 @@ GEM
20
20
  safe_yaml (~> 1.0.0)
21
21
  diff-lcs (1.3)
22
22
  docile (1.3.0)
23
- domain_name (0.5.20170404)
23
+ domain_name (0.5.20180417)
24
24
  unf (>= 0.0.5, < 1.0.0)
25
25
  dry-configurable (0.7.0)
26
26
  concurrent-ruby (~> 1.0)
@@ -29,7 +29,7 @@ GEM
29
29
  dry-configurable (~> 0.1, >= 0.1.3)
30
30
  dry-core (0.4.5)
31
31
  concurrent-ruby (~> 1.0)
32
- dry-equalizer (0.2.0)
32
+ dry-equalizer (0.2.1)
33
33
  dry-logic (0.4.2)
34
34
  dry-container (~> 0.2, >= 0.2.6)
35
35
  dry-core (~> 0.2)
@@ -51,10 +51,10 @@ GEM
51
51
  dry-logic (~> 0.4, >= 0.4.2)
52
52
  inflecto (~> 0.0.0, >= 0.0.2)
53
53
  hashdiff (0.3.7)
54
- http (3.0.0)
54
+ http (3.3.0)
55
55
  addressable (~> 2.3)
56
56
  http-cookie (~> 1.0)
57
- http-form_data (>= 2.0.0.pre.pre2, < 3)
57
+ http-form_data (~> 2.0)
58
58
  http_parser.rb (~> 0.6.0)
59
59
  http-cookie (1.0.3)
60
60
  domain_name (~> 0.5)
@@ -64,7 +64,7 @@ GEM
64
64
  inflecto (0.0.2)
65
65
  json (2.1.0)
66
66
  method_source (0.9.0)
67
- oj (3.5.0)
67
+ oj (3.5.1)
68
68
  pry (0.11.3)
69
69
  coderay (~> 1.1.0)
70
70
  method_source (~> 0.9.0)
data/lib/pwush/client.rb CHANGED
@@ -7,7 +7,7 @@ module Pwush
7
7
  end
8
8
 
9
9
  def create_message(*messages)
10
- post(:createMessage, notifications: messages)
10
+ post(:createMessage, notifications: messages.flatten)
11
11
  end
12
12
  alias push create_message
13
13
 
@@ -50,7 +50,14 @@ module Pwush
50
50
  end
51
51
 
52
52
  def raw_request(verb, action, payload)
53
- Http.request(verb, url(action), json: build_request(payload).body)
53
+ request = build_request(payload)
54
+ url = url(action)
55
+
56
+ @config.logger.info(
57
+ "Pushwoosh #{verb.upcase} #{url} BODY #{request.body.to_json}"
58
+ )
59
+
60
+ Http.request(verb, url, json: request.body)
54
61
  end
55
62
 
56
63
  def build_request(payload = nil)
data/lib/pwush/config.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'logger'
2
+
1
3
  module Pwush
2
4
  MissingAuthToken = Class.new(StandardError)
3
5
  MissingAppToken = Class.new(StandardError)
@@ -6,12 +8,13 @@ module Pwush
6
8
  URL = 'https://cp.pushwoosh.com/json/1.3'.freeze
7
9
 
8
10
  def initialize(options = {})
9
- @url = options[:url] || URL
10
- @auth = options[:auth] || auth_missing
11
- @app = options[:app] || app_missing
11
+ @url = options[:url] || URL
12
+ @auth = options[:auth] || auth_missing
13
+ @app = options[:app] || app_missing
14
+ @logger = options[:logger] || Logger.new(STDOUT)
12
15
  end
13
16
 
14
- attr_accessor :auth, :url, :app
17
+ attr_accessor :auth, :url, :app, :logger
15
18
 
16
19
  private
17
20
 
data/lib/pwush/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pwush
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.1.3'.freeze
3
3
  end
data/pwush.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
6
6
  spec.name = 'pwush'
7
7
  spec.version = Pwush::VERSION
8
8
  spec.authors = ['Yaroslav Litvinov']
9
- spec.email = ['litvinov@applicot.ru']
9
+ spec.email = ['beyondthemkad@gmail.com']
10
10
 
11
11
  spec.summary = 'Pushwoosh remote API ruby toolkit'
12
12
  spec.description = spec.summary
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pwush
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
  - Yaroslav Litvinov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-09 00:00:00.000000000 Z
11
+ date: 2018-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -180,7 +180,7 @@ dependencies:
180
180
  version: '3.0'
181
181
  description: Pushwoosh remote API ruby toolkit
182
182
  email:
183
- - litvinov@applicot.ru
183
+ - beyondthemkad@gmail.com
184
184
  executables:
185
185
  - console
186
186
  - setup