btfy_client 0.2.0 → 0.3.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
  SHA256:
3
- metadata.gz: e9e89f1c497ef21deb7f1be89fc82355581dbaaf7e00cbe8eb1a0f52359d7843
4
- data.tar.gz: 99dd4569b5cc2cd0eea5810c499a77b800529b02a70279d1e1bad8009e20d68c
3
+ metadata.gz: a83eeaa6931feb610061e61d6925263e9ea51c10b7fdf7c4e1b3a18f633bd15d
4
+ data.tar.gz: ef7eb9712e97bf5f072e5edf51f260def9890f8adab7ccaf9104ed51948f8561
5
5
  SHA512:
6
- metadata.gz: 6b24863e2fed5112b06d823f8c6173c504370d32a8779d33875d4619655ee486cd278a59450ea4a71cb625635f99b273367eb22c98bdaba72cb01342e1416ca6
7
- data.tar.gz: 524e33c7476134edd5e8e402ddbd32bb033745d0444e2fb773993c398856f71b050860d3d591a03b3c203f396091df46002f795eef661e29ca5e2f25b57bfff7
6
+ metadata.gz: 6ee719ff3a178a7461086ed61d85ba70437ff10de78d1ffd713fdca49664b1cc8db570f0a61e2e32902b312b3bb317f620987c27a301c2baa700896eb6370e4f
7
+ data.tar.gz: 54ae516dcb64ac5df0587741ac9b0091bde992202162f7ad3ff381a67d6cea11a3467ac4314608d3427f5e7a0ead5f3bb6f9700c6422ff8ca8b552db60099c8b
@@ -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
- ## [Unreleased]
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- btfy_client (0.2.0)
4
+ btfy_client (0.3.0)
5
5
  api_client_base
6
6
  typhoeus
7
7
 
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
- response = client.create_link(destination_url: "the link you want to shorten")
30
- response.body["link"]["redirect_url"] # shortened link
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, String
7
- attribute :api_token, String
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 }.to_json
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
@@ -1,3 +1,3 @@
1
1
  module BtfyClient
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: btfy_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez