safie 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/README.md +21 -1
- data/VERSION +1 -1
- data/lib/safie/access_token.rb +1 -0
- data/lib/safie/exception.rb +0 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b7444d439aa66efb03c9fdc3b2cf6dd03f96951429f9038822edd7a59f3acb3
|
4
|
+
data.tar.gz: 5fcd0abfe944c2a7341f556bb1ff8d3b78f54013af919639ee4fd1e41bc6a859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69457a9a32d138f6945ccc301c083c988831031088b638b1ae21b3b6cd6eba99dbc5e562e718f3fb8d9530a21fc00c054faa6c89390d88ec73c21ac64834d944
|
7
|
+
data.tar.gz: 1aeab6ecc8e24934e099a6f569e302fa3523837419a673371a5caa71e8760b5c939886def5987152a2dbd4f5dd65a33b00b3e4e9def93e94844c3780a1a4d2f9
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,27 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
```ruby
|
26
|
+
require 'safie'
|
27
|
+
|
28
|
+
client = Safie::Client.new(
|
29
|
+
identifier: 'client_id',
|
30
|
+
secret: 'client_secret',
|
31
|
+
redirect_uri: 'https://client.example.com/callback'
|
32
|
+
)
|
33
|
+
|
34
|
+
authorization_uri = client.authorization_uri(
|
35
|
+
state: SecureRandom.hex(8)
|
36
|
+
)
|
37
|
+
puts authorization_uri
|
38
|
+
`open "#{authorization_uri}"`
|
39
|
+
|
40
|
+
print 'code: ' and STDOUT.flush
|
41
|
+
code = gets.chop
|
42
|
+
client.authorization_code = code
|
43
|
+
access_token = client.access_token!
|
44
|
+
access_token.token_info!
|
45
|
+
```
|
26
46
|
|
27
47
|
## Development
|
28
48
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/safie/access_token.rb
CHANGED
data/lib/safie/exception.rb
CHANGED
@@ -1,15 +1,6 @@
|
|
1
1
|
module Safie
|
2
2
|
class Exception < StandardError; end
|
3
3
|
|
4
|
-
class ValidationFailed < Exception
|
5
|
-
attr_reader :object
|
6
|
-
|
7
|
-
def initialize(object)
|
8
|
-
super object.errors.full_messages.to_sentence
|
9
|
-
@object = object
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
4
|
class HttpError < Exception
|
14
5
|
attr_accessor :status, :response
|
15
6
|
def initialize(status, message = nil, response = nil)
|