Class: App42::AppTab::App
- Inherits:
-
Object
- Object
- App42::AppTab::App
- Defined in:
- lib/appTab/App.rb
Instance Method Summary collapse
-
#create_app(appName, orgName) ⇒ Object
Create an app for a particular organization.
-
#initialize(api_key, secret_key, base_url) ⇒ App
constructor
this is a constructor that takes.
Constructor Details
#initialize(api_key, secret_key, base_url) ⇒ App
this is a constructor that takes
55 56 57 58 59 60 61 62 |
# File 'lib/appTab/App.rb', line 55 def initialize(api_key, secret_key, base_url) puts "create app->initialize" @api_key = api_key @secret_key = secret_key @base_url = base_url @resource = "app" @version = "1.0" end |
Instance Method Details
#create_app(appName, orgName) ⇒ Object
Create an app for a particular organization.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/appTab/App.rb', line 77 def create_app(appName, orgName) puts "createApp Called " puts "Base url #{@base_url}" util = Util.new connection = App42::Connection::RESTConnection.new(@base_url) body = {'app42' => {"app"=> { "name" => appName, "organizationName" => orgName }}}.to_json puts "Body #{body}" query_params = Hash.new params = { 'apiKey'=> @api_key, 'version' => @version, 'timeStamp' => util., } query_params = params.clone params.store("body", body) puts params puts query_params signature = util.sign(@secret_key, params) resource_url = "#{@version}/#{@resource}" response = connection.post(signature, resource_url, query_params, body) return response end |