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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: deb759cc8301ab7a4afc6f39b26052adfe020aa8
4
- data.tar.gz: b9be723d97240c48c0c5c55587a76408e7a69a45
3
+ metadata.gz: 705f4e6507cdc4bc319d73049bc0fd86718e6bf7
4
+ data.tar.gz: 4a16f225b085126c81554f76fc89a6bee31867f8
5
5
  SHA512:
6
- metadata.gz: 7a6f242f8e2e8c6e5ad849ca61a4b26331ff136f6ea175267683ee49b4ead67b8629da20ca73f0ffcb27049ef994b7d85ace08cdfde34b94d425e17144363a3a
7
- data.tar.gz: 1e9294c426d7ee0269ac8f2c21f5c2ec456aea4db63a31a1ce5847844ee84472f9a23538c48b52de22b64bae14bf4a5ebfa6ce27b7b84be571be96c60de023c5
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}.json")
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"]["username"] if 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"]
@@ -1,3 +1,3 @@
1
1
  module Openname
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
3
3
  end
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.5
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-02-23 00:00:00.000000000 Z
11
+ date: 2015-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler