openname 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/openname.rb +12 -0
- data/lib/openname/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 230cf6eb56f09632379dd5c096ca5c84b9d651d0
|
4
|
+
data.tar.gz: c7a8d3bd21dbcf425d9d484f2b1ee35f51ef3835
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a56ecf26935db8e94ed934cf6ba97e4a28f83cf67f5137110420b09eb7697375e8c8e761d4af137efc6948901bdda4e91f00fd7fcf3a4d289630e44bf7efd61
|
7
|
+
data.tar.gz: afc53c53d14cb218c712bbf37ecada2ed94cadb7684db085506f2d1ebeaef92457175413e136762526667c8a47f4af9d45a8bbbe3f2e87dd9101b313c12b9818
|
data/lib/openname.rb
CHANGED
@@ -18,6 +18,9 @@ module Openname
|
|
18
18
|
|
19
19
|
@@suffix = ".json"
|
20
20
|
|
21
|
+
@@username = nil
|
22
|
+
@@password = nil
|
23
|
+
|
21
24
|
##
|
22
25
|
# Current endpoint used by the library
|
23
26
|
def self.endpoint
|
@@ -28,6 +31,14 @@ module Openname
|
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
34
|
+
##
|
35
|
+
# Send basic authentication
|
36
|
+
#
|
37
|
+
def self.auth(username, password)
|
38
|
+
@@username = username
|
39
|
+
@@password = password
|
40
|
+
end
|
41
|
+
|
31
42
|
##
|
32
43
|
# Set suffix appended to openname to +suffix+
|
33
44
|
# if +suffix+ is +nil+, no suffix will be appended
|
@@ -69,6 +80,7 @@ module Openname
|
|
69
80
|
http = Net::HTTP.new(uri.host,uri.port)
|
70
81
|
http.use_ssl = uri.scheme == "https" ? true : false
|
71
82
|
req = Net::HTTP::Get.new(uri.path, {'User-Agent' => USERAGENT})
|
83
|
+
req.basic_auth(@@username, @@password) if @@username && @@password
|
72
84
|
res = http.request(req)
|
73
85
|
case res.code.to_s
|
74
86
|
when "404" then raise NameError.new("Openname \"#{openname}\" does not exist")
|
data/lib/openname/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Larry Salibra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|