25-ventures/trepscore-services — pull request #6 by ryanfaerman (2014-09-04 17:01:19+00:00)
Title: Improve internal and external interface

The gem was decomposed into several files and moved into the TrepScore::Services namespace.

We also gain a few new features:

- required vs optional parameters
- retrieving data for a given time period
- automatic enforcing of required schema attributes
- custom validations for schema data
- connection test method to confirm provided data against the 3rd party service

```ruby
module TrepScore
module Services
class Pipedrive < Service
category :crm

required do
string :token
end

def call(period)
client = ::Pipedrive::Client.new(api_token: data['token'])
client.metrics(period)
end

def validate
unless data['token'].length == 28
raise_config_error('Token appears to be invalid')
end
end

def test
# Check Credentials
end
end
end
end
```