Class: Podio::User

Inherits:
ActivePodio::Base show all
Defined in:
lib/podio/models/user.rb

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes, #error_code, #error_message, #error_parameters, #error_propagate

Class Method Summary collapse

Methods inherited from ActivePodio::Base

#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, #initialize_attributes, list, member, #new_record?, output_attribute_as_json, #persisted?, property, #to_param

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.activate(attributes) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/podio/models/user.rb', line 61

def activate(attributes)
  response = Podio.connection.post do |req|
    req.url '/user/activate_user'
    req.body = attributes
  end

  member response.body
end

.create(attributes) ⇒ Object



35
36
37
38
39
40
41
42
# File 'lib/podio/models/user.rb', line 35

def create(attributes)
  response = Podio.client.trusted_connection.post do |req|
    req.url '/user/'
    req.body = attributes
  end

  response.body['user_id']
end

.create_inactive(attributes) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/podio/models/user.rb', line 44

def create_inactive(attributes)
  response = Podio.connection.post do |req|
    req.url '/user/inactive/'
    req.body = attributes
  end

  response.body['user_id']
end

.currentObject



31
32
33
# File 'lib/podio/models/user.rb', line 31

def current
  member Podio.connection.get("/user/").body
end

.deleteObject



134
135
136
# File 'lib/podio/models/user.rb', line 134

def delete
  Podio.connection.delete("/user/").status
end

.find_all_admins_for_org(org_id) ⇒ Object



70
71
72
# File 'lib/podio/models/user.rb', line 70

def find_all_admins_for_org(org_id)
  list Podio.connection.get("/org/#{org_id}/admin/").body
end

.get_property(name) ⇒ Object



74
75
76
# File 'lib/podio/models/user.rb', line 74

def get_property(name)
  Podio.connection.get("/user/property/#{name}").body['value']
end

.get_property_hash(name) ⇒ Object



82
83
84
# File 'lib/podio/models/user.rb', line 82

def get_property_hash(name)
  Podio.connection.get("/user/property/#{name}").body
end

.internal_sourceObject



138
139
140
# File 'lib/podio/models/user.rb', line 138

def internal_source
  Podio.connection.get("/user/source").body
end

.mail_verification(attributes) ⇒ Object



103
104
105
106
107
108
109
110
# File 'lib/podio/models/user.rb', line 103

def mail_verification(attributes)
  response = Podio.connection.post do |req|
    req.url '/user/mail_verification/'
    req.body = attributes
  end

  response.body
end

.recover(mail) ⇒ Object



116
117
118
119
120
121
122
123
# File 'lib/podio/models/user.rb', line 116

def recover(mail)
  response = Podio.connection.post do |req|
    req.url '/user/recover_password'
    req.body = {:mail => mail}
  end

  response.status
end

.remove_property(name) ⇒ Object



99
100
101
# File 'lib/podio/models/user.rb', line 99

def remove_property(name)
  Podio.connection.delete("/user/property/#{name}", {}).status
end

.reset(password, recovery_code) ⇒ Object



125
126
127
128
129
130
131
132
# File 'lib/podio/models/user.rb', line 125

def reset(password, recovery_code)
  response = Podio.connection.post do |req|
    req.url '/user/reset_password'
    req.body = {:password => password, :recovery_code => recovery_code}
  end

  response.body
end

.set_properties(attributes) ⇒ Object



90
91
92
93
94
95
96
97
# File 'lib/podio/models/user.rb', line 90

def set_properties(attributes)
  response = Podio.connection.put do |req|
    req.url '/user/property/'
    req.body = attributes
  end

  response.body
end

.set_property(name, value) ⇒ Object



78
79
80
# File 'lib/podio/models/user.rb', line 78

def set_property(name, value)
  Podio.connection.put("/user/property/#{name}", {:value => value}).status
end

.set_property_hash(name, hash) ⇒ Object



86
87
88
# File 'lib/podio/models/user.rb', line 86

def set_property_hash(name, hash)
  Podio.connection.put("/user/property/#{name}", hash).status
end

.update(attributes) ⇒ Object



53
54
55
# File 'lib/podio/models/user.rb', line 53

def update(attributes)
  Podio.connection.put("/user/", attributes).status
end

.update_profile(attributes) ⇒ Object



57
58
59
# File 'lib/podio/models/user.rb', line 57

def update_profile(attributes)
  Podio.connection.put("/user/profile/", attributes).status
end

.verify(verification_code) ⇒ Object



112
113
114
# File 'lib/podio/models/user.rb', line 112

def verify(verification_code)
  Podio.connection.post("/user/mail_verification/#{verification_code}").status
end