plangrade-ruby 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e619eacc7d4a878d10fec701d501d8bf0ef296b4
4
- data.tar.gz: 236a3735f4ce32ba02db731335bbeab08b80633c
3
+ metadata.gz: b4534d0455ce323b5b9a3895c1cb98889da6bb52
4
+ data.tar.gz: ad8e35b7ce70f104c6981c7d78394a3ebcfa2113
5
5
  SHA512:
6
- metadata.gz: 288c51bd0973e2380d1ebc1b78736c3f6b53d44ec8c6f5d21cd1da6b2ceac48c1fd54d83ea13d04a896999feff3d038a4de17ec0ac60200cf74c27f8e4bfefab
7
- data.tar.gz: d1fcfe4ff3e727c1c5b90477df4fb53db1c9561ace5d3ceb0696b2a9347ba0bd4f94f1b4f0ae47146511c434b4624af0df9104966c65af03e1288270c5b66214
6
+ metadata.gz: 79a7c8509b7571d148eedc7de8ca6e29068f922f7d7097134e1963bdd608697cba738083c10832cfa15ea041cce9847ed8830b282e5bef49deefe87ec94ad382
7
+ data.tar.gz: 1f84282566199f2d4063b70f7b25ff6570a44011ea1801e7f50882867039fb46b451794cefdc77b82cc342dde652271645b979dd076fd30b4c45e24d586bdf99
checksums.yaml.gz.sig CHANGED
Binary file
@@ -16,24 +16,6 @@ module Plangrade
16
16
  self
17
17
  end
18
18
 
19
- # Generates the Plangrade URL that the user will be redirected to in order to
20
- # authorize your application
21
- #
22
- # @see http://docs.plangrade.com/#request-authorization
23
- #
24
- # @opts [Hash] additional parameters to be include in URL eg. scope, state, etc
25
- #
26
- # >> client = Plangrade::OAuth2Client.new('ETSIGVSxmgZitijWZr0G6w', '4bJZY38TCBB9q8IpkeualA2lZsPhOSclkkSKw3RXuE')
27
- # >> client.webclient_authorization_url({
28
- # :redirect_uri => 'http://localhost:3000/auth/plangrade/callback',
29
- # })
30
- # >> https://plangrade.com/oauth/authorize/?client_id={client_id}&
31
- # redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2F%2Fplangrade%2Fcallback&response_type=token
32
- #
33
- def webclient_authorization_url(opts={})
34
- implicit.token_url(opts)
35
- end
36
-
37
19
  # Generates the Plangrade URL that the user will be redirected to in order to
38
20
  # authorize your application
39
21
  #
@@ -61,7 +43,7 @@ module Plangrade
61
43
  # @opts [Hash] may include redirect uri and other query parameters
62
44
  #
63
45
  # >> client = PlangradeClient.new(config)
64
- # >> client.access_token_from_authorization_code('G3Y6jU3a', {
46
+ # >> client.exchange_auth_code_for_token({
65
47
  # :redirect_uri => 'http://localhost:3000/auth/plangrade/callback',
66
48
  # })
67
49
  #
@@ -71,7 +53,12 @@ module Plangrade
71
53
 
72
54
  # client_id={client_id}&code=G3Y6jU3a&grant_type=authorization_code&
73
55
  # redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fplangrade%2Fcallback&client_secret={client_secret}
74
- def access_token_from_authorization_code(code, opts={})
56
+ def exchange_auth_code_for_token(opts={})
57
+ unless (opts[:params] && opts[:params][:code])
58
+ raise ArgumentError.new("You must include an authorization code as a parameter")
59
+ end
60
+ opts[:authenticate] ||= :body
61
+ code = opts[:params].delete(:code)
75
62
  authorization_code.get_token(code, opts)
76
63
  end
77
64
 
@@ -83,8 +70,8 @@ module Plangrade
83
70
  # @opts [Hash] may include scope and other parameters
84
71
  #
85
72
  # >> client = PlangradeClient.new(config)
86
- # >> client.refresh!('G3Y6jU3a', {
87
- # :scope => 'abc, xyz',
73
+ # >> client.refresh_access_token({
74
+ # :refresh_token => 'asdfsadgrwerwet234523sdf',
88
75
  # })
89
76
  #
90
77
  # POST /oauth/token HTTP/1.1
@@ -93,10 +80,13 @@ module Plangrade
93
80
 
94
81
  # client_id={client_id}&refresh_token=G3Y6jU3a&grant_type=refresh_token&
95
82
  # client_secret={client_secret}
96
- def refresh!(ref_token, opts={})
97
- opts[:authenticate] ||= :body
98
- token = refresh_token.get_token(ref_token, opts)
99
- return token
83
+ def refresh_access_token(opts={})
84
+ unless (opts[:params] && opts[:params][:refresh_token])
85
+ raise ArgumentError.new("You must provide a refresh_token as a parameter")
86
+ end
87
+ opts[:authenticate] = :body
88
+ token = opts[:params].delete(:refresh_token)
89
+ refresh_token.get_token(token, opts)
100
90
  end
101
91
  end
102
92
  end
@@ -1,5 +1,5 @@
1
1
  module Plangrade
2
2
  module Ruby
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plangrade-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Reynoso
metadata.gz.sig CHANGED
Binary file