uservoice-ruby 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -59,27 +59,27 @@ API_KEY and API_SECRET from an API client which you can create in Admin Console
59
59
  ```ruby
60
60
  require 'uservoice-ruby'
61
61
  begin
62
- uservoice_client = UserVoice::Client.new(USERVOICE_SUBDOMAIN, API_KEY, API_SECRET)
62
+ client = UserVoice::Client.new(USERVOICE_SUBDOMAIN, API_KEY, API_SECRET)
63
63
 
64
64
  # Get users of a subdomain (requires trusted client, but no user)
65
- users = uservoice_client.get("/api/v1/users.json?per_page=3")['users']
65
+ users = client.get("/api/v1/users.json?per_page=3")['users']
66
66
  users.each do |user|
67
67
  puts "User: \"#{user['name']}\", Profile URL: #{user['url']}"
68
68
  end
69
69
 
70
70
  # Now, let's login as mailaddress@example.com, a regular user
71
- uservoice_client.login_as('mailaddress@example.com')
71
+ regular_access_token = client.login_as('mailaddress@example.com')
72
72
 
73
73
  # Example request #1: Get current user.
74
- user = uservoice_client.get("/api/v1/users/current.json")['user']
74
+ user = regular_access_token.get("/api/v1/users/current.json")['user']
75
75
 
76
76
  puts "User: \"#{user['name']}\", Profile URL: #{user['url']}"
77
77
 
78
78
  # Login as account owner
79
- uservoice_client.login_as_owner
79
+ owner_access_token = client.login_as_owner
80
80
 
81
81
  # Example request #2: Create a new private forum limited to only example.com email domain.
82
- forum = uservoice_client.post("/api/v1/forums.json", :forum => {
82
+ forum = owner_access_token.post("/api/v1/forums.json", :forum => {
83
83
  :name => 'Example.com Private Feedback',
84
84
  :private => true,
85
85
  :allow_by_email_domain => true,
@@ -106,19 +106,19 @@ your site permission to access his or her data in UserVoice.
106
106
  require 'uservoice-ruby'
107
107
  CALLBACK_URL = 'http://localhost:3000/' # your site
108
108
 
109
- uservoice_client = UserVoice::Client.new(USERVOICE_SUBDOMAIN, API_KEY, API_SECRET, :callback => CALLBACK_URL)
109
+ client = UserVoice::Client.new(USERVOICE_SUBDOMAIN, API_KEY, API_SECRET, :callback => CALLBACK_URL)
110
110
 
111
- # At this point you want to print/redirect to uservoice_client.authorize_url in your application.
111
+ # At this point you want to print/redirect to client.authorize_url in your application.
112
112
  # Here we just output them as this is a command-line example.
113
- puts "1. Go to #{uservoice_client.authorize_url} and click \"Allow access\"."
113
+ puts "1. Go to #{client.authorize_url} and click \"Allow access\"."
114
114
  puts "2. Then type the oauth_verifier which is passed as a GET parameter to the callback URL:"
115
115
 
116
116
  # In a web app we would get the oauth_verifier through a redirect from UserVoice (after a redirection back to CALLBACK_URL).
117
117
  # In this command-line example we just read it from stdin:
118
- uservoice_client.login_verified_user(gets.match('\w*').to_s)
118
+ access_token = client.login_with_verifier(gets.match('\w*').to_s)
119
119
 
120
120
  # All done. Now we can read the current user to know user's email address:
121
- user = uservoice_client.get("/api/v1/users/current.json")['user']
121
+ user = access_token.get("/api/v1/users/current.json")['user']
122
122
 
123
123
  puts "User logged in, Name: #{user['name']}, email: #{user['email']}"
124
124
  ```
@@ -62,7 +62,7 @@ module UserVoice
62
62
  end
63
63
 
64
64
  def login_with_verifier(oauth_verifier)
65
- token = request_token.get_access_token(:oauth_verifier => oauth_verifier)
65
+ token = @request_token.get_access_token(:oauth_verifier => oauth_verifier)
66
66
  Client.new(@consumer, :oauth_token => token.token, :oauth_token_secret => token.secret)
67
67
  end
68
68
 
@@ -84,7 +84,7 @@ module UserVoice
84
84
  end
85
85
 
86
86
  def request_token
87
- @consumer.get_request_token(:oauth_callback => @callback)
87
+ @request_token = @consumer.get_request_token(:oauth_callback => @callback)
88
88
  end
89
89
 
90
90
  def login_as_owner(&block)
@@ -1,3 +1,3 @@
1
1
  module Uservoice
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uservoice-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70098446795240 !ruby/object:Gem::Requirement
16
+ requirement: &70298322131380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.0.5
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70098446795240
24
+ version_requirements: *70298322131380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: ezcrypto
27
- requirement: &70098446794700 !ruby/object:Gem::Requirement
27
+ requirement: &70298322130780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.7.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70098446794700
35
+ version_requirements: *70298322130780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: json
38
- requirement: &70098446794200 !ruby/object:Gem::Requirement
38
+ requirement: &70298322129960 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.7.5
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70098446794200
46
+ version_requirements: *70298322129960
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: oauth
49
- requirement: &70098446793740 !ruby/object:Gem::Requirement
49
+ requirement: &70298322129160 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 0.4.7
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70098446793740
57
+ version_requirements: *70298322129160
58
58
  description: The gem provides Ruby-bindings to UserVoice API and helps generating
59
59
  Single-Sign-On tokens.
60
60
  email: