pwush 0.1.0 → 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: aaa9bec7f09191281344c77afb61d0de59852570
4
- data.tar.gz: cac9d2719b8e21e063faa2d2ff2c8785a3317804
3
+ metadata.gz: bbc86008ce68b74d9f004f72c452d6458de62f17
4
+ data.tar.gz: 467405180fde374bf6bd672160294e81fc538a21
5
5
  SHA512:
6
- metadata.gz: 4357cbe52d3f48562f57be99bfb198e7dec8b601df355b0c7549cf305aece196c622c45f27cdeaddd24c6735c1e09ec0c9bd17eb978f86525684b9cb4c9a123d
7
- data.tar.gz: 128fb28825c1a47baabc2320e15a40892ee9161abc61dc8903759b18a76c21f8f34383769f984424f22600ba6afdfae04eb898311d207b0f04db5e35054e9ac2
6
+ metadata.gz: cf52e958afdbe38d46085286b2b2a41bfb9483c8d95c72bdcf8a062dbb44afdc112293dfb9ff40f83500ffd9bf9c02d89acb450ddf8b1b9a91b1b4dfed8688cc
7
+ data.tar.gz: eb452d4402a7236228251abd0fc419d741ac115169ad6ecbde7ac7f11abffc8f0c12e64acd7cb900945b5637ce9bd81058cdc055f13025d1e627d81bdbc23522
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pwush (0.1.0)
4
+ pwush (0.1.1)
5
5
  dry-monads (~> 0.4)
6
6
  dry-struct (~> 0.4)
7
7
  dry-types (~> 0.12)
@@ -107,12 +107,12 @@ PLATFORMS
107
107
 
108
108
  DEPENDENCIES
109
109
  bundler (~> 1.16)
110
- pry-byebug
110
+ pry-byebug (~> 3.6)
111
111
  pwush!
112
112
  rake (~> 10.0)
113
113
  rspec (~> 3.0)
114
- rspec_junit_formatter
115
- simplecov
114
+ rspec_junit_formatter (~> 0.3)
115
+ simplecov (~> 0.16)
116
116
  webmock (~> 3.0)
117
117
 
118
118
  BUNDLED WITH
data/README.md CHANGED
@@ -5,16 +5,14 @@
5
5
 
6
6
  # Pwush
7
7
 
8
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pwush.rb`. To experiment with that code, run `bin/console` for an interactive prompt.
9
-
10
- TODO: Delete this and the text above, and describe your gem
8
+ Pwush is a remote api toolkit for [Pushwoosh](https://www.pushwoosh.com/v1.0/reference)
11
9
 
12
10
  ## Installation
13
11
 
14
12
  Add this line to your application's Gemfile:
15
13
 
16
14
  ```ruby
17
- gem 'pwush'
15
+ gem 'pwush', '~> 0.1.0'
18
16
  ```
19
17
 
20
18
  And then execute:
@@ -25,15 +23,37 @@ Or install it yourself as:
25
23
 
26
24
  $ gem install pwush
27
25
 
28
- ## Usage
29
-
30
- TODO: Write usage instructions here
26
+ ## Basic Usage
31
27
 
32
- ## Development
33
-
34
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
28
+ ### Setup pwush client
29
+ ```ruby
30
+ MyPW = Pwush.new(auth: 'AUTH_KEY', app: 'APP_CODE')
31
+ ```
32
+ ### Push message
33
+ ```ruby
34
+ first_message = Pwush::Message.new(
35
+ content: { en: 'Hello' },
36
+ send_date: '2018-04-06 23:00',
37
+ timezone: 'Europe/London',
38
+ devices: ['token1', 'token2'],
39
+ ios_title: 'This is the test message',
40
+ ios_subtitle: 'subtitle!'
41
+ )
42
+
43
+ second_message = Pwush::Message.new(
44
+ content: { es: 'Hola' },
45
+ send_date: '2018-04-06 23:00',
46
+ timezone: 'Europe/Madrid',
47
+ devices: ['token3', 'token4'],
48
+ android_banner: 'This is the test message',
49
+ android_gcm_ttl: 3600
50
+ )
51
+
52
+ MyPW.push(first_message, second_message)
53
+ ```
35
54
 
36
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+ ### Result
56
+ The result is `dry-monads` Success or Failure, [read about it](http://dry-rb.org/gems/dry-monads/result/)
37
57
 
38
58
  ## Contributing
39
59
 
@@ -35,10 +35,6 @@ module Pwush
35
35
  post(:getPreset, preset_code: preset_code)
36
36
  end
37
37
 
38
- def fail
39
- post(:someshit, shit: 'crap')
40
- end
41
-
42
38
  private
43
39
 
44
40
  def get(action, payload = nil)
@@ -11,7 +11,7 @@ module Pwush
11
11
 
12
12
  # "timezone":"America/New_York", optional, if ignored UTC-0 is default in "send_date".
13
13
  # See http://php.net/manual/timezones.php for supported timezones
14
- attribute :timezone, Types::Strict::String.optional.default('UTC-0')
14
+ attribute :timezone, Types::Strict::String.optional.default(nil)
15
15
 
16
16
  # "campaign":"CAMPAIGN_CODE", optional.
17
17
  # Campaign code to which you want to assign this push message
@@ -43,7 +43,7 @@ module Pwush
43
43
 
44
44
  # "minimize_link": 0, optional.
45
45
  # False or 0 - do not minimize, 1 - Google, 2 - bitly. Default = 1
46
- attribute :minimize_link, Types::Strict::Int.default(1).constrained(included_in: 0..2)
46
+ attribute :minimize_link, Types::Strict::Int.constrained(included_in: 0..2).optional.default(nil)
47
47
 
48
48
  # "data": {"key":"value"}, JSON string or JSON object,
49
49
  # will be passed as "u" parameter in the payload (converted to JSON string)
@@ -1,3 +1,3 @@
1
1
  module Pwush
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  end
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
27
27
  spec.add_dependency 'oj', '~> 3'
28
28
 
29
29
  spec.add_development_dependency 'bundler', '~> 1.16'
30
- spec.add_development_dependency 'pry-byebug'
30
+ spec.add_development_dependency 'pry-byebug', '~> 3.6'
31
31
  spec.add_development_dependency 'rake', '~> 10.0'
32
32
  spec.add_development_dependency 'rspec', '~> 3.0'
33
- spec.add_development_dependency 'rspec_junit_formatter'
34
- spec.add_development_dependency 'simplecov'
33
+ spec.add_development_dependency 'rspec_junit_formatter', '~> 0.3'
34
+ spec.add_development_dependency 'simplecov', '~> 0.16'
35
35
  spec.add_development_dependency 'webmock', '~> 3.0'
36
36
  end
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.0
4
+ version: 0.1.2
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-05 00:00:00.000000000 Z
11
+ date: 2018-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-monads
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: pry-byebug
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: '3.6'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: '3.6'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -140,30 +140,30 @@ dependencies:
140
140
  name: rspec_junit_formatter
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: '0.3'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: '0.3'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: simplecov
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '0.16'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '0.16'
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: webmock
169
169
  requirement: !ruby/object:Gem::Requirement