btfy_client 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50a837ab940921d696b4c239ad632047ff7d8cc13435cd7ece35c7f70c8f1022
4
- data.tar.gz: 435035a369f47ca7819a397a5331eecf28689f4955af8a1a2a29cb02ef521827
3
+ metadata.gz: e9e89f1c497ef21deb7f1be89fc82355581dbaaf7e00cbe8eb1a0f52359d7843
4
+ data.tar.gz: 99dd4569b5cc2cd0eea5810c499a77b800529b02a70279d1e1bad8009e20d68c
5
5
  SHA512:
6
- metadata.gz: 064164de264969659c6565ed73f771e7e0e5f19bb398ab018fecac70932543218deb6e74ce309a048ae49680ead9bcd93783ad05e2fb82f92c77b0f00d27db41
7
- data.tar.gz: cb80e8bd883e9e0e169a79d9fd661576640c140c97c3b19664f7ec979ffa4bf8fed81489b008e8811986f806890c382373d1fa78c8df878d401237b8e2068490
6
+ metadata.gz: 6b24863e2fed5112b06d823f8c6173c504370d32a8779d33875d4619655ee486cd278a59450ea4a71cb625635f99b273367eb22c98bdaba72cb01342e1416ca6
7
+ data.tar.gz: 524e33c7476134edd5e8e402ddbd32bb033745d0444e2fb773993c398856f71b050860d3d591a03b3c203f396091df46002f795eef661e29ca5e2f25b57bfff7
@@ -5,4 +5,8 @@ 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
  ## [Unreleased]
8
+ - `create_link` also returns a `BtfyClient::Link` class
9
+
10
+ ## [0.1.0] - 2020-09-06
11
+ ### Added
8
12
  - initial endpoint `create_link`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- btfy_client (0.1.0)
4
+ btfy_client (0.2.0)
5
5
  api_client_base
6
6
  typhoeus
7
7
 
data/README.md CHANGED
@@ -32,7 +32,7 @@ response.body["link"]["redirect_url"] # shortened link
32
32
 
33
33
  ## Development
34
34
 
35
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
36
 
37
37
  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).
38
38
 
@@ -4,13 +4,14 @@ require "api_client_base"
4
4
  require "btfy_client/version"
5
5
  require "btfy_client/client"
6
6
 
7
+ require "btfy_client/models/link"
7
8
  require "btfy_client/requests/create_link_request"
8
9
  require "btfy_client/responses/create_link_response"
9
10
 
10
11
  BTFY_CLIENT_DIR = Pathname.new(File.dirname(__FILE__)).
11
12
  join("btfy_client")
12
13
 
13
- %w(requests responses).each do |dir|
14
+ %w(models requests responses).each do |dir|
14
15
  Dir[BTFY_CLIENT_DIR.join(dir, "*.rb")].each { |f| require f }
15
16
  end
16
17
 
@@ -0,0 +1,13 @@
1
+ module BtfyClient
2
+ class Link
3
+
4
+ include Virtus.model
5
+
6
+ attribute :id, Integer
7
+ attribute :name, String
8
+ attribute :slug, String
9
+ attribute :destination_url, String
10
+ attribute :redirect_url, String
11
+
12
+ end
13
+ end
@@ -4,6 +4,7 @@ module BtfyClient
4
4
  include APIClientBase::Response.module
5
5
 
6
6
  attribute :body, Object, lazy: true, default: :default_body
7
+ attribute :link, BtfyClient::Link, default: :default_link
7
8
 
8
9
  private
9
10
 
@@ -11,5 +12,15 @@ module BtfyClient
11
12
  raw_response.body
12
13
  end
13
14
 
15
+ def default_link
16
+ args = {}
17
+
18
+ JSON.parse(body).each do |key, value|
19
+ args[key] = value
20
+ end
21
+
22
+ Link.new(args["link"])
23
+ end
24
+
14
25
  end
15
26
  end
@@ -1,3 +1,3 @@
1
1
  module BtfyClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Chavez
@@ -102,6 +102,7 @@ files:
102
102
  - btfy_client.gemspec
103
103
  - lib/btfy_client.rb
104
104
  - lib/btfy_client/client.rb
105
+ - lib/btfy_client/models/link.rb
105
106
  - lib/btfy_client/requests/create_link_request.rb
106
107
  - lib/btfy_client/responses/create_link_response.rb
107
108
  - lib/btfy_client/version.rb