Class: Babili::Platform::User
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Babili::Platform::User
- Defined in:
- lib/babili/platform/user.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.all ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/babili/platform/user.rb', line 8 def self.all raw_users = Babili::Client.get(path) raw_users["data"].map do |raw_user| user = new(raw_user["attributes"]) user.id = raw_user["id"] user end end |
.create(params = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/babili/platform/user.rb', line 17 def self.create(params = {}) params = { data: { id: params["id"] || params [:id], attributes: { alive_at: params["alive_at"] || params [:alive_at], status: params["status"] || params [:status], created_at: params["created_at"] || params [:created_at], updated_at: params["updated_at"] || params [:updated_at], last_messages_digest_sent_at: params["last_messages_digest_sent_at"] || params [:last_messages_digest_sent_at] } } } raw_user = Babili::Client.post(path, params)["data"] user = new(raw_user["attributes"]) user.id = raw_user["id"] user end |
.path ⇒ Object
4 5 6 |
# File 'lib/babili/platform/user.rb', line 4 def self.path "platform/users" end |