Class: PDC::V1::ReleaseVariant
- Defined in:
- lib/pdc/v1/release_variant.rb
Instance Attribute Summary
Attributes included from Resource::RestApi
Instance Method Summary collapse
- #cpe ⇒ Object
-
#initialize(attrs = {}) ⇒ ReleaseVariant
constructor
NOTE ReleaseVariant is different from other resources in the way its url is created so it requires special handling.
- #release ⇒ Object
Methods included from Resource::Scopes
Methods included from Resource::Attributes
Methods included from Resource::Identity
#==, #as_json, #hash, #id, #id=, #id?, #uri
Methods included from Logging
Constructor Details
#initialize(attrs = {}) ⇒ ReleaseVariant
NOTE ReleaseVariant is different from other resources in the way its url is created so it requires special handling
16 17 18 19 20 21 22 |
# File 'lib/pdc/v1/release_variant.rb', line 16 def initialize(attrs = {}) super instance_uri = self.class.resource_path + '/(:release)/(:uid)' instance_path = PDC::Resource::Path.new(instance_uri, attrs). @url = connection.build_url(instance_path).to_s end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PDC::Resource::Attributes
Instance Method Details
#cpe ⇒ Object
24 25 26 |
# File 'lib/pdc/v1/release_variant.rb', line 24 def cpe VariantCpe.where(variant_uid: attributes[:uid]).first end |
#release ⇒ Object
9 10 11 |
# File 'lib/pdc/v1/release_variant.rb', line 9 def release Release.find(attributes[:release]) end |