Class: Podio::User

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

Overview

Direct Known Subclasses

ContractUser

Instance Attribute Summary

Attributes inherited from ActivePodio::Base

#attributes

Class Method Summary collapse

Methods inherited from ActivePodio::Base

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

Constructor Details

This class inherits a constructor from ActivePodio::Base

Class Method Details

.activate(attributes) ⇒ Object



77
78
79
80
81
82
83
84
# File 'lib/podio/models/user.rb', line 77

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

  member response.body
end

.can_request_callObject



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

def can_request_call
  response = Podio.connection.get("/user/request_call")
  response.body['requestable']
end

.create(attributes) ⇒ Object



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

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



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

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

  response.body['user_id']
end

.currentObject



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

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

.deleteObject



155
156
157
# File 'lib/podio/models/user.rb', line 155

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

.find_all_admins_for_org(org_id) ⇒ Object



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

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

.get_property(name) ⇒ Object



91
92
93
# File 'lib/podio/models/user.rb', line 91

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

.get_property_hash(name) ⇒ Object



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

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

.get_sales_agent_profileObject



172
173
174
# File 'lib/podio/models/user.rb', line 172

def get_sales_agent_profile
  Podio.connection.get("/user/sales_agent").body
end

.internal_sourceObject



159
160
161
# File 'lib/podio/models/user.rb', line 159

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

.mail_verification(attributes) ⇒ Object



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

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

  response.body
end

.merge(activation_code) ⇒ Object



163
164
165
166
167
168
169
170
# File 'lib/podio/models/user.rb', line 163

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

  response.status
end

.recover(mail) ⇒ Object



137
138
139
140
141
142
143
144
# File 'lib/podio/models/user.rb', line 137

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

  response.status
end

.remove_property(name) ⇒ Object



120
121
122
# File 'lib/podio/models/user.rb', line 120

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

.request_callObject



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

def request_call
  Podio.connection.post("/user/request_call").status
end

.resend_signup_email(mail) ⇒ Object



176
177
178
179
180
181
182
183
# File 'lib/podio/models/user.rb', line 176

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

  response.status
end

.reset(password, recovery_code) ⇒ Object



146
147
148
149
150
151
152
153
# File 'lib/podio/models/user.rb', line 146

def reset(password, recovery_code)
  response = Podio.client.trusted_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



110
111
112
113
114
115
116
117
# File 'lib/podio/models/user.rb', line 110

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



95
96
97
# File 'lib/podio/models/user.rb', line 95

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

.set_property_hash(name, hash) ⇒ Object



105
106
107
# File 'lib/podio/models/user.rb', line 105

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

.update(attributes) ⇒ Object



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

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

.update_profile(attributes) ⇒ Object



59
60
61
# File 'lib/podio/models/user.rb', line 59

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

.update_profile_field(key, attributes) ⇒ Object



64
65
66
# File 'lib/podio/models/user.rb', line 64

def update_profile_field(key, attributes)
  Podio.connection.put("/user/profile/#{key}", attributes).status
end

.verify(verification_code) ⇒ Object



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

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