relinkly 1.0.2 → 1.1.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: ca3d464fc600ace0e0982fbb9a910796a4688b27737f86a443381360b177d092
4
- data.tar.gz: 7c52ecef421d2b51b0a447e5f69013cc5745b1b29be395542c8945e7ae0cf390
3
+ metadata.gz: 65d72a34b49919ac9b5ba4ab0e832ef4e64a15c9876c90a6e7d71b9add7e213f
4
+ data.tar.gz: a81194a39f7995adab36df320ebd508a72adfc6d2e14fb416a6aae075a513b01
5
5
  SHA512:
6
- metadata.gz: 63e74e9104608ac8d717b5edc14e72878c54abb616a5269fc6b619e907ff469b663c8e0613bc4aaf24e0f62f244cb79a7d0d06483e1fde0c41209e5ba85a0551
7
- data.tar.gz: e82e824a00937180539f49e007257a07cd321126f48b3c0ea1f64261d16f5cd43156a41b8e761ef13ab70d101c1335b9c0094bbd33ab2d87370f726182b77826
6
+ metadata.gz: bddef48388d44413b2896894e8d16c8868a93479fb4e461969fe57b1c078bfbbeb4ea3d4eab1c320991c95fd7a3530e61c91d20d3a99ae849bdf5495f7e85cca
7
+ data.tar.gz: db3060d654fd2fbad01786e922200cf797f20db7f6c3470184e05c5837961cb20f3c67238d7909595a794b5b14d097437e04583cd307ab9cb396976986225c84
data/.gitignore CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  /.bundle/
3
2
  /.yardoc
4
3
  /Gemfile.lock
@@ -9,4 +8,4 @@
9
8
  /spec/reports/
10
9
  /tmp/
11
10
  *.gem
12
- .idea/
11
+ .idea
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # relinkly [![Gem Version](https://badge.fury.io/rb/relinkly.svg)](https://badge.fury.io/rb/relinkly) [![Build Status](https://travis-ci.com/cyborgINX/relinkly.svg?branch=master)](https://travis-ci.com/cyborgINX/relinkly)
1
+ # relinkly [![Gem Version](https://badge.fury.io/rb/relinkly.svg)](https://badge.fury.io/rb/relinkly)
2
2
 
3
3
  ## Installation
4
4
 
data/bin/console CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'bundler/setup'
5
- require 'relinkly'
4
+ require "bundler/setup"
5
+ require "relinkly"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -11,5 +11,5 @@ require 'relinkly'
11
11
  # require "pry"
12
12
  # Pry.start
13
13
 
14
- require 'irb'
14
+ require "irb"
15
15
  IRB.start
data/lib/relinkly/api.rb CHANGED
@@ -11,7 +11,13 @@ module Relinkly
11
11
  API_VERSION = 'v1'
12
12
  BASE_URL = "https://api.rebrandly.com/#{API_VERSION}"
13
13
 
14
+ ########################################
15
+ # ACCOUNT / WORKSPACES
16
+ ########################################
17
+ #
14
18
  # ACCOUNT ENDPOINTS
19
+ #
20
+ ########################################
15
21
 
16
22
  # GET /v1/account
17
23
  def account
@@ -19,17 +25,25 @@ module Relinkly
19
25
  end
20
26
 
21
27
  # WORKSPACES ENDPOINTS
28
+ #
29
+ ########################################
22
30
 
23
31
  # GET /v1/account/workspaces
24
- def workspaces(options = {})
25
- all_workspaces = relinkly_request(:get, 'account/workspaces', options)
32
+ def workspaces(options: {})
33
+ all_workspaces = relinkly_request(:get, 'workspaces', options)
26
34
  all_workspaces.map { |workspace| Workspace.new(workspace) }
27
35
  end
28
36
 
37
+ ########################################
38
+ # REBRANDLY OPS
39
+ ########################################
40
+ #
29
41
  # DOMAINS ENDPOINTS
42
+ #
43
+ ########################################
30
44
 
31
45
  # GET /v1/domains
32
- def domains(options = {})
46
+ def domains(options: {})
33
47
  all_domains = relinkly_request(:get, 'domains', options)
34
48
  all_domains.map { |domain| Domain.new(domain) }
35
49
  end
@@ -40,14 +54,16 @@ module Relinkly
40
54
  end
41
55
 
42
56
  # GET /v1/domains/count
43
- def domain_count(_options = {})
57
+ def domain_count(_options: {})
44
58
  relinkly_request(:get, 'domains/count')['count']
45
59
  end
46
60
 
47
61
  # TAGS ENDPOINTS
