Class: Shaf::Profile::Relation

Inherits:
Object
  • Object
show all
Includes:
UniqueId
Defined in:
lib/shaf/profile/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UniqueId

#__pending_id?, #id

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_typeObject (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

#docObject (readonly)

Returns the value of attribute doc.



10
11
12
# File 'lib/shaf/profile/relation.rb', line 10

def doc
  @doc
end

#hrefObject (readonly)

Returns the value of attribute href.



10
11
12
# File 'lib/shaf/profile/relation.rb', line 10

def href
  @href
end

#http_methodsObject (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

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/shaf/profile/relation.rb', line 10

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent.



10
11
12
# File 'lib/shaf/profile/relation.rb', line 10

def parent
  @parent
end

#payload_typeObject (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

#attributesObject



24
25
26
# File 'lib/shaf/profile/relation.rb', line 24

def attributes
  @attributes ||= []
end