btfy_client 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +1 -1
- data/README.md +13 -2
- data/lib/btfy_client/requests/create_link_request.rb +15 -3
- data/lib/btfy_client/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: a83eeaa6931feb610061e61d6925263e9ea51c10b7fdf7c4e1b3a18f633bd15d
|
4
|
+
data.tar.gz: ef7eb9712e97bf5f072e5edf51f260def9890f8adab7ccaf9104ed51948f8561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ee719ff3a178a7461086ed61d85ba70437ff10de78d1ffd713fdca49664b1cc8db570f0a61e2e32902b312b3bb317f620987c27a301c2baa700896eb6370e4f
|
7
|
+
data.tar.gz: 54ae516dcb64ac5df0587741ac9b0091bde992202162f7ad3ff381a67d6cea11a3467ac4314608d3427f5e7a0ead5f3bb6f9700c6422ff8ca8b552db60099c8b
|
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
-
## [
|
7
|
+
## [0.3.0] - 2020-09-06
|
8
|
+
### Added
|
9
|
+
- add `name` and `slug` request params
|
10
|
+
|
11
|
+
## [0.2.0] - 2020-09-06
|
12
|
+
### Added
|
8
13
|
- `create_link` also returns a `BtfyClient::Link` class
|
9
14
|
|
10
15
|
## [0.1.0] - 2020-09-06
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,13 +21,24 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
```
|
24
|
+
# Ruby
|
24
25
|
client = BtfyClient.new(
|
25
26
|
host: "https://btfy.io",
|
26
27
|
api_token: "your api token",
|
27
28
|
)
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
# Rails (in your initializer)
|
31
|
+
BtfyClient.configure do |config|
|
32
|
+
config.host = "https://btfy.io"
|
33
|
+
config.api_token = "your api token"
|
34
|
+
end
|
35
|
+
|
36
|
+
response = client.create_link(
|
37
|
+
destination_url: "the link you want to shorten",
|
38
|
+
name: "name of link (this is optional)",
|
39
|
+
slug: "also optional",
|
40
|
+
)
|
41
|
+
response.link # BtfyClient::Link
|
31
42
|
```
|
32
43
|
|
33
44
|
## Development
|
@@ -3,9 +3,11 @@ module BtfyClient
|
|
3
3
|
|
4
4
|
include APIClientBase::Request
|
5
5
|
|
6
|
-
attribute :host,
|
7
|
-
attribute :api_token,
|
6
|
+
attribute :host, String
|
7
|
+
attribute :api_token, String
|
8
8
|
attribute :destination_url, String
|
9
|
+
attribute :name, String
|
10
|
+
attribute :slug, String
|
9
11
|
|
10
12
|
def headers
|
11
13
|
{
|
@@ -15,7 +17,17 @@ module BtfyClient
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def body
|
18
|
-
{ destination_url: destination_url }
|
20
|
+
body = { destination_url: destination_url }
|
21
|
+
|
22
|
+
if name.present?
|
23
|
+
body = body.merge(name: name)
|
24
|
+
end
|
25
|
+
|
26
|
+
if slug.present?
|
27
|
+
body = body.merge(slug: slug)
|
28
|
+
end
|
29
|
+
|
30
|
+
body.to_json
|
19
31
|
end
|
20
32
|
|
21
33
|
private
|
data/lib/btfy_client/version.rb
CHANGED