Module: ConfigOpenApi
- Included in:
- CdnetworksClient
- Defined in:
- lib/cdnetworks-client/config_open_api.rb
Instance Method Summary collapse
- #add(options = {}) ⇒ Object
- #add_config_credentials(options) ⇒ Object
- #config_open_path(command) ⇒ Object
- #edit(options = {}) ⇒ Object
- #list(options = {}) ⇒ Object
- #view(options = {}) ⇒ Object
Instance Method Details
#add(options = {}) ⇒ Object
15 16 17 |
# File 'lib/cdnetworks-client/config_open_api.rb', line 15 def add(={}) call(config_open_path("add"),add_config_credentials()) end |
#add_config_credentials(options) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/cdnetworks-client/config_open_api.rb', line 31 def add_config_credentials() if location == "Beta" session_token = get_session_token keys = get_api_key_list(session_token) api_key = keys.find{|k| k["type"] == 0}["apiKey"] [:sessionToken] = session_token [:apiKey] = api_key else [:user] = @user [:pass] = @password end end |
#config_open_path(command) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cdnetworks-client/config_open_api.rb', line 23 def config_open_path(command) if location == "Beta" "/api/rest/pan/site/#{command}" else "/config/rest/pan/site/#{command}" end end |
#edit(options = {}) ⇒ Object
19 20 21 |
# File 'lib/cdnetworks-client/config_open_api.rb', line 19 def edit(={}) call(config_open_path("edit"),add_config_credentials()) end |
#list(options = {}) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/cdnetworks-client/config_open_api.rb', line 2 def list(={}) response = call(config_open_path("list"), add_config_credentials()) if location == "Beta" response[:body]["PadConfigResponse"]["data"]["data"] else response end end |
#view(options = {}) ⇒ Object
11 12 13 |
# File 'lib/cdnetworks-client/config_open_api.rb', line 11 def view(={}) call(config_open_path("view"),add_config_credentials()) end |