Class: Craftar::CollectionBundle
- Defined in:
- lib/craftar/collection_bundle.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
readonly
Returns the value of attribute app.
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#resource_uri ⇒ Object
readonly
Returns the value of attribute resource_uri.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts) ⇒ CollectionBundle
constructor
A new instance of CollectionBundle.
- #save ⇒ Object
- #update(opts) ⇒ Object
- #update_attributes(response) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(opts) ⇒ CollectionBundle
Returns a new instance of CollectionBundle.
8 9 10 11 12 13 14 15 16 |
# File 'lib/craftar/collection_bundle.rb', line 8 def initialize(opts) @uuid = opts[:uuid] @resource_uri = opts[:resource_uri] @app = opts[:app] @collection = opts[:collection] @version = opts[:version] @file = opts[:file] @status = opts[:status] end |
Instance Attribute Details
#app ⇒ Object (readonly)
Returns the value of attribute app.
3 4 5 |
# File 'lib/craftar/collection_bundle.rb', line 3 def app @app end |
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/craftar/collection_bundle.rb', line 3 def collection @collection end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
3 4 5 |
# File 'lib/craftar/collection_bundle.rb', line 3 def file @file end |
#resource_uri ⇒ Object (readonly)
Returns the value of attribute resource_uri.
3 4 5 |
# File 'lib/craftar/collection_bundle.rb', line 3 def resource_uri @resource_uri end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/craftar/collection_bundle.rb', line 3 def status @status end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/craftar/collection_bundle.rb', line 3 def uuid @uuid end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
3 4 5 |
# File 'lib/craftar/collection_bundle.rb', line 3 def version @version end |
Class Method Details
.craftar_name ⇒ Object
4 5 6 |
# File 'lib/craftar/collection_bundle.rb', line 4 def self.craftar_name 'collectionbundle' end |
Instance Method Details
#save ⇒ Object
18 19 20 21 22 |
# File 'lib/craftar/collection_bundle.rb', line 18 def save response = json_call(:post, app: @app, collection: @collection, version: @version) update_attributes(response) self end |
#update(opts) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/craftar/collection_bundle.rb', line 24 def update(opts) attributes = { app: opts[:app], collection: opts[:collection], version: opts[:version] }.select { |_, value| !value.nil? } response = json_call(:put, attributes) update_attributes(response) self end |
#update_attributes(response) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/craftar/collection_bundle.rb', line 36 def update_attributes(response) @uuid = response['uuid'] @app = response['app'] @collection = response['collection'] @file = response['file'] @resource_uri = response['resource_uri'] @status = response['status'] @version = response['version'] end |