pyapns2 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/pyapns2.rb +18 -9
  3. data/lib/pyapns2/version.rb +1 -1
  4. metadata +21 -36
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 72adcc34d31ec8f1c2d5760f53c2146488d99f74
4
+ data.tar.gz: afcd0dab423e9563d475bc57e97effd7ed75a39e
5
+ SHA512:
6
+ metadata.gz: 42cfc699445059116aebfac81863fdf34727afa7e93555c4d1979431ea4ab11651b3d6b16be10e71d88de5150b3932c819d66167509fe07bccd14291a7bb02ce
7
+ data.tar.gz: 86d5b5ffdd3772ad536ffee22db45bb9964817b1f619888d32e1c321f905eabdf1ae727466d172fcf899a7566749cf78d12e866bd1b5fbeffb2036f39f588f24
@@ -1,8 +1,17 @@
1
1
  require 'net/http'
2
- require 'xml/libxml/xmlrpc'
2
+ require 'rapuncel'
3
3
 
4
4
  class Pyapns2
5
5
 
6
+ class Deserializer < Rapuncel::XmlRpc::Deserializer
7
+
8
+ # Deal with the fact it doesn't support nil by default.
9
+ def deserialize_nil(node)
10
+ nil
11
+ end
12
+
13
+ end
14
+
6
15
  require 'pyapns2/version'
7
16
 
8
17
  class Error < StandardError; end
@@ -50,8 +59,8 @@ class Pyapns2
50
59
  raise ArgumentError, "port must be a number" unless port.is_a?(Numeric)
51
60
  @host = host
52
61
  @port = port
53
- @http = Net::HTTP.new host, port
54
- @xmlrpc = XML::XMLRPC::Client.new @http, "/"
62
+ @xmlrpc = Rapuncel::Client.new :host => @host, :port => @port, :path => "/", :raise_on => :both
63
+ def @xmlrpc.deserializer; Pyapns2::Deserializer; end
55
64
  end
56
65
 
57
66
  def inspect
@@ -76,9 +85,9 @@ class Pyapns2
76
85
  raise ArgumentError, ":cert must be a string" unless cert.is_a?(String) && !cert.strip.empty?
77
86
  raise ArgumentError, ":environment (or :env) must be one of sandbox or production" unless %w(production sandbox).include?(env)
78
87
  raise ArgumentError, ":timeout must be a valid integer" unless timeout.is_a?(Numeric) && timeout >= 0
79
- @xmlrpc.call 'provision', app_id, cert, env, timeout
88
+ @xmlrpc.call_to_ruby 'provision', app_id, cert, env, timeout
80
89
  true
81
- rescue LibXML::XML::XMLRPC::RemoteCallError => e
90
+ rescue Rapuncel::Response::Exception => e
82
91
  raise Error.new e.message
83
92
  end
84
93
 
@@ -102,17 +111,17 @@ class Pyapns2
102
111
  if types.any? && !types.all?
103
112
  raise ArgumentError, "The notifications and the strings must both be arrays if one is."
104
113
  end
105
- @xmlrpc.call 'notify', app_id, token, notification
114
+ @xmlrpc.call_to_ruby 'notify', app_id, token, notification
106
115
  true
107
- rescue LibXML::XML::XMLRPC::RemoteCallError => e
116
+ rescue Rapuncel::Response::Exception => e
108
117
  raise Error.new e.message
109
118
  end
110
119
 
111
120
  # Takes an app id and returns the list of feedback from pyapns.
112
121
  def feedback(app_id)
113
122
  raise ArgumentError, "app_id must be provided" unless app_id
114
- @xmlrpc.call('feedback', app_id).params
115
- rescue LibXML::XML::XMLRPC::RemoteCallError => e
123
+ @xmlrpc.call_to_ruby('feedback', app_id)
124
+ rescue Rapuncel::Response::Exception => e
116
125
  raise Error.new e.message
117
126
  end
118
127
 
@@ -1,3 +1,3 @@
1
1
  class Pyapns2
2
- VERSION = "1.0.0"
2
+ VERSION = "2.0.0"
3
3
  end
metadata CHANGED
@@ -1,52 +1,46 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyapns2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Darcy Laycock
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-17 00:00:00.000000000 Z
11
+ date: 2013-05-08 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: libxml-xmlrpc
14
+ name: rapuncel
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: 0.0.5
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: 0.0.5
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rr
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,39 +69,34 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: webmock
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: vcr
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: '0'
110
- description: ! 'Pyapns2 provides an alterantive, simpler client for the pyapns push
111
- notification server, using libxml-xmlrpc to handle all of the xmlrpc.
112
-
113
- It also is tested against Ruby 1.9'
97
+ description: |-
98
+ Pyapns2 provides an alterantive, simpler client for the pyapns push notification server, using libxml-xmlrpc to handle all of the xmlrpc.
99
+ It also is tested against Ruby 1.9
114
100
  email:
115
101
  - darcy@filtersquad.com
116
102
  executables: []
@@ -121,27 +107,26 @@ files:
121
107
  - lib/pyapns2.rb
122
108
  homepage: http://github.com/filtersquad
123
109
  licenses: []
110
+ metadata: {}
124
111
  post_install_message:
125
112
  rdoc_options: []
126
113
  require_paths:
127
114
  - lib
128
115
  required_ruby_version: !ruby/object:Gem::Requirement
129
- none: false
130
116
  requirements:
131
- - - ! '>='
117
+ - - '>='
132
118
  - !ruby/object:Gem::Version
133
119
  version: '0'
134
120
  required_rubygems_version: !ruby/object:Gem::Requirement
135
- none: false
136
121
  requirements:
137
- - - ! '>='
122
+ - - '>='
138
123
  - !ruby/object:Gem::Version
139
124
  version: 1.3.6
140
125
  requirements: []
141
126
  rubyforge_project:
142
- rubygems_version: 1.8.24
127
+ rubygems_version: 2.0.3
143
128
  signing_key:
144
- specification_version: 3
129
+ specification_version: 4
145
130
  summary: An alternative ruby client for the pyapns push notification server with an
146
131
  emphasis on Ruby 1.9 support.
147
132
  test_files: []