Class: BooticClient::Relation
- Inherits:
-
Object
- Object
- BooticClient::Relation
- Defined in:
- lib/bootic_client/relation.rb
Class Method Summary collapse
Instance Method Summary collapse
- #docs ⇒ Object
- #get(opts = {}) ⇒ Object
- #href ⇒ Object
-
#initialize(attrs, client, wrapper_class = Entity) ⇒ Relation
constructor
A new instance of Relation.
- #inspect ⇒ Object
- #name ⇒ Object
- #templated? ⇒ Boolean
- #title ⇒ Object
- #type ⇒ Object
Constructor Details
Class Method Details
.expand(href, opts = {}) ⇒ Object
48 49 50 |
# File 'lib/bootic_client/relation.rb', line 48 def self.(href, opts = {}) URITemplate.new(href).(opts) end |
Instance Method Details
#docs ⇒ Object
36 37 38 |
# File 'lib/bootic_client/relation.rb', line 36 def docs attrs['docs'] end |
#get(opts = {}) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/bootic_client/relation.rb', line 40 def get(opts = {}) if templated? client.get_and_wrap uri.(opts), wrapper_class else client.get_and_wrap href, wrapper_class, opts end end |
#href ⇒ Object
16 17 18 |
# File 'lib/bootic_client/relation.rb', line 16 def href attrs['href'] end |
#inspect ⇒ Object
12 13 14 |
# File 'lib/bootic_client/relation.rb', line 12 def inspect %(#<#{self.class.name} #{attrs.inspect}>) end |
#name ⇒ Object
24 25 26 |
# File 'lib/bootic_client/relation.rb', line 24 def name attrs['name'] end |
#templated? ⇒ Boolean
20 21 22 |
# File 'lib/bootic_client/relation.rb', line 20 def templated? !!attrs['templated'] end |
#title ⇒ Object
28 29 30 |
# File 'lib/bootic_client/relation.rb', line 28 def title attrs['title'] end |
#type ⇒ Object
32 33 34 |
# File 'lib/bootic_client/relation.rb', line 32 def type attrs['type'] end |