Module: Fog::RiakCS::UserUtils
- Included in:
- Provisioning::Mock, Provisioning::Real
- Defined in:
- lib/fog/riakcs/user_utils.rb
Instance Method Summary collapse
Instance Method Details
#update_mock_user(key_id, user) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/fog/riakcs/user_utils.rb', line 12 def update_mock_user(key_id, user) if data[key_id] if status = user[:status] data[key_id][:status] = status end if user[:new_key_secret] data[key_id][:key_secret] = rand(100).to_s end Excon::Response.new.tap do |response| response.status = 200 response.body = data[key_id] end else Excon::Response.new.tap do |response| response.status = 403 end end end |
#update_riakcs_user(key_id, user) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/fog/riakcs/user_utils.rb', line 4 def update_riakcs_user(key_id, user) response = @s3_connection.put_object('riak-cs', "user/#{key_id}", Fog::JSON.encode(user), { 'Content-Type' => 'application/json' }) if !response.body.empty? response.body = Fog::JSON.decode(response.body) end response end |