semifor / Net-Twitter

A Perl interface to the Twitter APIs
83 stars 37 forks source link

Add path_suffix option to Net::Twitter::API; tidy #22

Closed sartak closed 11 years ago

sartak commented 11 years ago

Hi Marc,

I'm starting to develop a new set of APIs with Net::Twitter. It's going really well; you've done a good job in building the twitter_api_method abstraction.

There is one detail I need though. twitter_api_method universally appends .json to every path I'm trying to request, like so:

my $uri = URI->new($self->${ \$options{base_url_method} } . "/$local_path.json");
here ------------------------------------------------------------------- ^^^^^

The API I'm working against does not use .json, so I need to be able to disable that behavior. So, in my branch I've added a path_suffix option to twitter_api_method that defaults to .json for 100% backwards compatibility. My invocations can pass an empty string for such endpoints. Everybody wins. :)

Thanks, Shawn

semifor commented 11 years ago

Thanks @sartak!