relinkly 1.0.2 → 1.1.1

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: afd77fb83655421ffccdcc5930da3f15133eeaf47f0205a8ef103bd50fe94efb
4
+ data.tar.gz: 6b60e768e3699c93f0d84d33f64b5edee55ef8a6a02c12afcd2ece12ab1a0328
5
5
  SHA512:
6
- metadata.gz: 63e74e9104608ac8d717b5edc14e72878c54abb616a5269fc6b619e907ff469b663c8e0613bc4aaf24e0f62f244cb79a7d0d06483e1fde0c41209e5ba85a0551
7
- data.tar.gz: e82e824a00937180539f49e007257a07cd321126f48b3c0ea1f64261d16f5cd43156a41b8e761ef13ab70d101c1335b9c0094bbd33ab2d87370f726182b77826
6
+ metadata.gz: 167554f6e43ab5eeeaefd3870322f168b2a28fbcfdf5817ae658b5cb849b031c3b86314e8a6f9a1908bbefd90f56d3c1ab0ac9fc09bbc9f00c487c1b55f603a5
7
+ data.tar.gz: 26c87be5be87cf0ce5c1cd896e795cef98b563c3b6d0e3a676f4c6c2b9cd40fd5f496937c7a0916dd20ac5d130f2bb1bc1a09476498408bd90dbb86f7a6db815
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
 
@@ -35,23 +35,14 @@ api = Relinkly::API.new
35
35
 
36
36
  ### API Requests
37
37
 
38
- #### Account and Workspaces
38
+ #### Account, Workspaces & Domains
39
+
39
40
  ```ruby
41
+ api.account # GET /v1/account
42
+ api.workspaces # GET /v1/workspaces
40
43
  api.domains # GET /v1/domains
41
44
  api.domain(id) # GET /v1/domains/:id
42
45
  api.domain_count(options) # GET /v1/domains/count
43
- api.account # GET /v1/account
44
- api.workspaces # GET /v1/account/workspaces
45
- ```
46
-
47
- #### Tags
48
- ```ruby
49
- api.tags # GET /v1/tags
50
- api.tag(id) # GET /v1/tags/:id
51
- api.tag_count(options) # GET /v1/tags/count
52
- api.new_tag(options) # GET /v1/tags/new
53
- api.update_tag(id, options) # POST /v1/tags/:id
54
- api.delete_tag(id, options) # DELETE /v1/tags/:id
55
46
  ```
56
47
 
57
48
  #### Links
@@ -62,29 +53,53 @@ api.link_count(options) # GET /v1/links/count
62
53
  api.new_link(options) # GET /v1/links/new
63
54
  api.shorten(destination, options) # POST /v1/links
64
55
  api.update_link(id, options) # POST /v1/links/:id
56
+ api.delete_links(ids, options) # DELETE /v1/links
65
57
  api.delete_link(id, options) # DELETE /v1/links/:id
66
58
  api.tags_link(id, options) # GET /v1/links/:id/tags
59
+ api.add_tag_link(id, options) # POST /v1/links/:id/tags
60
+ api.delete_tag_link(id, options) # DELETE /v1/links/:id/tags
61
+ api.scripts_link(id, options) # GET /v1/links/:id/scripts
62
+ api.add_script_link(id, options) # POST /v1/links/:id/scripts
63
+ api.delete_script_link(id, options) # DELETE /v1/links/:id/scripts
67
64
  ```
68
65
 
66
+ #### Tags
67
+ ```ruby
68
+ api.tags # GET /v1/tags
69
+ api.tag(id) # GET /v1/tags/:id
70
+ api.tag_count(options) # GET /v1/tags/count
71
+ api.new_tag(options) # POST /v1/tags
72
+ api.update_tag(id, options) # POST /v1/tags/:id
73
+ api.delete_tag(id, options) # DELETE /v1/tags/:id
74
+ ```
75
+
76
+ #### Scripts
77
+ ```ruby
78
+ api.scripts # GET /v1/scripts
79
+ api.script(id) # GET /v1/scripts/:id
80
+ api.script_count(options) # GET /v1/scripts/count
81
+ ```
82
+
83
+
69
84
  #### Creating your branded short link!
70
85
 
71
86
  ```ruby
72
- my_domain = api.domains.first
73
- link = api.shorten('https://google.com', domain: my_domain.to_h, title: 'Google', description: 'Google Homepage')
87
+ your_domain = api.domains.first
88
+ branded_link = api.shorten('https://google.com', domain: your_domain.to_h, title: 'Google', description: 'Google Homepage')
74
89
  ```
75
90
 
76
91
  #### Workspace workaround
77
- Please see the applicable methods for options available when making requests. You need to pass the workspace_id in the options as follows in case you want to perform operations other than the default workspace.
92
+ Please see the applicable methods for options available when making requests. You need to pass the workspace_id in the options as follows in case you want to select other than the default workspace.
78
93
 
79
- Here's how you can create a link into another workspace.
94
+ Here's how you can achieve that:
80
95
 
81
96
  ```ruby
82
- my_domain = api.domains.first
83
- my_workspace_id = api.workspaces.first.id
84
- link = api.shorten('https://google.com', domain: my_domain.to_h, title: 'Google', description: 'Google Homepage', workspace: my_workspace_id)
97
+ your_domain = api.domains.first
98
+ your_workspace_id = api.workspaces.first.id
99
+ branded_link = api.shorten('https://google.com', domain: your_domain.to_h, title: 'Google', description: 'Google Homepage', workspace: your_workspace_id)
85
100
  ```
86
101
 
87
- Please note that `my_domain` should already be included inside `my_workspace`. Similarly other operations on link and tags can be achieved as above.
102
+ Please note that `your_domain` should already be included inside `your_workspace`.
88
103
 
89
104
  You can find all the details about your workspace by going here. https://app.rebrandly.com/workspaces
90
105
 
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.1'
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
 
@@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 2.2.3"
25
- spec.add_development_dependency "rake", "~> 13.0.3"
26
- spec.add_development_dependency "rspec", "~> 3.10.0"
27
- spec.add_dependency 'httparty', '~> 0.18.1'
24
+ spec.add_development_dependency "bundler", "~> 2.6.2"
25
+ spec.add_development_dependency "rake", "~> 13.2.1"
26
+ spec.add_development_dependency "rspec", "~> 3.13.0"
27
+ spec.add_dependency 'httparty', '~> 0.22.0'
28
28
  end
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.1
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
@@ -16,58 +16,57 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.3
19
+ version: 2.6.2
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.3
26
+ version: 2.6.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 13.0.3
33
+ version: 13.2.1
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 13.0.3
40
+ version: 13.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.10.0
47
+ version: 3.13.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.10.0
54
+ version: 3.13.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: httparty
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.18.1
61
+ version: 0.22.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.18.1
69
- description: Easily create short links on your ruby apps using your favorite link
70
- shortner app's API.
68
+ version: 0.22.0
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