hydna 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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/hydna.rb +12 -10
  3. metadata +25 -44
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 200bbb62cca0140bb1d1c3860f2343e601084016
4
+ data.tar.gz: 9efc99d7d7df77fe959042f0bbe76babf1925548
5
+ SHA512:
6
+ metadata.gz: f768c7f9d6bd6dbdc27d1664f3cb801c041cd5d69c16656f6bd33d30e9342d1efe23301c1f523501500ed0c69e433d47009ef576c2b5cb47e28e41469706a65d
7
+ data.tar.gz: 436c5ee02e7f49f1454f7642d0b434542375ca33bb4645f1680db01e3c2f34ee0c811f49b5b3425cc96936b5a7e1aef1346e64f5e1b0519ab2c0a299592094ae
data/lib/hydna.rb CHANGED
@@ -57,6 +57,7 @@ module Hydna
57
57
  data = clean_payload(data)
58
58
 
59
59
  http = Net::HTTP::new(uri['host'], uri['port'])
60
+ http.use_ssl = false
60
61
 
61
62
  if uri['scheme'] == 'https'
62
63
  http.use_ssl = true
@@ -68,24 +69,25 @@ module Hydna
68
69
  if uri['token'] != nil
69
70
  path = "%s?%s" % [path, uri['token']]
70
71
  end
71
-
72
- resp, body = http.post(path, data, headers)
73
72
 
74
- if Integer(resp.code) != 200
75
- raise resp.message
73
+ begin
74
+ resp, body = http.post(path, data, headers)
75
+ if Integer(resp.code) != 200
76
+ raise resp.message
77
+ end
78
+ rescue EOFError => e
76
79
  end
77
-
78
80
  return true
79
81
 
80
82
  end
81
83
 
82
84
  def self.clean_prio(prio)
83
85
  if !is_numeric(prio)
84
- raise "Priority needs to be a number 1-4"
86
+ raise "Priority needs to be a number 0-3"
85
87
  end
86
88
 
87
- if prio < 1 or prio > 4
88
- raise "Priority needs to be 1-4"
89
+ if prio < 0 or prio > 3
90
+ raise "Priority needs to be 0-3"
89
91
  end
90
92
 
91
93
  return prio
@@ -124,10 +126,10 @@ module Hydna
124
126
 
125
127
  def self.path_to_channel(query)
126
128
  if query.length < 2
127
- return DEFAULT_CHANNEL;
129
+ return DEFAULT_CHANNEL
128
130
  end
129
131
 
130
- parts = query.split("/");
132
+ parts = query.split("/")
131
133
 
132
134
  if parts.length > 3
133
135
  raise "Unable to parse channel"
metadata CHANGED
@@ -1,68 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hydna
3
- version: !ruby/object:Gem::Version
4
- hash: 31
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
11
5
  platform: ruby
12
- authors:
13
- - "Isak Wistr\xC3\xB6m"
6
+ authors:
7
+ - Isak Wiström
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2012-04-11 00:00:00 Z
11
+ date: 2013-05-27 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
- description: Hydna exposes a straightforward API over HTTP. It uses a single resource; sending messages is done by making POST requests to the same URI you'd use to connect to Hydna in any client library.
13
+ description: Hydna exposes a straightforward API over HTTP. It uses a single resource;
14
+ sending messages is done by making POST requests to the same URI you'd use to connect
15
+ to Hydna in any client library.
22
16
  email: iw@hydna.com
23
17
  executables: []
24
-
25
18
  extensions: []
26
-
27
- extra_rdoc_files:
19
+ extra_rdoc_files:
28
20
  - LICENSE
29
21
  - README.md
30
- files:
22
+ files:
31
23
  - LICENSE
32
24
  - README.md
33
25
  - lib/hydna.rb
34
26
  homepage: https://github.com/hydna/hydna-ruby
35
27
  licenses: []
36
-
28
+ metadata: {}
37
29
  post_install_message:
38
30
  rdoc_options: []
39
-
40
- require_paths:
31
+ require_paths:
41
32
  - lib
42
- required_ruby_version: !ruby/object:Gem::Requirement
43
- none: false
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- hash: 3
48
- segments:
49
- - 0
50
- version: "0"
51
- required_rubygems_version: !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- hash: 3
57
- segments:
58
- - 0
59
- version: "0"
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
60
43
  requirements: []
61
-
62
44
  rubyforge_project:
63
- rubygems_version: 1.8.21
45
+ rubygems_version: 2.0.3
64
46
  signing_key:
65
- specification_version: 3
47
+ specification_version: 4
66
48
  summary: Bindings for hydna push API.
67
49
  test_files: []
68
-