twurl 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module Twurl
2
2
  class AliasesController < AbstractCommandController
3
- NO_ALIASES_MESSAGE = "No aliases exist. Set one this way: twurl alias h /1/statuses/home_timeline.xml"
4
- NO_PATH_PROVIDED_MESSAGE = "No path was provided to alias. Paths must start with a forward slash (ex. /1/statuses/update.xml)."
3
+ NO_ALIASES_MESSAGE = "No aliases exist. Set one this way: twurl alias h /1.1/statuses/home_timeline.json"
4
+ NO_PATH_PROVIDED_MESSAGE = "No path was provided to alias. Paths must start with a forward slash (ex. /1.1/statuses/update.json)."
5
5
  def dispatch
6
6
  case options.subcommands.size
7
7
  when 0
@@ -51,7 +51,7 @@ module Twurl
51
51
 
52
52
  OAUTH_CLIENT_OPTIONS = %w[username consumer_key consumer_secret token secret]
53
53
  attr_reader *OAUTH_CLIENT_OPTIONS
54
- attr_reader :password
54
+ attr_reader :username, :password
55
55
  def initialize(options = {})
56
56
  @username = options['username']
57
57
  @password = options['password']
@@ -91,7 +91,7 @@ module Twurl
91
91
  end
92
92
 
93
93
  def client_auth_parameters
94
- {:x_auth_username => username, :x_auth_password => password, :x_auth_mode => 'client_auth'}
94
+ {'x_auth_username' => username, 'x_auth_password' => password, 'x_auth_mode' => 'client_auth'}
95
95
  end
96
96
 
97
97
  def perform_pin_authorize_workflow
@@ -113,11 +113,11 @@ module Twurl
113
113
  end
114
114
 
115
115
  def pin_auth_parameters
116
- {:oauth_callback => 'oob'}
116
+ {'oauth_callback' => 'oob'}
117
117
  end
118
118
 
119
119
  def fetch_verify_credentials
120
- access_token.get('/1/account/verify_credentials.json')
120
+ access_token.get('/1.1/account/verify_credentials.json?include_entities=false&skip_status=true')
121
121
  end
122
122
 
123
123
  def authorized?
@@ -2,7 +2,7 @@ module Twurl
2
2
  module VERSION
3
3
  MAJOR = 0 unless defined? MAJOR
4
4
  MINOR = 8 unless defined? MINOR
5
- PATCH = 0 unless defined? PATCH
5
+ PATCH = 1 unless defined? PATCH
6
6
  BETA = nil unless defined? BETA # Time.now.to_i.to_s
7
7
  end
8
8
 
@@ -25,8 +25,8 @@ class Twurl::AliasesController::DispatchTest < MiniTest::Unit::TestCase
25
25
  def test_when_no_subcommands_are_provided_and_aliases_exist_they_are_displayed
26
26
  assert options.subcommands.empty?
27
27
 
28
- Twurl::OAuthClient.rcfile.alias('h', '/1/statuses/home_timeline.xml')
29
- mock(Twurl::CLI).puts("h: /1/statuses/home_timeline.xml").times(1)
28
+ Twurl::OAuthClient.rcfile.alias('h', '/1.1/statuses/home_timeline.json')
29
+ mock(Twurl::CLI).puts("h: /1.1/statuses/home_timeline.json").times(1)
30
30
 
31
31
  controller = Twurl::AliasesController.new(client, options)
32
32
  controller.dispatch
@@ -34,8 +34,8 @@ class Twurl::AliasesController::DispatchTest < MiniTest::Unit::TestCase
34
34
 
35
35
  def test_when_alias_and_value_are_provided_they_are_added
36
36
  options.subcommands = ['h']
37
- options.path = '/1/statuses/home_timeline.xml'
38
- mock(Twurl::OAuthClient.rcfile).alias('h', '/1/statuses/home_timeline.xml').times(1)
37
+ options.path = '/1.1/statuses/home_timeline.json'
38
+ mock(Twurl::OAuthClient.rcfile).alias('h', '/1.1/statuses/home_timeline.json').times(1)
39
39
 
40
40
  controller = Twurl::AliasesController.new(client, options)
41
41
  controller.dispatch
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/test_helper'
3
3
  class Twurl::CLI::OptionParsingTest < MiniTest::Unit::TestCase
4
4
  module CommandParsingTests
5
5
  def test_no_command_specified_falls_to_default_command
6
- options = Twurl::CLI.parse_options(['/1/url/does/not/matter.xml'])
6
+ options = Twurl::CLI.parse_options(['/1.1/url/does/not/matter.json'])
7
7
  assert_equal Twurl::CLI::DEFAULT_COMMAND, options.command
8
8
  end
9
9
 
@@ -23,14 +23,14 @@ class Twurl::CLI::OptionParsingTest < MiniTest::Unit::TestCase
23
23
 
24
24
  module RequestMethodParsingTests
25
25
  def test_request_method_is_default_if_unspecified
26
- options = Twurl::CLI.parse_options(['/1/url/does/not/matter.xml'])
26
+ options = Twurl::CLI.parse_options(['/1.1/url/does/not/matter.json'])
27
27
  assert_equal Twurl::Options::DEFAULT_REQUEST_METHOD, options.request_method
28
28
  end
29
29
 
30
30
  def test_specifying_a_request_method_extracts_and_normalizes_request_method
31
31
  variations = [%w[-X put], %w[-X PUT], %w[--request-method PUT], %w[--request-method put]]
32
32
  variations.each do |option_variation|
33
- path = '/1/url/does/not/matter.xml'
33
+ path = '/1.1/url/does/not/matter.json'
34
34
  order_variant_1 = [option_variation, path].flatten
35
35
  order_variant_2 = [path, option_variation].flatten
36
36
  [order_variant_1, order_variant_2].each do |args|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twurl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-09-26 00:00:00.000000000 Z
13
+ date: 2012-10-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: oauth