Class: Subscription

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/octopus/models/subscription.rb

Overview

A url callback pointing to a web application or messaging system which wants to be notified about changes to a NetResource.

Instance Method Summary collapse

Instance Method Details

#validate_urlObject

Checks that the url property is formatted correctly.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/octopus/models/subscription.rb', line 25

def validate_url
  begin
    uri = ::URI.parse(self.url)
    if uri && uri.scheme == "http" || uri.scheme == "https"
      return true
    else
      return [false, "Url must be properly formatted"]
    end
  end
  rescue ::URI::InvalidURIError
end