relinkly 1.1.0 → 1.1.2

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: 65d72a34b49919ac9b5ba4ab0e832ef4e64a15c9876c90a6e7d71b9add7e213f
4
- data.tar.gz: a81194a39f7995adab36df320ebd508a72adfc6d2e14fb416a6aae075a513b01
3
+ metadata.gz: 2c6fcec1a1d8311e2f5f99ff3f8ab76a71bdc5863dec985af3e25b3802836534
4
+ data.tar.gz: 7bb1696a327df2efab317851c6dfe2d44a3588a58ee2ef947666d26e4f436ec8
5
5
  SHA512:
6
- metadata.gz: bddef48388d44413b2896894e8d16c8868a93479fb4e461969fe57b1c078bfbbeb4ea3d4eab1c320991c95fd7a3530e61c91d20d3a99ae849bdf5495f7e85cca
7
- data.tar.gz: db3060d654fd2fbad01786e922200cf797f20db7f6c3470184e05c5837961cb20f3c67238d7909595a794b5b14d097437e04583cd307ab9cb396976986225c84
6
+ metadata.gz: d774e79c0b23b98cb071e3b8a6d01ab52823e1fa0384e4089999487bc4357a532a1cc12cbaac6756a7dc1e25728384f75080a02d8c9544036e7bcfd7f76ab189
7
+ data.tar.gz: 2faf8b36c8d5108fd9544a88f304f8e6e201ab92af3eabe091fcad5287a351fb3b3a2e8b40544f37faf9034047ea13345fa24315cfd3201dcce8def80cc3f08c
data/README.md CHANGED
@@ -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/lib/relinkly/api.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'httparty'
4
+ require 'json'
4
5
 
5
6
  module Relinkly
6
7
  class RelinklyError < StandardError; end
@@ -29,7 +30,7 @@ module Relinkly
29
30
  ########################################
30
31
 
31
32
  # GET /v1/account/workspaces
32
- def workspaces(options: {})
33
+ def workspaces(options = {})
33
34
  all_workspaces = relinkly_request(:get, 'workspaces', options)
34
35
  all_workspaces.map { |workspace| Workspace.new(workspace) }
35
36
  end
@@ -43,7 +44,7 @@ module Relinkly
43
44
  ########################################
44
45
 
45
46
  # GET /v1/domains
46
- def domains(options: {})
47
+ def domains(options = {})
47
48
  all_domains = relinkly_request(:get, 'domains', options)
48
49
  all_domains.map { |domain| Domain.new(domain) }
49
50
  end
@@ -54,7 +55,7 @@ module Relinkly
54
55
  end
55
56
 
56
57
  # GET /v1/domains/count
57
- def domain_count(_options: {})
58
+ def domain_count(_options = {})
58
59
  relinkly_request(:get, 'domains/count')['count']
59
60
  end
60
61
 
@@ -63,7 +64,7 @@ module Relinkly
63
64
  ########################################
64
65
 
65
66
  # GET /v1/tags
66
- def tags(options: {})
67
+ def tags(options = {})
67
68
  all_tags = relinkly_request(:get, 'tags', options)
68
69
  all_tags.map { |tag| Tag.new(tag) }
69
70
  end
@@ -74,23 +75,23 @@ module Relinkly
74
75
  end
75
76
 
76
77
  # GET /v1/tags/count
77
- def tag_count(_options: {})
78
+ def tag_count(_options = {})
78
79
  relinkly_request(:get, 'tags/count')['count']
79
80
  end
80
81
 
81
82
  # POST /v1/tags
82
- def new_tag(destination, options: {})
83
+ def new_tag(destination, options = {})
83
84
  options[:destination] = destination
84
85
  Tag.new(relinkly_request(:post, 'tags', options))
85
86
  end
86
87
 
87
88
  # POST /v1/tags/:id
88
- def update_tag(id, options: {})
89
+ def update_tag(id, options = {})
89
90
  Tag.new(relinkly_request(:post, "tags/#{id}", options))
