Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updates for API v1.1

  • Loading branch information...
commit db510c0fac076427658cce6ef40af586781dbf1b 1 parent 3fe548e
@sferik sferik authored
View
4 lib/twurl/aliases_controller.rb
@@ -1,7 +1,7 @@
module Twurl
class AliasesController < AbstractCommandController
- NO_ALIASES_MESSAGE = "No aliases exist. Set one this way: twurl alias h /1/statuses/home_timeline.xml"
- NO_PATH_PROVIDED_MESSAGE = "No path was provided to alias. Paths must start with a forward slash (ex. /1/statuses/update.xml)."
+ NO_ALIASES_MESSAGE = "No aliases exist. Set one this way: twurl alias h /1.1/statuses/home_timeline.json"
+ NO_PATH_PROVIDED_MESSAGE = "No path was provided to alias. Paths must start with a forward slash (ex. /1.1/statuses/update.json)."
def dispatch
case options.subcommands.size
when 0
View
4 lib/twurl/oauth_client.rb
@@ -51,7 +51,7 @@ def load_default_client
OAUTH_CLIENT_OPTIONS = %w[username consumer_key consumer_secret token secret]
attr_reader *OAUTH_CLIENT_OPTIONS
- attr_reader :password
+ attr_reader :username, :password
def initialize(options = {})
@username = options['username']
@password = options['password']
@@ -117,7 +117,7 @@ def pin_auth_parameters
end
def fetch_verify_credentials
- access_token.get('/1/account/verify_credentials.json')
+ access_token.get('/1.1/account/verify_credentials.json?include_entities=false&skip_status=true')
end
def authorized?
View
8 test/alias_controller_test.rb
@@ -25,8 +25,8 @@ def test_when_no_subcommands_are_provided_and_no_aliases_exist_nothing_is_displa
def test_when_no_subcommands_are_provided_and_aliases_exist_they_are_displayed
assert options.subcommands.empty?
- Twurl::OAuthClient.rcfile.alias('h', '/1/statuses/home_timeline.xml')
- mock(Twurl::CLI).puts("h: /1/statuses/home_timeline.xml").times(1)
+ Twurl::OAuthClient.rcfile.alias('h', '/1.1/statuses/home_timeline.json')
+ mock(Twurl::CLI).puts("h: /1.1/statuses/home_timeline.json").times(1)
controller = Twurl::AliasesController.new(client, options)
controller.dispatch
@@ -34,8 +34,8 @@ def test_when_no_subcommands_are_provided_and_aliases_exist_they_are_displayed
def test_when_alias_and_value_are_provided_they_are_added
options.subcommands = ['h']
- options.path = '/1/statuses/home_timeline.xml'
- mock(Twurl::OAuthClient.rcfile).alias('h', '/1/statuses/home_timeline.xml').times(1)
+ options.path = '/1.1/statuses/home_timeline.json'
+ mock(Twurl::OAuthClient.rcfile).alias('h', '/1.1/statuses/home_timeline.json').times(1)
controller = Twurl::AliasesController.new(client, options)
controller.dispatch
View
6 test/cli_test.rb
@@ -3,7 +3,7 @@
class Twurl::CLI::OptionParsingTest < MiniTest::Unit::TestCase
module CommandParsingTests
def test_no_command_specified_falls_to_default_command
- options = Twurl::CLI.parse_options(['/1/url/does/not/matter.xml'])
+ options = Twurl::CLI.parse_options(['/1.1/url/does/not/matter.json'])
assert_equal Twurl::CLI::DEFAULT_COMMAND, options.command
end
@@ -23,14 +23,14 @@ def test_unsupported_command_specified_sets_default_command
module RequestMethodParsingTests
def test_request_method_is_default_if_unspecified
- options = Twurl::CLI.parse_options(['/1/url/does/not/matter.xml'])
+ options = Twurl::CLI.parse_options(['/1.1/url/does/not/matter.json'])
assert_equal Twurl::Options::DEFAULT_REQUEST_METHOD, options.request_method
end
def test_specifying_a_request_method_extracts_and_normalizes_request_method
variations = [%w[-X put], %w[-X PUT], %w[--request-method PUT], %w[--request-method put]]
variations.each do |option_variation|
- path = '/1/url/does/not/matter.xml'
+ path = '/1.1/url/does/not/matter.json'
order_variant_1 = [option_variation, path].flatten
order_variant_2 = [path, option_variation].flatten
[order_variant_1, order_variant_2].each do |args|
Please sign in to comment.
Something went wrong with that request. Please try again.