rmholl0/dsb_client — pull request #1 by cokernel (2013-05-31 15:33:44+00:00)
Title: Add task handler for Get DAITSS Identifier

I've added a sample daemon, the Get DAITSS Identifier task handler. The identifier properly enforces the DAITSS SIP identifier rules, as well as some additional draft rules for Presence identifiers (perhaps we should talk about whether we need those additional rules or not).

Normalization is handled very roughly: first we truncate down to MAX_LENGTH characters, then any disallowed characters are turned into underscores. (This character is valid in any position for both sets of rules, but my code assumes it rather than assuring it.)

As a side note, if you want this to be more daemonic, you might replace Dsb::GetDaitssIdentifier's #run method (currently included from Dsb::Daemon) with something more like

```ruby
def initialize options
# ...
@delay = options[:delay] || 30
end

def run
while true
perform_task if claim_task
sleep @delay
end
end
```

I'm on the fence about whether to include the loop in Dsb::Daemon directly.