Class: Redfinger::Client
- Inherits:
-
Object
- Object
- Redfinger::Client
- Defined in:
- lib/redfinger/client.rb
Instance Attribute Summary (collapse)
-
- (Object) account
Returns the value of attribute account.
-
- (Object) domain
Returns the value of attribute domain.
-
- (Object) uri_template
Returns the value of attribute uri_template.
-
- (Object) xrd_open_timeout
Returns the value of attribute xrd_open_timeout.
-
- (Object) xrd_timeout
Returns the value of attribute xrd_timeout.
Instance Method Summary (collapse)
- - (Object) finger
-
- (Client) initialize(email, uri_template = nil)
constructor
A new instance of Client.
- - (Object) xrd_url(ssl = true)
Constructor Details
- (Client) initialize(email, uri_template = nil)
A new instance of Client
9 10 11 12 13 14 15 |
# File 'lib/redfinger/client.rb', line 9 def initialize(email, uri_template = nil) self.account = normalize(email) self.domain = account.split('@').last self.xrd_timeout = 10 self.xrd_open_timeout = 5 end |
Instance Attribute Details
- (Object) account
Returns the value of attribute account
7 8 9 |
# File 'lib/redfinger/client.rb', line 7 def account @account end |
- (Object) domain
Returns the value of attribute domain
7 8 9 |
# File 'lib/redfinger/client.rb', line 7 def domain @domain end |
- (Object) uri_template
Returns the value of attribute uri_template
7 8 9 |
# File 'lib/redfinger/client.rb', line 7 def uri_template @uri_template end |
- (Object) xrd_open_timeout
Returns the value of attribute xrd_open_timeout
7 8 9 |
# File 'lib/redfinger/client.rb', line 7 def xrd_open_timeout @xrd_open_timeout end |
- (Object) xrd_timeout
Returns the value of attribute xrd_timeout
7 8 9 |
# File 'lib/redfinger/client.rb', line 7 def xrd_timeout @xrd_timeout end |
Instance Method Details
- (Object) finger
17 18 19 20 21 22 23 24 |
# File 'lib/redfinger/client.rb', line 17 def finger self.uri_template ||= retrieve_template_from_xrd begin return Finger.new self.account, RestClient.get(swizzle).body rescue RestClient::ResourceNotFound return Finger.new self.account, RestClient.get(swizzle(account_with_scheme)).body end end |
- (Object) xrd_url(ssl = true)
26 27 28 |
# File 'lib/redfinger/client.rb', line 26 def xrd_url(ssl = true) "http#{'s' if ssl}://#{domain}/.well-known/host-meta" end |