62
+ #
63
+ ########################################
48
64
 
49
65
  # GET /v1/tags
50
- def tags(options = {})
66
+ def tags(options: {})
51
67
  all_tags = relinkly_request(:get, 'tags', options)
52
68
  all_tags.map { |tag| Tag.new(tag) }
53
69
  end
@@ -58,30 +74,32 @@ module Relinkly
58
74
  end
59
75
 
60
76
  # GET /v1/tags/count
61
- def tag_count(_options = {})
77
+ def tag_count(_options: {})
62
78
  relinkly_request(:get, 'tags/count')['count']
63
79
  end
64
80
 
65
81
  # POST /v1/tags
66
- def new_tag(destination, options = {})
82
+ def new_tag(destination, options: {})
67
83
  options[:destination] = destination
68
84
  Tag.new(relinkly_request(:post, 'tags', options))
69
85
  end
70
86
 
71
87
  # POST /v1/tags/:id
72
- def update_tag(id, options = {})
88
+ def update_tag(id, options: {})
73
89
  Tag.new(relinkly_request(:post, "tags/#{id}", options))
74
90
  end
75
91
 
76
92
  # DELETE /v1/tags/:id
77
- def delete_tag(id, options = {})
93
+ def delete_tag(id, options: {})
78
94
  Tag.new(relinkly_request(:delete, "tags/#{id}", options))
79
95
  end
80
96
 
81
97
  # LINKS ENDPOINTS
98
+ #
99
+ ########################################
82
100
 
83
101
  # GET /v1/links
84
- def links(options = {})
102
+ def links(options: {})
85
103
  all_links = relinkly_request(:get, 'links', options)
86
104
  all_links.map { |link| Link.new(link) }
87
105
  end
@@ -97,7 +115,7 @@ module Relinkly
97
115
  end
98
116
 
99
117
  # POST /v1/links
100
- def shorten(destination, options = {})
118
+ def shorten(destination, options: {})
101
119
  options[:destination] = destination
102
120
  Link.new(relinkly_request(:post, 'links', options))
103
121
  end
@@ -112,10 +130,61 @@ module Relinkly
112
130
  Link.new(relinkly_request(:delete, "links/#{id}", options))
113
131
  end
114
132
 
133
+ # DELETE /v1/links
134
+ def delete_links(options: {})
135
+ Link.new(relinkly_request(:delete, 'links', options))
136
+ end
137
+
138
+ # GET /v1/links/:id/tags
115
139
  def tags_link(id, options = {})
116
140
  Link.new(relinkly_request(:get, "/links/#{id}/tags", options))
117
141
  end
118
142
 
143
+ # POST /v1/links/:id/tags/:tag
144
+ def add_tags_link(id, tag, options: {})
145
+ Link.new(relinkly_request(:post, "/links/#{id}/tags/#{tag}", options))
146
+ end
147
+
148
+ # DELETE /v1/links/:id/tags/:tag
149
+ def delete_tags_link(id, tag, options: {})
150
+ Link.new(relinkly_request(:delete, "/links/#{id}/tags/#{tag}", options))
151
+ end
152
+
153
+ # GET /v1/links/:id/scripts
154
+ def scripts_link(id, options: {})
155
+ Link.new(relinkly_request(:get, "/links/#{id}/scripts", options))
156
+ end
157
+
158
+ # POST /v1/links/:id/scripts/:script
159
+ def add_scripts_link(id, script, options: {})
160
+ Link.new(relinkly_request(:post, "/links/#{id}/scripts/#{script}", options))
161
+ end
162
+
163
+ # DELETE /v1/links/:id/scripts/:script
164
+ def delete_scripts_link(id, script, options: {})
165
+ Link.new(relinkly_request(:delete, "/links/#{id}/scripts/#{script}", options))
166
+ end
167
+
168
+ # SCRIPTS ENDPOINTS
169
+ #
170
+ ########################################
171
+
172
+ # GET /v1/scripts
173
+ def scripts(options: {})
174
+ all_scripts = relinkly_request(:get, 'scripts', options)
175
+ all_scripts.map { |script| Script.new(script) }
176
+ end
177
+
178
+ # GET /v1/scripts/:id
179
+ def script(id)
180
+ Script.new(relinkly_request(:get, "scripts/#{id}"))
181
+ end
182
+
183
+ # GET /v1/scripts/count
184
+ def script_count(_options: {})
185
+ relinkly_request(:get, 'scripts/count')['count']
186
+ end
187
+
119
188
  private
120
189
 
121
190
  def relinkly_request(method, url, options = {})
