pnut 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -13
- data/lib/pnut/version.rb +1 -1
- 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: 9b2a3a8f1260f96e01bdf32d7df84081c7947db3e3f4bc8c38de75e88c6b0ceb
|
4
|
+
data.tar.gz: 4d46cce57a1453efb6ed7ac760c15e1f461c2de5e0b78fcd4a14e91ae5173379
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 253def5b328479e324be828a6f5789541a6974146f023d3a01528b3d9c83f9726df40690c22bdaafdeb17f8f133438bf0ff7610f5777fa90c532440c53db9526
|
7
|
+
data.tar.gz: 87a5eefdbfad35a00a9ad0cfe5f66bae5f43a44414b8549fb6c561d3a30890da31b615110efd292747e359c7d017d29c7c5ba1d679947c1e4b37e8079f17593d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,18 +20,26 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
The goal of the project is to provide a convenient method for every possible endpoint. For example, if you want to fetch the global timeline and get back
|
23
|
+
The goal of the project is to provide a convenient method for every possible endpoint. For example, if you want to fetch the global timeline and get back struct containing "meta" and "data" as described in the [official documentation of the pnut.io API](https://pnut.io/docs/api/implementation/overview):
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
require "pnut"
|
27
27
|
|
28
28
|
pnut = Pnut::Client.new
|
29
|
-
pnut.global
|
29
|
+
response = pnut.global
|
30
|
+
|
31
|
+
p response.meta # meta response with HTTP status code etc.
|
32
|
+
p response.data # data response, an array of the current posts
|
30
33
|
```
|
31
34
|
|
32
|
-
|
35
|
+
Most endpoints need a proper Bearer token for authorization. Simply initialize like this to get access:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
pnut = Pnut::Client.new(:authorization_token: "YOURTOKEN")
|
39
|
+
pnut.unified
|
40
|
+
```
|
33
41
|
|
34
|
-
If we didn't implement an endpoint yet, you can use the `request` method to send custom requests:
|
42
|
+
If we didn't implement an endpoint yet (check the Gems docs to see what is available), you can use the `request` method to send custom requests:
|
35
43
|
|
36
44
|
```ruby
|
37
45
|
require "pnut"
|
@@ -40,13 +48,6 @@ pnut = Pnut::Client.new
|
|
40
48
|
pnut.request("/posts/streams/global")
|
41
49
|
```
|
42
50
|
|
43
|
-
Most endpoints need a proper Bearer token for authorization. Simply initialize like this to get access:
|
44
|
-
|
45
|
-
```ruby
|
46
|
-
pnut = Pnut::Client.new(:authorization_token: "YOURTOKEN")
|
47
|
-
pnut.unified
|
48
|
-
```
|
49
|
-
|
50
51
|
For POST, DELETE, etc. request, the method signature provides the following:
|
51
52
|
|
52
53
|
```ruby
|
@@ -63,8 +64,6 @@ pnut.request(
|
|
63
64
|
|
64
65
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
65
66
|
|
66
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
67
|
-
|
68
67
|
## Contributing
|
69
68
|
|
70
69
|
Bug reports and pull requests are welcome on GitHub at https://github.com/kaiwood/pnut-ruby.
|
data/lib/pnut/version.rb
CHANGED