Class: Standupguy::Item::TicketUrl
- Inherits:
-
Struct
- Object
- Struct
- Standupguy::Item::TicketUrl
- Defined in:
- lib/Standupguy.rb
Constant Summary collapse
- CLASSIC_TICKET =
%r{https?:\/\/(.*?)\.zendesk.com\/[a-z].*?\/(.*)}- LOTUS_TICKET =
%r{https?:\/\/(.*?)\.zendesk.com\/agent\/#?\/?tickets\/(\d+)\/?.*?}
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#subdomain ⇒ Object
Returns the value of attribute subdomain.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ TicketUrl
constructor
A new instance of TicketUrl.
- #valid? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ TicketUrl
241 242 243 244 245 246 247 |
# File 'lib/Standupguy.rb', line 241 def initialize(url) [LOTUS_TICKET, CLASSIC_TICKET].each do |pattern| subdomain, id = url.downcase.scan(pattern).flatten super(url, subdomain, id) return if self.valid? end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
237 238 239 |
# File 'lib/Standupguy.rb', line 237 def id @id end |
#subdomain ⇒ Object
Returns the value of attribute subdomain
237 238 239 |
# File 'lib/Standupguy.rb', line 237 def subdomain @subdomain end |
#url ⇒ Object
Returns the value of attribute url
237 238 239 |
# File 'lib/Standupguy.rb', line 237 def url @url end |
Instance Method Details
#valid? ⇒ Boolean
249 250 251 |
# File 'lib/Standupguy.rb', line 249 def valid? !(id.nil? && subdomain.nil?) end |