Sha256: bea2de185665d6b8067d0ecfffcbd3db32a13daca186a088a0583e1a9085d09c
Contents?: true
Size: 1.47 KB
Versions: 24
Compression:
Stored size: 1.47 KB
Contents
module NetSuite module Rest module Utilities class Roles class << self def get(opts={}) status, body = Request.get( email: opts.fetch(:email, Configuration.email), password: opts.fetch(:password, Configuration.password), sandbox: opts.fetch(:sandbox, Configuration.sandbox), uri: '/roles', ) status == "200" ? format_response(body) : body end private def format_response(parsed) uniq_accounts = parsed.map {|hash| hash["account"] }.uniq uniq_accounts.map do |hash| matches = parsed.select {|x| x["account"]["internalId"] == hash["internalId"]} { account_id: hash["internalId"], account_name: hash["name"], roles: matches.map do |match| { id: match["role"]["internalId"], name: match["role"]["name"] } end.uniq, wsdls: { webservices: matches.map {|match| match["dataCenterURLs"]["webservicesDomain"] }.uniq, rest: matches.map {|match| match["dataCenterURLs"]["restDomain"] }.uniq, system: matches.map {|match| match["dataCenterURLs"]["systemDomain"] }.uniq, } } end end end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems