Class: Floe::ServiceNow::ServiceCatalog
- Defined in:
- lib/floe/servicenow/service_catalog.rb
Class Method Summary collapse
- .add_to_cart(params, secrets, _context) ⇒ Object
- .checkout_cart(params, secrets, _context) ⇒ Object
- .empty_cart(params, secrets, _context) ⇒ Object
- .get_cart(params, secrets, _context) ⇒ Object
- .get_catalog(params, secrets, _context) ⇒ Object
- .get_catalogs(params, secrets, _context) ⇒ Object
- .get_categories(params, secrets, _context) ⇒ Object
- .get_category(params, secrets, _context) ⇒ Object
- .get_item(params, secrets, _context) ⇒ Object
- .get_items(params, secrets, _context) ⇒ Object
- .get_request(params, secrets, _context) ⇒ Object
- .get_requested_item(params, secrets, _context) ⇒ Object
- .remove_from_cart(params, secrets, _context) ⇒ Object
- .search_items(params, secrets, _context) ⇒ Object
- .submit_catalog_item(params, secrets, _context) ⇒ Object
- .submit_order(params, secrets, _context) ⇒ Object
- .update_cart_item(params, secrets, _context) ⇒ Object
Class Method Details
.add_to_cart(params, secrets, _context) ⇒ Object
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/floe/servicenow/service_catalog.rb', line 186 def self.add_to_cart(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_add_to_cart_params(params) return ServiceNow.error!({}, :cause => error) if error cart_id = params["cart_id"] || "default" http_params = build_http_params( "POST", "/api/sn_sc/servicecatalog/cart/#{cart_id}/add_item", params, secrets, :body => build_add_to_cart_body(params) ) http_request(http_params, {}, {}) end |
.checkout_cart(params, secrets, _context) ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/floe/servicenow/service_catalog.rb', line 257 def self.checkout_cart(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_checkout_cart_params(params) return ServiceNow.error!({}, :cause => error) if error http_params = build_http_params( "POST", "/api/sn_sc/servicecatalog/cart/checkout", params, secrets, :body => build_checkout_cart_body(params) ) http_request(http_params, {}, {}) end |
.empty_cart(params, secrets, _context) ⇒ Object
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/floe/servicenow/service_catalog.rb', line 240 def self.empty_cart(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_empty_cart_params(params) return ServiceNow.error!({}, :cause => error) if error cart_id = params["cart_id"] || "default" http_params = build_http_params( "DELETE", "/api/sn_sc/servicecatalog/cart/#{cart_id}/empty", params, secrets ) http_request(http_params, {}, {}) end |
.get_cart(params, secrets, _context) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/floe/servicenow/service_catalog.rb', line 171 def self.get_cart(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_get_cart_params(params) return ServiceNow.error!({}, :cause => error) if error http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/cart", params, secrets ) http_request(http_params, {}, {}) end |
.get_catalog(params, secrets, _context) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/floe/servicenow/service_catalog.rb', line 75 def self.get_catalog(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_get_catalog_params(params) return ServiceNow.error!({}, :cause => error) if error catalog_id = params["catalog_id"] http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/catalogs/#{catalog_id}", params, secrets ) http_request(http_params, {}, {}) end |
.get_catalogs(params, secrets, _context) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/floe/servicenow/service_catalog.rb', line 60 def self.get_catalogs(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_get_catalogs_params(params) return ServiceNow.error!({}, :cause => error) if error http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/catalogs", params, secrets ) http_request(http_params, {}, {}) end |
.get_categories(params, secrets, _context) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/floe/servicenow/service_catalog.rb', line 92 def self.get_categories(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_get_categories_params(params) return ServiceNow.error!({}, :cause => error) if error http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/categories", params, secrets ) http_request(http_params, {}, {}) end |
.get_category(params, secrets, _context) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/floe/servicenow/service_catalog.rb', line 107 def self.get_category(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_get_category_params(params) return ServiceNow.error!({}, :cause => error) if error category_id = params["category_id"] http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/categories/#{category_id}", params, secrets ) http_request(http_params, {}, {}) end |
.get_item(params, secrets, _context) ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/floe/servicenow/service_catalog.rb', line 139 def self.get_item(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_get_item_params(params) return ServiceNow.error!({}, :cause => error) if error item_id = params["item_id"] http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/items/#{item_id}", params, secrets ) http_request(http_params, {}, {}) end |
.get_items(params, secrets, _context) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/floe/servicenow/service_catalog.rb', line 124 def self.get_items(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_get_items_params(params) return ServiceNow.error!({}, :cause => error) if error http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/items", params, secrets ) http_request(http_params, {}, {}) end |
.get_request(params, secrets, _context) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/floe/servicenow/service_catalog.rb', line 26 def self.get_request(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_request_params(params) return ServiceNow.error!({}, :cause => error) if error request_id = params["request_id"] http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/requests/#{request_id}", params, secrets ) http_request(http_params, {}, {}) end |
.get_requested_item(params, secrets, _context) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/floe/servicenow/service_catalog.rb', line 43 def self.get_requested_item(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_requested_item_params(params) return ServiceNow.error!({}, :cause => error) if error requested_item_id = params["requested_item_id"] http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/items/#{requested_item_id}/get_item_summary", params, secrets ) http_request(http_params, {}, {}) end |
.remove_from_cart(params, secrets, _context) ⇒ Object
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/floe/servicenow/service_catalog.rb', line 222 def self.remove_from_cart(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_remove_from_cart_params(params) return ServiceNow.error!({}, :cause => error) if error cart_id = params["cart_id"] || "default" http_params = build_http_params( "DELETE", "/api/sn_sc/servicecatalog/cart/#{cart_id}/remove_item", params, secrets, :body => build_remove_from_cart_body(params) ) http_request(http_params, {}, {}) end |
.search_items(params, secrets, _context) ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/floe/servicenow/service_catalog.rb', line 156 def self.search_items(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_search_items_params(params) return ServiceNow.error!({}, :cause => error) if error http_params = build_http_params( "GET", "/api/sn_sc/servicecatalog/items", params, secrets ) http_request(http_params, {}, {}) end |
.submit_catalog_item(params, secrets, _context) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/floe/servicenow/service_catalog.rb', line 8 def self.submit_catalog_item(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_submit_catalog_item_params(params) return ServiceNow.error!({}, :cause => error) if error item_sys_id = params["item_sys_id"] http_params = build_http_params( "POST", "/api/sn_sc/servicecatalog/items/#{item_sys_id}/order_now", params, secrets, :body => build_submit_catalog_item_body(params) ) http_request(http_params, {}, {}) end |
.submit_order(params, secrets, _context) ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/floe/servicenow/service_catalog.rb', line 273 def self.submit_order(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_submit_order_params(params) return ServiceNow.error!({}, :cause => error) if error http_params = build_http_params( "POST", "/api/sn_sc/servicecatalog/cart/submit_order", params, secrets, :body => build_submit_order_body(params) ) http_request(http_params, {}, {}) end |
.update_cart_item(params, secrets, _context) ⇒ Object
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/floe/servicenow/service_catalog.rb', line 204 def self.update_cart_item(params, secrets, _context) error = verify_credentials(secrets) error ||= verify_update_cart_item_params(params) return ServiceNow.error!({}, :cause => error) if error cart_id = params["cart_id"] || "default" http_params = build_http_params( "POST", "/api/sn_sc/servicecatalog/cart/#{cart_id}/update_item", params, secrets, :body => build_update_cart_item_body(params) ) http_request(http_params, {}, {}) end |