Class: Integrations::Thingiverse::CreatorDeserializer
- Inherits:
-
BaseDeserializer
- Object
- BaseDeserializer
- BaseDeserializer
- Integrations::Thingiverse::CreatorDeserializer
show all
- Defined in:
- app/deserializers/integrations/thingiverse/creator_deserializer.rb
Constant Summary
BaseDeserializer::USERNAME_PATTERN
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#username ⇒ Object
Returns the value of attribute username.
2
3
4
|
# File 'app/deserializers/integrations/thingiverse/creator_deserializer.rb', line 2
def username
@username
end
|
Class Method Details
.parse(data) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'app/deserializers/integrations/thingiverse/creator_deserializer.rb', line 10
def self.parse(data)
{
name: data["name"],
slug: data["name"],
notes: data["bio"],
links_attributes: [{url: data["public_url"]}],
avatar_remote_url: data["thumbnail"],
banner_remote_url: data["cover_image"]
}
end
|
Instance Method Details
#capabilities ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'app/deserializers/integrations/thingiverse/creator_deserializer.rb', line 21
def capabilities
{
class: Creator,
name: true,
slug: true,
notes: true
}
end
|
#deserialize ⇒ Object
4
5
6
7
8
|
# File 'app/deserializers/integrations/thingiverse/creator_deserializer.rb', line 4
def deserialize
return {} unless valid?
r = fetch "users/#{CGI.escapeURIComponent(@username)}"
self.class.parse(r.body)
end
|