Class: Dimelo::CCP::User
- Inherits:
-
API::Model
- Object
- API::Model
- Dimelo::CCP::User
- Defined in:
- lib/dimelo/ccp/api/model/user.rb
Constant Summary collapse
- CUSTOM_FIELD_COUNT =
10
- CUSTOM_FIELD_ATTRIBUTES =
(1..CUSTOM_FIELD_COUNT).map { |i| "custom_field_#{i}".to_sym }.freeze
Constants inherited from API::Model
API::Model::INTERPOLATION_PATTERN
Instance Attribute Summary
Attributes inherited from API::Model
#client, #errors, #tracked_attributes
Instance Method Summary collapse
- #avatar_url(size = 'normal') ⇒ Object
-
#block ⇒ Object
Blocks the specified user.
-
#unblock ⇒ Object
Unblocks the specified user.
Methods inherited from API::Model
#==, attribute, attributes, #attributes, #attributes=, belongs_to, compute_path, #create, #destroy, find, has_many, #initialize, #merge!, #new_record?, parse, path, #reload, #save, #submit_attributes, submit_attributes, #to_json, #tracked_submit_attributes, #update, #valid?, #warn
Constructor Details
This class inherits a constructor from Dimelo::CCP::API::Model
Instance Method Details
#avatar_url(size = 'normal') ⇒ Object
16 17 18 |
# File 'lib/dimelo/ccp/api/model/user.rb', line 16 def avatar_url(size='normal') @avatar_url || avatar.try(:[], size).try(:[], 'url') end |
#block ⇒ Object
Blocks the specified user
21 22 23 24 25 26 |
# File 'lib/dimelo/ccp/api/model/user.rb', line 21 def block path = "#{compute_path(attributes)}/block" response = client.transport(:post, path) self.attributes = Dimelo::CCP::API.decode_json(response) errors.empty? end |
#unblock ⇒ Object
Unblocks the specified user
29 30 31 32 33 34 |
# File 'lib/dimelo/ccp/api/model/user.rb', line 29 def unblock path = "#{compute_path(attributes)}/unblock" response = client.transport(:post, path) self.attributes = Dimelo::CCP::API.decode_json(response) errors.empty? end |