Class: Layer::Resources::User
Instance Attribute Summary
#attributes, #client
Class Method Summary
collapse
Instance Method Summary
collapse
class_name, create, #destroy, #initialize, #inspect, list, #method_missing, pluralized_name, #respond_to_missing?, #update, url, #uuid
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Layer::Resource
Class Method Details
.find(client, url, id) ⇒ Object
4
5
6
|
# File 'lib/layer/resources/user.rb', line 4
def self.find(client, url, id)
new({"id" => id, "url" => "users/#{id}"}, client)
end
|
Instance Method Details
#badge ⇒ Object
49
50
51
|
# File 'lib/layer/resources/user.rb', line 49
def badge
client.get("#{url}/badge")
end
|
#create_identity(params) ⇒ Object
20
21
22
|
# File 'lib/layer/resources/user.rb', line 20
def create_identity(params)
client.post(identity_url, body: params.to_json)
end
|
#destroy_identity ⇒ Object
40
41
42
|
# File 'lib/layer/resources/user.rb', line 40
def destroy_identity
client.delete(identity_url)
end
|
#identity ⇒ Object
24
25
26
|
# File 'lib/layer/resources/user.rb', line 24
def identity
client.get(identity_url)
end
|
#replace_identity(params) ⇒ Object
36
37
38
|
# File 'lib/layer/resources/user.rb', line 36
def replace_identity(params)
client.put(identity_url, body: params.to_json)
end
|
#set_badge(badge_count) ⇒ Object
44
45
46
47
|
# File 'lib/layer/resources/user.rb', line 44
def set_badge(badge_count)
body = { external_unread_count: badge_count }
client.put("#{url}/badge", body: body.to_json)
end
|
#update_identity(params) ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/layer/resources/user.rb', line 28
def update_identity(params)
client.patch(
identity_url,
body: params.to_json,
headers: client.
)
end
|