relinkly 1.0.0 → 1.0.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: 0ef98f2ea27c1567b2293b703fefabf90c70cbce7fbaa3dfbad54429539e5dca
4
- data.tar.gz: f9185277790a1e86bfccb3a779aa9b4e07986040d64dde19a49df738cb4a281d
3
+ metadata.gz: ca3d464fc600ace0e0982fbb9a910796a4688b27737f86a443381360b177d092
4
+ data.tar.gz: 7c52ecef421d2b51b0a447e5f69013cc5745b1b29be395542c8945e7ae0cf390
5
5
  SHA512:
6
- metadata.gz: 2b149562182bc84a107d8279f5beabf470a9dfc95cc3227d97f1ee4553c6d536dcd43c956d4b148e3b686a387a218d249bad6758f79e57c3a90064fd432f920e
7
- data.tar.gz: 70422410b36a9a0af25558e01413ef0475f4b8ca39d3daa4de18ac90b3fdfabeb9d3856e2898943d3517392f67f306e8fb204ccab503d93c566331296a7ecb63
6
+ metadata.gz: 63e74e9104608ac8d717b5edc14e72878c54abb616a5269fc6b619e907ff469b663c8e0613bc4aaf24e0f62f244cb79a7d0d06483e1fde0c41209e5ba85a0551
7
+ data.tar.gz: e82e824a00937180539f49e007257a07cd321126f48b3c0ea1f64261d16f5cd43156a41b8e761ef13ab70d101c1335b9c0094bbd33ab2d87370f726182b77826
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /spec/reports/
10
10
  /tmp/
11
11
  *.gem
12
+ .idea/
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # relinkly
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)
2
2
 
3
3
  ## Installation
4
4
 
@@ -41,13 +41,13 @@ api.domains # GET /v1/domains
41
41
  api.domain(id) # GET /v1/domains/:id
42
42
  api.domain_count(options) # GET /v1/domains/count
43
43
  api.account # GET /v1/account
44
- api.workspaces # GET /v1/workspaces
44
+ api.workspaces # GET /v1/account/workspaces
45
45
  ```
46
46
 
47
47
  #### Tags
48
48
  ```ruby
49
49
  api.tags # GET /v1/tags
50
- api.tags(id) # GET /v1/tags/:id
50
+ api.tag(id) # GET /v1/tags/:id
51
51
  api.tag_count(options) # GET /v1/tags/count
52
52
  api.new_tag(options) # GET /v1/tags/new
53
53
  api.update_tag(id, options) # POST /v1/tags/:id
@@ -57,7 +57,7 @@ api.delete_tag(id, options) # DELETE /v1/tags/:id
57
57
  #### Links
58
58
  ```ruby
59
59
  api.links # GET /v1/links
60
- api.links(id) # GET /v1/links/:id
60
+ api.link(id) # GET /v1/links/:id
61
61
  api.link_count(options) # GET /v1/links/count
62
62
  api.new_link(options) # GET /v1/links/new
63
63
  api.shorten(destination, options) # POST /v1/links
@@ -66,16 +66,17 @@ api.delete_link(id, options) # DELETE /v1/links/:id
66
66
  api.tags_link(id, options) # GET /v1/links/:id/tags
67
67
  ```
68
68
 
69
- ### Make a new branded short link
69
+ #### Creating your branded short link!
70
70
 
71
71
  ```ruby
72
72
  my_domain = api.domains.first
73
73
  link = api.shorten('https://google.com', domain: my_domain.to_h, title: 'Google', description: 'Google Homepage')
74
74
  ```
75
75
 
76
- ### Workspace workaround
77
- Please see the applicable methods for options available when making requests. In case of new link creation, default workspace is selected if workspace isn't mentioned explictly.
78
- Please pass the workspace_id in the options as follows in case you want to created branded link to another workspace.
76
+ #### 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.
78
+
79
+ Here's how you can create a link into another workspace.
79
80
 
80
81
  ```ruby
81
82
  my_domain = api.domains.first
@@ -83,7 +84,9 @@ my_workspace_id = api.workspaces.first.id
83
84
  link = api.shorten('https://google.com', domain: my_domain.to_h, title: 'Google', description: 'Google Homepage', workspace: my_workspace_id)
84
85
  ```
85
86
 
86
- Please note that `my_domain` should already be included inside `my_workspace`. You can find all the details about your workspace by going here. https://app.rebrandly.com/workspaces
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.
88
+
89
+ You can find all the details about your workspace by going here. https://app.rebrandly.com/workspaces
87
90
 
88
91
 
89
92
  ## Contributing
data/lib/relinkly/api.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'httparty'
4
- require 'pry'
5
4
 
6
5
  module Relinkly
7
6
  class RelinklyError < StandardError; end
@@ -12,26 +11,23 @@ module Relinkly
12
11
  API_VERSION = 'v1'
13
12
  BASE_URL = "https://api.rebrandly.com/#{API_VERSION}"
14
13
 
15
- ###########################################################
16
- # ACCOUNT ENDPOINT
17
- # #########################################################
14
+ # ACCOUNT ENDPOINTS
15
+
18
16
  # GET /v1/account
19
17
  def account
20
18
  Creator.new(relinkly_request(:get, 'account'))
21
19
  end
22
20
 
23
- ###########################################################
24
21
  # WORKSPACES ENDPOINTS
25
- # #########################################################
22
+
26
23
  # GET /v1/account/workspaces
27
24
  def workspaces(options = {})
28
25
  all_workspaces = relinkly_request(:get, 'account/workspaces', options)
29
26
  all_workspaces.map { |workspace| Workspace.new(workspace) }
