uniqush-rb 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +16 -5
- data/lib/uniqush/restful_client.rb +4 -21
- data/lib/uniqush/version.rb +1 -1
- data/spec/uniqush/restul_client_spec.rb +1 -8
- data/uniqush-rb.gemspec +5 -5
- metadata +23 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c21f6dd74c418201bccc83ea9be869cf3636e58a
|
4
|
+
data.tar.gz: 051f648a29e2d9ae855d7a60d1ac5ff36bc643a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d054db99c454ada0fe761f993c93868e812153171da27766b02f25b9975295e7bde6afc1bdff999f668b2ba3057046b97dbeac09de6c0065b629cd2ae763e31
|
7
|
+
data.tar.gz: 3e3e5d7064a6b832e78bc05bb03a1b6686ff02b4f1a73f5ced01f6e89974b044f0b6c5b3de81e73db98f3b16a06af83456debedc669966371c71304d2fd3185e
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
uniqush-rb (0.0.
|
5
|
-
rest-client (~> 1.
|
4
|
+
uniqush-rb (0.0.1)
|
5
|
+
rest-client (~> 1.8.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -11,10 +11,15 @@ GEM
|
|
11
11
|
crack (0.4.2)
|
12
12
|
safe_yaml (~> 1.0.0)
|
13
13
|
diff-lcs (1.2.5)
|
14
|
-
|
15
|
-
|
14
|
+
domain_name (0.5.20160310)
|
15
|
+
unf (>= 0.0.5, < 1.0.0)
|
16
|
+
http-cookie (1.0.2)
|
17
|
+
domain_name (~> 0.5)
|
18
|
+
mime-types (2.99.1)
|
19
|
+
netrc (0.11.0)
|
16
20
|
rake (10.3.2)
|
17
|
-
rest-client (1.
|
21
|
+
rest-client (1.8.0)
|
22
|
+
http-cookie (>= 1.0.2, < 2.0)
|
18
23
|
mime-types (>= 1.16, < 3.0)
|
19
24
|
netrc (~> 0.7)
|
20
25
|
rspec (3.1.0)
|
@@ -30,6 +35,9 @@ GEM
|
|
30
35
|
rspec-support (~> 3.1.0)
|
31
36
|
rspec-support (3.1.2)
|
32
37
|
safe_yaml (1.0.4)
|
38
|
+
unf (0.1.4)
|
39
|
+
unf_ext
|
40
|
+
unf_ext (0.0.7.2)
|
33
41
|
webmock (1.18.0)
|
34
42
|
addressable (>= 2.3.6)
|
35
43
|
crack (>= 0.3.2)
|
@@ -43,3 +51,6 @@ DEPENDENCIES
|
|
43
51
|
rspec (~> 3.1.0)
|
44
52
|
uniqush-rb!
|
45
53
|
webmock (~> 1.18.0)
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.11.2
|
@@ -9,38 +9,21 @@ module Uniqush
|
|
9
9
|
remove_service: [:delete, "push_service_providers"],
|
10
10
|
subscribe_device: [:post, "subscribers"],
|
11
11
|
unsubscribe_device: [:delete, "subscribers"],
|
12
|
-
push: [:post, "
|
13
|
-
delete_schedule: [:delete, "push_notifications/schedule/:alias", [:alias]]
|
12
|
+
push: [:post, "push"]
|
14
13
|
}.freeze
|
15
14
|
|
16
15
|
def initialize(base_url)
|
17
16
|
@client = rest_client(base_url)
|
18
17
|
end
|
19
18
|
|
20
|
-
ENDPOINTS.each do |method, (http_method, url
|
21
|
-
define_method method do
|
22
|
-
uri = url.dup
|
23
|
-
if url_args.is_a?(Array)
|
24
|
-
if arguments.size < url_args.size
|
25
|
-
raise ArgumentError, "Uniqush::RestfulClient##{method} requires at least #{url_args.size} arguments for #{url_args} on the url"
|
26
|
-
end
|
27
|
-
|
28
|
-
url_params = Hash[url_args.zip(arguments)]
|
29
|
-
uri.gsub!(/\:[a-z1-9_]+/) do |match|
|
30
|
-
url_params[match[1..-1].to_sym]
|
31
|
-
end
|
32
|
-
arguments = arguments[url_args.size..arguments.size]
|
33
|
-
end
|
34
|
-
|
35
|
-
params = arguments[0] || {}
|
36
|
-
extras = arguments[1] || {}
|
37
|
-
|
19
|
+
ENDPOINTS.each do |method, (http_method, url)|
|
20
|
+
define_method method do |params = {}, extras = {}|
|
38
21
|
if [:post, :put, :patch].include?(http_method)
|
39
22
|
args = [params.to_json, extras]
|
40
23
|
else
|
41
24
|
args = [{params: params}.merge(extras)]
|
42
25
|
end
|
43
|
-
@client[
|
26
|
+
@client[url].send(http_method, *args)
|
44
27
|
end
|
45
28
|
end
|
46
29
|
|
data/lib/uniqush/version.rb
CHANGED
@@ -22,14 +22,7 @@ describe Uniqush::RestfulClient do
|
|
22
22
|
describe "pushing" do
|
23
23
|
it "pushes" do
|
24
24
|
expect { client.push(a_hash) }.
|
25
|
-
to request(:post, "#{base_url}/
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
describe "deleting schedules" do
|
30
|
-
it "deletes given schedule" do
|
31
|
-
expect { client.delete_schedule("foobarbaz") }.
|
32
|
-
to request(:delete, "#{base_url}/push_notifications/schedule/foobarbaz")
|
25
|
+
to request(:post, "#{base_url}/push").with(body: a_hash.to_json)
|
33
26
|
end
|
34
27
|
end
|
35
28
|
end
|
data/uniqush-rb.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
21
|
+
spec.add_dependency 'rest-client', '~> 1.8', '>= 1.8.0'
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.1', '>= 3.1.0'
|
25
|
+
spec.add_development_dependency 'webmock', '~> 1.18', '>= 1.18.0'
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uniqush-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rafael Bandeira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -16,14 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: '1.8'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.8.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
29
|
+
version: '1.8'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.8.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: bundler
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,6 +63,9 @@ dependencies:
|
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '3.1'
|
68
|
+
- - ">="
|
60
69
|
- !ruby/object:Gem::Version
|
61
70
|
version: 3.1.0
|
62
71
|
type: :development
|
@@ -64,6 +73,9 @@ dependencies:
|
|
64
73
|
version_requirements: !ruby/object:Gem::Requirement
|
65
74
|
requirements:
|
66
75
|
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.1'
|
78
|
+
- - ">="
|
67
79
|
- !ruby/object:Gem::Version
|
68
80
|
version: 3.1.0
|
69
81
|
- !ruby/object:Gem::Dependency
|
@@ -71,6 +83,9 @@ dependencies:
|
|
71
83
|
requirement: !ruby/object:Gem::Requirement
|
72
84
|
requirements:
|
73
85
|
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '1.18'
|
88
|
+
- - ">="
|
74
89
|
- !ruby/object:Gem::Version
|
75
90
|
version: 1.18.0
|
76
91
|
type: :development
|
@@ -78,6 +93,9 @@ dependencies:
|
|
78
93
|
version_requirements: !ruby/object:Gem::Requirement
|
79
94
|
requirements:
|
80
95
|
- - "~>"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '1.18'
|
98
|
+
- - ">="
|
81
99
|
- !ruby/object:Gem::Version
|
82
100
|
version: 1.18.0
|
83
101
|
description: Client for uniqush-push server for push notifications using GCM, APNS
|
@@ -123,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
141
|
version: '0'
|
124
142
|
requirements: []
|
125
143
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.4.5.1
|
127
145
|
signing_key:
|
128
146
|
specification_version: 4
|
129
147
|
summary: Client for uniqush-push
|