Class: Travis::Client::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/travis/client/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, href, payload = {}) ⇒ Link

Returns a new instance of Link.



6
7
8
# File 'lib/travis/client/link.rb', line 6

def initialize(session, href, payload = {})
  @session, @href, @payload = session, href, payload
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



4
5
6
# File 'lib/travis/client/link.rb', line 4

def href
  @href
end

#sessionObject (readonly)

Returns the value of attribute session.



4
5
6
# File 'lib/travis/client/link.rb', line 4

def session
  @session
end

Instance Method Details

#fetchObject



14
15
16
# File 'lib/travis/client/link.rb', line 14

def fetch
  session.fetch(href)
end

#inspectObject



30
31
32
# File 'lib/travis/client/link.rb', line 30

def inspect
  "#<%p:%p>" % [ self.class, href.omit(:scheme, :authority).to_s ]
end

#limitObject



26
27
28
# File 'lib/travis/client/link.rb', line 26

def limit
  @payload['limit']
end

#offsetObject



22
23
24
# File 'lib/travis/client/link.rb', line 22

def offset
  @payload['offset']
end

#to_entityObject



10
11
12
# File 'lib/travis/client/link.rb', line 10

def to_entity
  fetch
end

#to_hObject



18
19
20
# File 'lib/travis/client/link.rb', line 18

def to_h
  @payload.dup
end