Class: Shaf::Profile::Relation
- Inherits:
-
Object
- Object
- Shaf::Profile::Relation
- Includes:
- UniqueId
- Defined in:
- lib/shaf/profile/relation.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#http_methods ⇒ Object
readonly
Returns the value of attribute http_methods.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#payload_type ⇒ Object
readonly
Returns the value of attribute payload_type.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(name, **opts) ⇒ Relation
constructor
A new instance of Relation.
Methods included from UniqueId
Constructor Details
#initialize(name, **opts) ⇒ Relation
Returns a new instance of Relation.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/shaf/profile/relation.rb', line 12 def initialize(name, **opts) @name = name.to_sym @doc = opts[:doc].freeze @href = opts[:href].freeze http_methods = Array(opts[:http_method]) + Array(opts[:http_methods]) http_methods << 'GET' if http_methods.empty? @http_methods = http_methods.map { |m| m.to_s.upcase }.uniq.freeze @payload_type = opts[:payload_type].freeze @content_type = opts[:content_type].freeze @parent = opts[:parent] end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
10 11 12 |
# File 'lib/shaf/profile/relation.rb', line 10 def content_type @content_type end |
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
10 11 12 |
# File 'lib/shaf/profile/relation.rb', line 10 def doc @doc end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
10 11 12 |
# File 'lib/shaf/profile/relation.rb', line 10 def href @href end |
#http_methods ⇒ Object (readonly)
Returns the value of attribute http_methods.
10 11 12 |
# File 'lib/shaf/profile/relation.rb', line 10 def http_methods @http_methods end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/shaf/profile/relation.rb', line 10 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
10 11 12 |
# File 'lib/shaf/profile/relation.rb', line 10 def parent @parent end |
#payload_type ⇒ Object (readonly)
Returns the value of attribute payload_type.
10 11 12 |
# File 'lib/shaf/profile/relation.rb', line 10 def payload_type @payload_type end |
Instance Method Details
#attributes ⇒ Object
24 25 26 |
# File 'lib/shaf/profile/relation.rb', line 24 def attributes @attributes ||= [] end |