Class: Sendly::ShortLinkList
- Inherits:
-
Object
- Object
- Sendly::ShortLinkList
- Includes:
- Enumerable
- Defined in:
- lib/sendly/links_resource.rb
Overview
A page of short links with their click analytics.
Instance Attribute Summary collapse
-
#links ⇒ Array<ShortLinkListItem>
readonly
The workspace's short links, newest first.
-
#total ⇒ Integer
readonly
Total number of short links in the workspace.
Instance Method Summary collapse
- #count ⇒ Object (also: #size, #length)
- #each(&block) ⇒ Object
- #empty? ⇒ Boolean
- #first ⇒ Object
-
#initialize(response) ⇒ ShortLinkList
constructor
A new instance of ShortLinkList.
- #last ⇒ Object
Constructor Details
#initialize(response) ⇒ ShortLinkList
Returns a new instance of ShortLinkList.
85 86 87 88 |
# File 'lib/sendly/links_resource.rb', line 85 def initialize(response) @links = (response["links"] || []).map { |l| ShortLinkListItem.new(l) } @total = response["total"] || @links.length end |
Instance Attribute Details
#links ⇒ Array<ShortLinkListItem> (readonly)
Returns The workspace's short links, newest first.
80 81 82 |
# File 'lib/sendly/links_resource.rb', line 80 def links @links end |
#total ⇒ Integer (readonly)
Returns Total number of short links in the workspace.
83 84 85 |
# File 'lib/sendly/links_resource.rb', line 83 def total @total end |
Instance Method Details
#count ⇒ Object Also known as: size, length
94 95 96 |
# File 'lib/sendly/links_resource.rb', line 94 def count links.length end |
#each(&block) ⇒ Object
90 91 92 |
# File 'lib/sendly/links_resource.rb', line 90 def each(&block) links.each(&block) end |
#empty? ⇒ Boolean
101 102 103 |
# File 'lib/sendly/links_resource.rb', line 101 def empty? links.empty? end |
#first ⇒ Object
105 106 107 |
# File 'lib/sendly/links_resource.rb', line 105 def first links.first end |
#last ⇒ Object
109 110 111 |
# File 'lib/sendly/links_resource.rb', line 109 def last links.last end |