openname 0.4.5 → 0.4.6
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 +23 -2
- 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: 705f4e6507cdc4bc319d73049bc0fd86718e6bf7
|
4
|
+
data.tar.gz: 4a16f225b085126c81554f76fc89a6bee31867f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 323f7a3cd7700cbd7facd700caa6b92b7c33d991875d7811c3ff14056bf26f35ac418aaa00b400e97b7ec3657d691ce8e25679ffd3588a6c5850b8ef46ce498d
|
7
|
+
data.tar.gz: dce4db795b99e89cfd520c98aa97e971909242d10d5de884698bcc136bddc1400c6138c14971d0cf9299ab93bda06fdd14e7c650f3069ba49e7836dc95e02383
|
data/lib/openname.rb
CHANGED
@@ -16,6 +16,8 @@ module Openname
|
|
16
16
|
|
17
17
|
@@endpoint = nil
|
18
18
|
|
19
|
+
@@suffix = ".json"
|
20
|
+
|
19
21
|
##
|
20
22
|
# Current endpoint used by the library
|
21
23
|
def self.endpoint
|
@@ -26,6 +28,23 @@ module Openname
|
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
31
|
+
##
|
32
|
+
# Set suffix appended to openname to +suffix+
|
33
|
+
# if +suffix+ is +nil+, no suffix will be appended
|
34
|
+
def self.suffix=(suffix)
|
35
|
+
@@suffix = suffix
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Suffix appended to openname on each endpoint request
|
40
|
+
def self.suffix
|
41
|
+
if @@suffix.nil?
|
42
|
+
return ""
|
43
|
+
else
|
44
|
+
return @@suffix
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
29
48
|
##
|
30
49
|
# Set endpoint to +url+
|
31
50
|
# if +url+ is +nil+, +DEFAULT_ENDPOINT+ is used as the endpoint
|
@@ -33,6 +52,8 @@ module Openname
|
|
33
52
|
@@endpoint = url
|
34
53
|
end
|
35
54
|
|
55
|
+
|
56
|
+
|
36
57
|
##
|
37
58
|
# Check if the given +openname+ is in proper format
|
38
59
|
# Does not downcase input
|
@@ -44,7 +65,7 @@ module Openname
|
|
44
65
|
# Retrieve JSON data stored in Openname record
|
45
66
|
def self.get_json(openname)
|
46
67
|
raise ArgumentError.new("#{openname} is not a valid Openname") if !self.valid?(openname)
|
47
|
-
uri = URI(self.endpoint + "/#{openname.downcase}.
|
68
|
+
uri = URI(self.endpoint + "/#{openname.downcase}#{self.suffix}")
|
48
69
|
http = Net::HTTP.new(uri.host,uri.port)
|
49
70
|
http.use_ssl = uri.scheme == "https" ? true : false
|
50
71
|
req = Net::HTTP::Get.new(uri.path, {'User-Agent' => USERAGENT})
|
@@ -124,7 +145,7 @@ module Openname
|
|
124
145
|
@instagram_username = json["instagram"]["username"] if json["instagram"]
|
125
146
|
@linkedin_url = json["linkedin"]["url"] if json["linkedin"]
|
126
147
|
@bitcoin_address = json["bitcoin"]["address"] if json["bitcoin"]
|
127
|
-
@bitmessage_address = json["bitmessage"]["
|
148
|
+
@bitmessage_address = json["bitmessage"]["address"] if json["bitmessage"]
|
128
149
|
@bitcoinotc_username = json["bitcoinotc"]["username"] if json["bitcoinotc"]
|
129
150
|
@pgp_fingerprint = json["pgp"]["fingerprint"] if json["pgp"]
|
130
151
|
@pgp_url = json["pgp"]["url"] if json["pgp"]
|
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.6
|
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-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|