@@ -132,8 +201,6 @@ module Relinkly
132
201
  http_attrs.merge!(query: options)
133
202
  when :post
134
203
  http_attrs.merge!(body: options.to_json)
135
- else
136
- # type code here
137
204
  end
138
205
 
139
206
  res = HTTParty.send(method, url, http_attrs)
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Relinkly
4
4
  class Domain < Element
5
- attr_accessor :id, :ref, :full_name, :top_level_domain, :level,
6
- :created_at, :updated_at, :custom_homepage, :owner_id, :type,
7
- :subdomains, :managed, :status, :https, :active
5
+ attr_accessor :id, :ref, :full_name, :top_level_domain, :level, :created_at, :updated_at,
6
+ :custom_homepage, :owner_id, :type, :subdomains, :managed, :status, :https,
7
+ :active
8
8
  end
9
9
  end
data/lib/relinkly/link.rb CHANGED
@@ -2,10 +2,9 @@
2
2
 
3
3
  module Relinkly
4
4
  class Link < Element
5
- attr_accessor :id, :link_id, :title, :slashtag, :destination, :created_at,
6
- :updated_at, :status, :tags, :scripts, :forward_parameters,
7
- :clicks, :last_click_date, :last_click_at, :is_public,
8
- :short_url, :domain_id, :domain_name, :https, :favourite
5
+ attr_accessor :id, :link_id, :title, :slashtag, :destination, :created_at, :updated_at, :status,
6
+ :tags, :scripts, :forward_parameters, :clicks, :last_click_date, :last_click_at,
7
+ :is_public, :short_url, :domain_id, :domain_name, :https, :favourite
9
8
 
10
9
  # Associations
11
10
  %i[domain creator integration].each do |association|
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Relinkly
4
+ class Script < Element
5
+ attr_accessor :id, :name, :uri
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Relinkly
4
- VERSION = '1.0.2'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  module Relinkly
4
4
  class Workspace < Element
5
- attr_accessor :id, :name, :avatarUrl, :links, :teammates, :domains, :created_at, :updated_at
5
+ attr_accessor :id, :name, :avatarUrl, :links, :teammates,
6
+ :domains, :created_at, :updated_at
6
7
  end
7
8
  end
data/lib/relinkly.rb CHANGED
@@ -10,6 +10,7 @@ require 'relinkly/integration'
10
10
  require 'relinkly/link'
11
11
  require 'relinkly/workspace'
12
12
  require 'relinkly/tag'
13
+ require 'relinkly/script'
13
14
 
14
15
  module Relinkly
15
16
  class << self
data/relinkly.gemspec CHANGED
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Rajan Bhattarai"]
10
10
  spec.email = ["rajan@rajanbhattarai.com"]
11
11
 
12
- spec.summary = "A Ruby wrapper for the Your Favorite Link Shortner API "
13
- spec.description = "Easily create short links on your ruby apps using your favorite link shortner app's API."
12
+ spec.summary = "A Ruby wrapper for the Rebrandly API "
13
+ spec.description = "Easily create short links on your ruby apps using Rebrandly API."
14
14
  spec.homepage = "https://github.com/cdrrazan/relinkly"
15
15
  spec.license = "MIT"
16
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relinkly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajan Bhattarai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-13 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,8 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.18.1
69
- description: Easily create short links on your ruby apps using your favorite link
70
- shortner app's API.
69
+ description: Easily create short links on your ruby apps using Rebrandly API.
71
70
  email:
72
71
  - rajan@rajanbhattarai.com
73
72
  executables: []
@@ -76,7 +75,6 @@ extra_rdoc_files: []
76
75
  files:
77
76
  - ".gitignore"
78
77
  - ".rspec"
79
- - ".travis.yml"
80
78
  - Gemfile
81
79
  - LICENSE.txt
82
80
  - README.md
@@ -91,6 +89,7 @@ files:
91
89
  - lib/relinkly/element.rb
92
90
  - lib/relinkly/integration.rb
93
91
  - lib/relinkly/link.rb
92
+ - lib/relinkly/script.rb
94
93
  - lib/relinkly/tag.rb
95
94
  - lib/relinkly/version.rb
96
95
  - lib/relinkly/workspace.rb
@@ -117,5 +116,5 @@ requirements: []
117
116
  rubygems_version: 3.4.17
118
117
  signing_key:
119
118
  specification_version: 4
120
- summary: A Ruby wrapper for the Your Favorite Link Shortner API
119
+ summary: A Ruby wrapper for the Rebrandly API
121
120
  test_files: []
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.6
5
- before_install: gem install bundler -v 2.2.3