ticketevolution/ticketevolution-ruby — Issue #1: Wrong base_path for CamelCased EndPoints
Author: onemanarmy
Created: 2012-01-31 00:15:55+00:00
State: open

The base_path for TicketGroups is "ticketgroups", which is incorrect, resulting in a 301 when listing, showing, etc.

```ruby
# tevo = valid TicketEvolution::Connection
tevo.ticket_groups.base_path
=> "/ticketgroups"
```

I'm afraid I know nothing about submitting a patch or writing gems, or I would attempt, but for now, this code seems to solve the issue for me in my Rails app. The difference is the **underscore** method:

```ruby
module TicketEvolution
class Endpoint < Base
def base_path
[].tap do |parts|
parts << parent.base_path if parent.kind_of? TicketEvolution::Endpoint
parts << "/"+self.class.to_s.split('::').last.underscore.downcase.pluralize
parts << "/#{self.id}" if self.respond_to?(:id) and self.id.present?
end.join
end

def endpoint_name
self.class.name.demodulize.underscore.downcase
end
end
end
```

Hope this helps.