Class: Morpheus::UserSourcesInterface
- Inherits:
-
APIClient
- Object
- APIClient
- Morpheus::UserSourcesInterface
- Defined in:
- lib/morpheus/api/user_sources_interface.rb
Instance Method Summary collapse
- #activate(account_id, id, options) ⇒ Object
-
#create(account_id, options) ⇒ Object
def available_roles(account_id, id=nil, options={}) url = build_url(account_id, id) + "/available-roles" headers = { params: {}, authorization: "Bearer #@access_token" } headers.merge!(options) opts = :get, url: url, timeout: 10, headers: headers execute(opts) end.
- #deactivate(account_id, id, options) ⇒ Object
- #destroy(account_id, id) ⇒ Object
- #get(account_id, id) ⇒ Object
-
#get_type(id, params = {}) ⇒ Object
move me to my own interface class.
-
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ UserSourcesInterface
constructor
A new instance of UserSourcesInterface.
- #list(account_id, options = {}) ⇒ Object
-
#list_types(params = {}) ⇒ Object
move me to my own interface class.
- #update(account_id, id, options) ⇒ Object
- #update_subdomain(account_id, id, options) ⇒ Object
Constructor Details
#initialize(access_token, refresh_token, expires_at = nil, base_url = nil) ⇒ UserSourcesInterface
Returns a new instance of UserSourcesInterface.
4 5 6 7 8 9 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 4 def initialize(access_token, refresh_token, expires_at = nil, base_url=nil) @access_token = access_token @refresh_token = refresh_token @base_url = base_url @expires_at = expires_at end |
Instance Method Details
#activate(account_id, id, options) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 65 def activate(account_id, id, ) url = build_url(account_id, id) + "/activate" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end |
#create(account_id, options) ⇒ Object
def available_roles(account_id, id=nil, options={}) url = build_url(account_id, id) + "/available-roles" headers = { params: {}, authorization: "Bearer #@access_token" } headers.merge!(options) opts = :get, url: url, timeout: 10, headers: headers execute(opts) end
42 43 44 45 46 47 48 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 42 def create(account_id, ) url = build_url(account_id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :post, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end |
#deactivate(account_id, id, options) ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 73 def deactivate(account_id, id, ) url = build_url(account_id, id) + "/deactivate" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end |
#destroy(account_id, id) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 58 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 |
#get(account_id, id) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 11 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 |
#get_type(id, params = {}) ⇒ Object
move me to my own interface class
98 99 100 101 102 103 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 98 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 |
#list(account_id, options = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 19 def list(account_id, ={}) url = build_url(account_id) headers = { params: {}, authorization: "Bearer #{@access_token}" } headers[:params].merge!() opts = {method: :get, url: url, timeout: 10, headers: headers} execute(opts) end |
#list_types(params = {}) ⇒ Object
move me to my own interface class
90 91 92 93 94 95 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 90 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 |
#update(account_id, id, options) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 50 def update(account_id, id, ) url = build_url(account_id, id) headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end |
#update_subdomain(account_id, id, options) ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/morpheus/api/user_sources_interface.rb', line 81 def update_subdomain(account_id, id, ) url = build_url(account_id, id) + "/subdomain" headers = { :authorization => "Bearer #{@access_token}", 'Content-Type' => 'application/json' } payload = opts = {method: :put, url: url, timeout: 10, headers: headers, payload: payload.to_json} execute(opts) end |