90
91
  end
91
92
 
92
93
  # DELETE /v1/tags/:id
93
- def delete_tag(id, options: {})
94
+ def delete_tag(id, options = {})
94
95
  Tag.new(relinkly_request(:delete, "tags/#{id}", options))
95
96
  end
96
97
 
@@ -99,7 +100,7 @@ module Relinkly
99
100
  ########################################
100
101
 
101
102
  # GET /v1/links
102
- def links(options: {})
103
+ def links(options = {})
103
104
  all_links = relinkly_request(:get, 'links', options)
104
105
  all_links.map { |link| Link.new(link) }
105
106
  end
@@ -115,7 +116,7 @@ module Relinkly
115
116
  end
116
117
 
117
118
  # POST /v1/links
118
- def shorten(destination, options: {})
119
+ def shorten(destination, options = {})
119
120
  options[:destination] = destination
120
121
  Link.new(relinkly_request(:post, 'links', options))
121
122
  end
@@ -131,7 +132,7 @@ module Relinkly
131
132
  end
132
133
 
133
134
  # DELETE /v1/links
134
- def delete_links(options: {})
135
+ def delete_links(options = {})
135
136
  Link.new(relinkly_request(:delete, 'links', options))
136
137
  end
137
138
 
@@ -141,27 +142,27 @@ module Relinkly
141
142
  end
142
143
 
143
144
  # POST /v1/links/:id/tags/:tag
144
- def add_tags_link(id, tag, options: {})
145
+ def add_tags_link(id, tag, options = {})
145
146
  Link.new(relinkly_request(:post, "/links/#{id}/tags/#{tag}", options))
146
147
  end
147
148
 
148
149
  # DELETE /v1/links/:id/tags/:tag
149
- def delete_tags_link(id, tag, options: {})
150
+ def delete_tags_link(id, tag, options = {})
150
151
  Link.new(relinkly_request(:delete, "/links/#{id}/tags/#{tag}", options))
151
152
  end
152
153
 
153
154
  # GET /v1/links/:id/scripts
154
- def scripts_link(id, options: {})
155
+ def scripts_link(id, options = {})
155
156
  Link.new(relinkly_request(:get, "/links/#{id}/scripts", options))
156
157
  end
157
158
 
158
159
  # POST /v1/links/:id/scripts/:script
159
- def add_scripts_link(id, script, options: {})
160
+ def add_scripts_link(id, script, options = {})
160
161
  Link.new(relinkly_request(:post, "/links/#{id}/scripts/#{script}", options))
161
162
  end
162
163
 
163
164
  # DELETE /v1/links/:id/scripts/:script
164
- def delete_scripts_link(id, script, options: {})
165
+ def delete_scripts_link(id, script, options = {})
165
166
  Link.new(relinkly_request(:delete, "/links/#{id}/scripts/#{script}", options))
166
167
  end
167
168
 
@@ -170,7 +171,7 @@ module Relinkly
170
171
  ########################################
171
172
 
172
173
  # GET /v1/scripts
173
- def scripts(options: {})
174
+ def scripts(options = {})
174
175
  all_scripts = relinkly_request(:get, 'scripts', options)
175
176
  all_scripts.map { |script| Script.new(script) }
176
177
  end
@@ -181,7 +182,7 @@ module Relinkly
181
182
  end
182
183
 
183
184
  # GET /v1/scripts/count
184
- def script_count(_options: {})
185
+ def script_count(_options = {})
185
186
  relinkly_request(:get, 'scripts/count')['count']
186
187
  end
187
188
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Relinkly
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.2'
5
5
  end
data/relinkly.gemspec CHANGED
@@ -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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relinkly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajan Bhattarai
@@ -16,56 +16,56 @@ 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
68
+ version: 0.22.0
69
69
  description: Easily create short links on your ruby apps using Rebrandly API.
70
70
  email:
71
71
  - rajan@rajanbhattarai.com