nex_client 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee805369677f92651255b9e15f4f38f47ce4cee3
4
- data.tar.gz: d1a10a09dc9ca24456af09d068359b8c8b7b2f97
3
+ metadata.gz: f2f9046a18cc9d234db63aaac5f80b8973da9ba1
4
+ data.tar.gz: 6421cce72b2e485bdfc84e6ed89af57bf0df14bf
5
5
  SHA512:
6
- metadata.gz: c29fd30e917f5c8439f77a754820dd6c60afb253e97067cab10dedf29914590aa3bcc23345e4cc4c06cd9c30a256f8aa92ab07c9eecd59610f6889d066ebe0dd
7
- data.tar.gz: c9f1a77c903b38b8b6131dcc0139457911a0012931b7a3544259b0cea71b1bf308691f8e250eced2a2fbb39f7c4d297987d7b69003fecc7fe99d0fead5876cb0
6
+ metadata.gz: b6a44eca9ff5dd925fcef3658159fad7fe4addf4e9a99630a8e63ffa679464a8896f8efd38ad80b2abb594d5a2b123c903c3b63207e5fb1f1e35cc7ac39cc697
7
+ data.tar.gz: ab60f6dca0752249b3d4953ac70734eb4ea597f4b7007292caa7e70fac9c4f00b3430c8b1b1426bd3e40f08f5dc7e457686c42572b3291f7559829a06a679fa5
@@ -163,6 +163,16 @@ module NexClient
163
163
  end
164
164
  end
165
165
 
166
+ command :'apps:transfer' do |c|
167
+ c.syntax = 'nex-cli apps:transfer APP_NAME OWNER_HANDLE [options]'
168
+ c.summary = 'Transfer app ownership'
169
+ c.description = 'Transfer an app to another organization or user'
170
+ c.example 'transfer myapp to doecorp', 'nex-cli apps:transfer myapp doecorp'
171
+ c.action do |args, options|
172
+ NexClient::Commands::Apps.transfer(args,options)
173
+ end
174
+ end
175
+
166
176
  command :'apps:up' do |c|
167
177
  c.syntax = 'nex-cli apps:up APP_NAME [options]'
168
178
  c.summary = 'Scale applications up'
@@ -112,7 +112,7 @@ module NexClient
112
112
  error("Error! Could not find organization: #{opts.owner}")
113
113
  return false
114
114
  end
115
- e.relationships.attributes = { owner: { data: { type: 'organizations', id: o.id } } }
115
+ e.relationships.attributes = { owner: { data: { type: o.type, id: o.id } } }
116
116
  end
117
117
 
118
118
  # Save the resource
@@ -149,6 +149,40 @@ module NexClient
149
149
  success("Successfully destroyed app: #{name}")
150
150
  end
151
151
 
152
+ def self.transfer(args,opts)
153
+ name = args.first
154
+ e = NexClient::App.find(name: name).first
155
+
156
+ # Display error
157
+ unless e
158
+ error("Error! Could not find app: #{name}")
159
+ return false
160
+ end
161
+
162
+ # Get owner
163
+ handle = args.last
164
+ o = NexClient::Organization.find(handle: handle).first ||
165
+ NexClient::User.find(handle: handle).first
166
+
167
+ # Display error if owner not found
168
+ unless o
169
+ error("Error! Could not find owner: #{handle}")
170
+ return false
171
+ end
172
+
173
+ # Update and save record
174
+ e.relationships.attributes = { owner: { data: { type: o.type, id: o.id } } }
175
+ e.save
176
+
177
+ # Display errors if any
178
+ if e.errors.any?
179
+ display_record_errors(e)
180
+ return false
181
+ end
182
+
183
+ success("Successfully transfered #{name} to #{handle}")
184
+ end
185
+
152
186
  def self.restart(args,opts)
153
187
  name = args.first
154
188
  e = NexClient::App.find(name: name).first
@@ -1,3 +1,3 @@
1
1
  module NexClient
2
- VERSION = '0.4.0'
2
+ VERSION = '0.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nex_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Lachaume