Class: TopTL::Voter
- Inherits:
-
Object
show all
- Includes:
- Model
- Defined in:
- lib/toptl/types.rb
Instance Attribute Summary
Attributes included from Model
#raw
Class Method Summary
collapse
Methods included from Model
included, #initialize, #to_h
Class Method Details
.from_hash(data) ⇒ Object
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/toptl/types.rb', line 93
def self.from_hash(data)
data ||= {}
new(
user_id: (data["userId"] || data["id"] || "").to_s,
first_name: data["firstName"],
username: data["username"],
voted_at: data["votedAt"] || data["createdAt"],
raw: data
)
end
|