30
27
  end
31
28
 
32
- ###########################################################
33
- # DOMAINS ENDPOINT
34
- # #########################################################
29
+ # DOMAINS ENDPOINTS
30
+
35
31
  # GET /v1/domains
36
32
  def domains(options = {})
37
33
  all_domains = relinkly_request(:get, 'domains', options)
@@ -48,9 +44,8 @@ module Relinkly
48
44
  relinkly_request(:get, 'domains/count')['count']
49
45
  end
50
46
 
51
- ###########################################################
52
- # TAGS ENDPOINT
53
- # #########################################################
47
+ # TAGS ENDPOINTS
48
+
54
49
  # GET /v1/tags
55
50
  def tags(options = {})
56
51
  all_tags = relinkly_request(:get, 'tags', options)
@@ -83,9 +78,8 @@ module Relinkly
83
78
  Tag.new(relinkly_request(:delete, "tags/#{id}", options))
84
79
  end
85
80
 
86
- ###########################################################
87
- # LINKS ENDPOINT
88
- # #########################################################
81
+ # LINKS ENDPOINTS
82
+
89
83
  # GET /v1/links
90
84
  def links(options = {})
91
85
  all_links = relinkly_request(:get, 'links', options)
@@ -130,7 +124,7 @@ module Relinkly
130
124
  options = Hash[options.map { |k, v| [k.to_s.relinkly_lower_camelize.to_sym, v] }]
131
125
  workspace_id = options[:workspace]
132
126
 
133
- # Passes the Workspace_id into header if the link is to be created into specific workspace
127
+ # Passes the workspace_id into header if the operation requires workspace_id to be included.
134
128
  header_with_workspace = workspace_id.nil? ? headers : headers.merge!('workspace' => workspace_id)
135
129
  http_attrs = { headers: header_with_workspace }
136
130
  case method
@@ -138,6 +132,8 @@ module Relinkly
138
132
  http_attrs.merge!(query: options)
139
133
  when :post
140
134
  http_attrs.merge!(body: options.to_json)
135
+ else
136
+ # type code here
141
137
  end
142
138
 
143
139
  res = HTTParty.send(method, url, http_attrs)
data/lib/relinkly/link.rb CHANGED
@@ -5,8 +5,7 @@ module Relinkly
5
5
  attr_accessor :id, :link_id, :title, :slashtag, :destination, :created_at,
6
6
  :updated_at, :status, :tags, :scripts, :forward_parameters,
7
7
  :clicks, :last_click_date, :last_click_at, :is_public,
8
- :short_url, :domain_id, :domain_name,
9
- :https, :favourite
8
+ :short_url, :domain_id, :domain_name, :https, :favourite
10
9
 
11
10
  # Associations
12
11
  %i[domain creator integration].each do |association|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Relinkly
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.2'
5
5
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Relinkly
4
4
  class Workspace < Element
5
- attr_accessor :id, :name, :avatarUrl, :links, :teammates,
6
- :domains, :created_at, :updated_at
5
+ attr_accessor :id, :name, :avatarUrl, :links, :teammates, :domains, :created_at, :updated_at
7
6
  end
8
7
  end
data/relinkly.gemspec CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "relinkly"
8
8
  spec.version = Relinkly::VERSION
9
9
  spec.authors = ["Rajan Bhattarai"]
10
- spec.email = ["hey@rajanbhattarai.com"]
10
+ spec.email = ["rajan@rajanbhattarai.com"]
11
11
 
12
- spec.summary = "A Ruby wrapper for the Rebrandly API "
13
- spec.description = "Easily create short links on your ruby apps using Rebrandly API."
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."
14
14
  spec.homepage = "https://github.com/cdrrazan/relinkly"
15
15
  spec.license = "MIT"
16
16
 
@@ -24,6 +24,5 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 2.2.3"
25
25
  spec.add_development_dependency "rake", "~> 13.0.3"
26
26
  spec.add_development_dependency "rspec", "~> 3.10.0"
27
- spec.add_development_dependency "pry", "~> 0.13.1"
28
27
  spec.add_dependency 'httparty', '~> 0.18.1'
29
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.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajan Bhattarai
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-31 00:00:00.000000000 Z
11
+ date: 2025-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.10.0
55
- - !ruby/object:Gem::Dependency
56
- name: pry
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.13.1
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.13.1
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: httparty
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -80,9 +66,10 @@ dependencies:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
68
  version: 0.18.1
83
- description: Easily create short links on your ruby apps using Rebrandly API.
69
+ description: Easily create short links on your ruby apps using your favorite link
70
+ shortner app's API.
84
71
  email:
85
- - hey@rajanbhattarai.com
72
+ - rajan@rajanbhattarai.com
86
73
  executables: []
87
74
  extensions: []
88
75
  extra_rdoc_files: []
@@ -112,7 +99,7 @@ homepage: https://github.com/cdrrazan/relinkly
112
99
  licenses:
113
100
  - MIT
114
101
  metadata: {}
115
- post_install_message:
102
+ post_install_message:
116
103
  rdoc_options: []
117
104
  require_paths:
118
105
  - lib
@@ -127,8 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
114
  - !ruby/object:Gem::Version
128
115
  version: '0'
129
116
  requirements: []
130
- rubygems_version: 3.1.4
131
- signing_key:
117
+ rubygems_version: 3.4.17
118
+ signing_key:
132
119
  specification_version: 4
133
- summary: A Ruby wrapper for the Rebrandly API
120
+ summary: A Ruby wrapper for the Your Favorite Link Shortner API
134
121
  test_files: []