class Morpheus::UserSourcesInterface
Public Instance Methods
Source
# File lib/morpheus/api/user_sources_interface.rb, line 44 def activate(account_id, id, options) url = build_url(account_id, id) + "/activate" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = options opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end
Source
# File lib/morpheus/api/user_sources_interface.rb, line 21 def create(account_id, options) url = build_url(account_id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = options opts = {method: :post, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end
Source
# File lib/morpheus/api/user_sources_interface.rb, line 52 def deactivate(account_id, id, options) url = build_url(account_id, id) + "/deactivate" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = options opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end
Source
# File lib/morpheus/api/user_sources_interface.rb, line 37 def destroy(account_id, id) url = build_url(account_id, id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } opts = {method: :delete, url: url, timeout: 10, headers: headers} execute(opts) end
Source
# File lib/morpheus/api/user_sources_interface.rb, line 5 def get(account_id, id) raise "#{self.class}.get() passed a blank id!" if id.to_s == '' url = build_url(account_id, id) headers = { params: {}, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, timeout: 10, headers: headers} execute(opts) end
Source
# File lib/morpheus/api/user_sources_interface.rb, line 77 def get_type(id, params={}) url = "#{@base_url}/api/user-source-types/#{id}" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, timeout: 10, headers: headers} execute(opts) end
move me to my own interface class
Source
# File lib/morpheus/api/user_sources_interface.rb, line 13 def list(account_id, options={}) url = build_url(account_id) headers = { params: {}, authorization: "Bearer #{@access_token}" } headers[:params].merge!(options) opts = {method: :get, url: url, timeout: 10, headers: headers} execute(opts) end
Source
# File lib/morpheus/api/user_sources_interface.rb, line 69 def list_types(params={}) url = "#{@base_url}/api/user-source-types" headers = { params: params, authorization: "Bearer #{@access_token}" } opts = {method: :get, url: url, timeout: 10, headers: headers} execute(opts) end
move me to my own interface class
Source
# File lib/morpheus/api/user_sources_interface.rb, line 29 def update(account_id, id, options) url = build_url(account_id, id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = options opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end
Source
# File lib/morpheus/api/user_sources_interface.rb, line 60 def update_subdomain(account_id, id, options) url = build_url(account_id, id) + "/subdomain" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = options opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end
Private Instance Methods
Source
# File lib/morpheus/api/user_sources_interface.rb, line 86 def build_url(account_id=nil, user_id=nil) url = "#{@base_url}/api" if account_id url += "/accounts/#{account_id}/user-sources" else url += "/user-sources" end if user_id url += "/#{user_id}" end url end