Class: Integrations::Thingiverse::CollectionDeserializer
- Inherits:
-
BaseDeserializer
- Object
- BaseDeserializer
- BaseDeserializer
- Integrations::Thingiverse::CollectionDeserializer
- Defined in:
- app/deserializers/integrations/thingiverse/collection_deserializer.rb
Constant Summary
Constants inherited from BaseDeserializer
BaseDeserializer::USERNAME_PATTERN
Instance Attribute Summary collapse
-
#collection_id ⇒ Object
readonly
Returns the value of attribute collection_id.
Instance Method Summary collapse
Instance Attribute Details
#collection_id ⇒ Object (readonly)
Returns the value of attribute collection_id.
2 3 4 |
# File 'app/deserializers/integrations/thingiverse/collection_deserializer.rb', line 2 def collection_id @collection_id end |
Instance Method Details
#capabilities ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'app/deserializers/integrations/thingiverse/collection_deserializer.rb', line 15 def capabilities { class: Collection, name: true, notes: true, creator: true, models: true } end |
#deserialize ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/deserializers/integrations/thingiverse/collection_deserializer.rb', line 4 def deserialize return {} unless valid? r = fetch "collections/#{CGI.escapeURIComponent(@collection_id)}" things = fetch "collections/#{CGI.escapeURIComponent(@collection_id)}/things" { name: r.body["name"], notes: r.body["description"], models: things.body.pluck("public_url") }.merge(creator_attributes(r.body["creator"])) end |