Market Administration Functions
Add a user account
user - OnappMarket::Admin::User
- user to add
OnappMarket::API::Response - User is populated with user_id if is_ok?
admin
# File lib/onapp_market/admin.rb, line 23 def add_user(user) @api.post("/admin/user", OnappMarket::API::Serialize.to_hash(user)) end
Delete a user
user_id - user id of user to delete
OnappMarket::API::Response - deleted if is_ok?
admin
# File lib/onapp_market/admin.rb, line 61 def del_user(user_id) @api.delete("/admin/user/#{user_id.url_safe}") end
Get a user
user_id - User id of user we
wish to retrieve
OnappMarket::API::Response - data contains OnappMarket::Admin::User if is_ok?
admin
# File lib/onapp_market/admin.rb, line 35 def get_user(user_id) @api.get("/admin/user/#{user_id.url_safe}") end
Get a user’s billing statistics
user_id - user id of user whose billing data we require
start_date - DateTime - start date
end_date - DateTime - end date
period - Billing period: hourly|daily|monthly
OnappMarket::API::Response - object/hash of JSON billing data if is_ok?
admin
# File lib/onapp_market/admin.rb, line 76 def get_user_billing_data(user_id, start_date, end_date, period = :daily) @api.get("/admin/user/#{user_id.url_safe}/billing", {:start => start_date.rfc3339, :end => end_date.rfc3339, :period => period.to_s}) end
Get a list of users
filter - Hash of exact match filters, for example: {:name
=> "Jon*"}, default none
detail - Detail or not, default not
OnappMarket::API::Response - Array of user_ids if is_ok?
admin
# File lib/onapp_market/admin.rb, line 49 def get_users(filter = {}, detail = false) @api.get("/admin/user", {:filter => filter, :detail => detail}) end