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
Returns a new instance of TicketUrl.
219 220 221 222 223 224 225 |
# File 'lib/Standupguy.rb', line 219 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
215 216 217 |
# File 'lib/Standupguy.rb', line 215 def id @id end |
#subdomain ⇒ Object
Returns the value of attribute subdomain
215 216 217 |
# File 'lib/Standupguy.rb', line 215 def subdomain @subdomain end |
#url ⇒ Object
Returns the value of attribute url
215 216 217 |
# File 'lib/Standupguy.rb', line 215 def url @url end |
Instance Method Details
#valid? ⇒ Boolean
227 228 229 |
# File 'lib/Standupguy.rb', line 227 def valid? !(id.nil? && subdomain.nil?) end |