Class: Relinkly::API
- Inherits:
-
Object
- Object
- Relinkly::API
- Defined in:
- lib/relinkly/api.rb
Constant Summary collapse
- API_VERSION =
'v1'
- BASE_URL =
"https://api.rebrandly.com/#{API_VERSION}"
Instance Method Summary collapse
-
#account ⇒ Object
GET /v1/account.
-
#delete_link(id, options = {}) ⇒ Object
DELETE /v1/links/:id.
-
#delete_tag(id, options = {}) ⇒ Object
DELETE /v1/tags/:id.
-
#domain(id) ⇒ Object
GET /v1/domains/:id.
-
#domain_count(_options = {}) ⇒ Object
GET /v1/domains/count.
-
#domains(options = {}) ⇒ Object
GET /v1/domains.
-
#link(id) ⇒ Object
GET /v1/links/:id.
-
#link_count(_options = {}) ⇒ Object
GET /v1/links/count.
-
#links(options = {}) ⇒ Object
GET /v1/links.
-
#new_tag(destination, options = {}) ⇒ Object
POST /v1/tags.
-
#shorten(destination, options = {}) ⇒ Object
POST /v1/links.
-
#tag(id) ⇒ Object
GET /v1/tags/:id.
-
#tag_count(_options = {}) ⇒ Object
GET /v1/tags/count.
-
#tags(options = {}) ⇒ Object
GET /v1/tags.
- #tags_link(id, options = {}) ⇒ Object
-
#update_link(id, options = {}) ⇒ Object
POST /v1/links/:id.
-
#update_tag(id, options = {}) ⇒ Object
POST /v1/tags/:id.
-
#workspaces(options = {}) ⇒ Object
GET /v1/account/workspaces.
Instance Method Details
#account ⇒ Object
GET /v1/account
17 18 19 |
# File 'lib/relinkly/api.rb', line 17 def account Creator.new(relinkly_request(:get, 'account')) end |
#delete_link(id, options = {}) ⇒ Object
DELETE /v1/links/:id
111 112 113 |
# File 'lib/relinkly/api.rb', line 111 def delete_link(id, = {}) Link.new(relinkly_request(:delete, "links/#{id}", )) end |
#delete_tag(id, options = {}) ⇒ Object
DELETE /v1/tags/:id
77 78 79 |
# File 'lib/relinkly/api.rb', line 77 def delete_tag(id, = {}) Tag.new(relinkly_request(:delete, "tags/#{id}", )) end |
#domain(id) ⇒ Object
GET /v1/domains/:id
38 39 40 |
# File 'lib/relinkly/api.rb', line 38 def domain(id) Domain.new(relinkly_request(:get, "domains/#{id}")) end |
#domain_count(_options = {}) ⇒ Object
GET /v1/domains/count
43 44 45 |
# File 'lib/relinkly/api.rb', line 43 def domain_count( = {}) relinkly_request(:get, 'domains/count')['count'] end |
#domains(options = {}) ⇒ Object
GET /v1/domains
32 33 34 35 |
# File 'lib/relinkly/api.rb', line 32 def domains( = {}) all_domains = relinkly_request(:get, 'domains', ) all_domains.map { |domain| Domain.new(domain) } end |
#link(id) ⇒ Object
GET /v1/links/:id
90 91 92 |
# File 'lib/relinkly/api.rb', line 90 def link(id) Link.new(relinkly_request(:get, "links/#{id}")) end |
#link_count(_options = {}) ⇒ Object
GET /v1/links/count
95 96 97 |
# File 'lib/relinkly/api.rb', line 95 def link_count( = {}) relinkly_request(:get, 'links/count')['count'] end |
#links(options = {}) ⇒ Object
GET /v1/links
84 85 86 87 |
# File 'lib/relinkly/api.rb', line 84 def links( = {}) all_links = relinkly_request(:get, 'links', ) all_links.map { |link| Link.new(link) } end |
#new_tag(destination, options = {}) ⇒ Object
POST /v1/tags
66 67 68 69 |
# File 'lib/relinkly/api.rb', line 66 def new_tag(destination, = {}) [:destination] = destination Tag.new(relinkly_request(:post, 'tags', )) end |
#shorten(destination, options = {}) ⇒ Object
POST /v1/links
100 101 102 103 |
# File 'lib/relinkly/api.rb', line 100 def shorten(destination, = {}) [:destination] = destination Link.new(relinkly_request(:post, 'links', )) end |
#tag(id) ⇒ Object
GET /v1/tags/:id
56 57 58 |
# File 'lib/relinkly/api.rb', line 56 def tag(id) Tag.new(relinkly_request(:get, "tags/#{id}")) end |
#tag_count(_options = {}) ⇒ Object
GET /v1/tags/count
61 62 63 |
# File 'lib/relinkly/api.rb', line 61 def tag_count( = {}) relinkly_request(:get, 'tags/count')['count'] end |
#tags(options = {}) ⇒ Object
GET /v1/tags
50 51 52 53 |
# File 'lib/relinkly/api.rb', line 50 def ( = {}) = relinkly_request(:get, 'tags', ) .map { |tag| Tag.new(tag) } end |
#tags_link(id, options = {}) ⇒ Object
115 116 117 |
# File 'lib/relinkly/api.rb', line 115 def (id, = {}) Link.new(relinkly_request(:get, "/links/#{id}/tags", )) end |
#update_link(id, options = {}) ⇒ Object
POST /v1/links/:id
106 107 108 |
# File 'lib/relinkly/api.rb', line 106 def update_link(id, = {}) Link.new(relinkly_request(:post, "links/#{id}", )) end |