lib/yao/token.rb in yao-0.0.6 vs lib/yao/token.rb in yao-0.1.0
- old
+ new
@@ -45,19 +45,18 @@
def register_endpoints(_endpoints)
return unless _endpoints
_endpoints.each do |endpoint_data|
- key = endpoint_data["type"]
- value = if d = endpoint_data["endpoints"].first
- d["publicURL"]
- else
- nil
- end
- if value
- @endpoints[key] = value
- end
+ type = endpoint_data["type"]
+ endpoint = endpoint_data["endpoints"].first
+ urls = {}
+ urls[:public_url] = endpoint["publicURL"] if endpoint["publicURL"]
+ urls[:admin_url] = endpoint["adminURL"] if endpoint["adminURL"]
+
+ @endpoints[type] = urls
end
+
Yao.default_client.register_endpoints(@endpoints, token: self)
end
end
end