nagareboshi 0.0.2 → 0.0.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: 934015070f50f7113e5b7cee6bad0ff048d0ce78
4
- data.tar.gz: 4bf2d6f879adeb3e1cf958118a46973a74d7c9f0
3
+ metadata.gz: 91acb9410cb65c4f9f51f76eead6ffcbdbaadccd
4
+ data.tar.gz: eec3f9dc9db94309e1ec522a234dbf6913cb6096
5
5
  SHA512:
6
- metadata.gz: 218ef2937b4011ba848a6f262e9099932f1476c9522a6a1002f9d461e9cc11fef095e240a0c30376f874e5ed128e537dae0162297dd3b4a43b8e9cc3eda9a9f3
7
- data.tar.gz: 761f6606fae69e1d9adbb41db7b596004f6c6e87ae7e6ca4c4892142d0fcecc6194dd5e7a5650260d09619e412a20c326e65f62b7de1619d717d08bff56eec7c
6
+ metadata.gz: af694c29964f722b01a6af364987a180976f65e8f488f0058e72ac66f563a7d1df206549b5e531a57830332b2bbf55225c73fab3d094125a50b6dc94647d8399
7
+ data.tar.gz: 4012310f8856b9facddeafb20de8ff8074ddf03f5baf6bf3abb4ec97ccbbb9dc3dc3ee1d0abeaa61f6f94588373476f5e3bb94d4d795155d53fe801291da011a
@@ -1,11 +1,13 @@
1
1
  module Nagareboshi
2
2
  class Configuration
3
- attr_accessor :host, :send, :use_ssl
3
+ attr_accessor :host, :send, :use_ssl, :port, :path
4
4
 
5
5
  def initialize
6
6
  @host = "pubsubhubbub.appspot.com"
7
7
  @send = false
8
8
  @use_ssl = false
9
+ @port = nil
10
+ @path = 'publish'
9
11
  end
10
12
  end
11
13
  end
@@ -19,7 +19,7 @@ module Nagareboshi
19
19
  end
20
20
 
21
21
  def ☆(request)
22
- http = Net::HTTP.new(Nagareboshi.configuration.host, ssl? ? 443 : 80)
22
+ http = Net::HTTP.new(Nagareboshi.configuration.host, port)
23
23
  http.use_ssl = ssl?
24
24
  response = http.start do |http|
25
25
  http.request request
@@ -35,7 +35,15 @@ module Nagareboshi
35
35
  end
36
36
 
37
37
  def uri
38
- "#{ssl? ? 'https' : 'http'}://#{Nagareboshi.configuration.host}/publish"
38
+ "#{ssl? ? 'https' : 'http'}://#{Nagareboshi.configuration.host}/#{Nagareboshi.configuration.path}"
39
+ end
40
+
41
+ def port
42
+ if port = Nagareboshi.configuration.port
43
+ port
44
+ else
45
+ ssl? ? 443 : 80
46
+ end
39
47
  end
40
48
 
41
49
  def ssl?
@@ -1,3 +1,3 @@
1
1
  module Nagareboshi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -7,6 +7,7 @@ describe Nagareboshi::Configuration do
7
7
  let(:configuration) { Nagareboshi::Configuration.new }
8
8
  it { expect(configuration.host).to eq "pubsubhubbub.appspot.com" }
9
9
  it { expect(configuration.send).to be_falsy }
10
- it { expect(configuration.use_ssl).to be_truthy }
10
+ it { expect(configuration.use_ssl).to be_falsy }
11
+ it { expect(configuration.port).to be_falsy }
11
12
  end
12
13
  end
@@ -69,16 +69,59 @@ describe Nagareboshi::Sender do
69
69
  end
70
70
  end
71
71
 
72
- context "uri" do
72
+ describe "uri" do
73
73
  subject { sender.send(:uri) }
74
74
 
75
- it "ssl? is true" do
76
- allow(sender).to receive(:ssl?).and_return(true)
77
- expect(subject).to eq "https://localhost/publish"
75
+ context "ssl? is true" do
76
+ it "returns https scheme" do
77
+ allow(sender).to receive(:ssl?).and_return(true)
78
+ expect(subject).to eq "https://localhost/publish"
79
+ end
80
+ end
81
+
82
+ context "ssl? is false" do
83
+ it "returns http scheme" do
84
+ expect(subject).to eq "http://localhost/publish"
85
+ end
86
+ end
87
+
88
+ context "path is configured" do
89
+ before do
90
+ Nagareboshi.configure do |config|
91
+ config.path = 'callback'
92
+ end
93
+ end
94
+ it "returns configured path" do
95
+ expect(subject).to eq "http://localhost/callback"
96
+ end
97
+ end
98
+ end
99
+
100
+ describe "port" do
101
+ subject { sender.send(:port) }
102
+
103
+ context "use_ssl? is false" do
104
+ it "returns 80" do
105
+ expect(subject).to eq(80)
106
+ end
78
107
  end
79
108
 
80
- it "ssl? is false" do
81
- expect(subject).to eq "http://localhost/publish"
109
+ context "use_ssl? is true" do
110
+ it "returns 443" do
111
+ allow(Nagareboshi.configuration).to receive(:use_ssl).and_return(true)
112
+ expect(subject).to eq(443)
113
+ end
114
+ end
115
+
116
+ context "port is configured" do
117
+ before do
118
+ Nagareboshi.configure do |config|
119
+ config.port = 3000
120
+ end
121
+ end
122
+ it "returns configured value" do
123
+ expect(subject).to eq(3000)
124
+ end
82
125
  end
83
126
  end
84
127
 
@@ -5,17 +5,21 @@ describe Nagareboshi do
5
5
  expect(Nagareboshi::VERSION).to_not be_nil
6
6
  end
7
7
 
8
- context 'configure set host send use_ssl' do
8
+ context 'configure set host send use_ssl port' do
9
9
  before do
10
10
  Nagareboshi.configure do |config|
11
11
  config.host = 'localhost'
12
12
  config.send = true
13
13
  config.use_ssl = false
14
+ config.port = 3000
15
+ config.path = 'callback'
14
16
  end
15
17
  end
16
18
 
17
19
  it { expect(Nagareboshi.configuration.host).to eq 'localhost' }
18
20
  it { expect(Nagareboshi.configuration.send).to be_truthy }
19
21
  it { expect(Nagareboshi.configuration.use_ssl).to be_falsy }
22
+ it { expect(Nagareboshi.configuration.port).to eq 3000 }
23
+ it { expect(Nagareboshi.configuration.path).to eq 'callback'}
20
24
  end
21
25
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagareboshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - shiro16
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2017-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Throw URL to google pubsubhubbub
@@ -73,9 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .rspec
78
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
79
  - Gemfile
80
80
  - LICENSE.txt
81
81
  - README.md
@@ -100,17 +100,17 @@ require_paths:
100
100
  - lib
101
101
  required_ruby_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - '>='
103
+ - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.0.3
113
+ rubygems_version: 2.6.13
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Throw URL to google pubsubhubbub