codegears 0.0.12.pre → 0.0.13.pre

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.
data/lib/cg/api.rb CHANGED
@@ -3,9 +3,14 @@ require "httparty"
3
3
  module CG
4
4
  class API
5
5
  include HTTParty
6
+ ROOT_URL = "http://localhost:3000"
6
7
 
7
- def self.create_request(email)
8
- self.post("http://localhost:3000/apps", :body => { :application => { :email => email } })
8
+ def self.create_app_request(email)
9
+ self.post("#{ROOT_URL}/apps", :body => { :application => { :email => email } })
10
+ end
11
+
12
+ def self.show_app_request(id)
13
+ self.get("#{ROOT_URL}/apps/#{id}")
9
14
  end
10
15
  end
11
16
  end
@@ -4,7 +4,7 @@ require "colorize"
4
4
  module Command
5
5
  class App
6
6
  def self.create(email = "")
7
- response = CG::API.create_request(email)
7
+ response = CG::API.create_app_request(email)
8
8
  if response["success"] == false
9
9
  response["errors"].each do |k,v|
10
10
  puts "#{k.capitalize} #{v.first}\n".red
@@ -21,5 +21,16 @@ module Command
21
21
  puts "And restart application to start using the CodeGears platform.".green
22
22
  end
23
23
  end
24
+
25
+ def self.main(id = "")
26
+ puts "Application ID can't be blank".red and return if id.blank?
27
+ response = CG::API.show_app_request(id)
28
+ if response["success"] == false
29
+ puts "Application not found".red
30
+ else
31
+ status = response["active"]
32
+ puts "Active: #{status}".send(status ? :green : :red)
33
+ end
34
+ end
24
35
  end
25
36
  end
data/lib/cg/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module CG
2
- VERSION = "0.0.12.pre"
2
+ VERSION = "0.0.13.pre"
3
3
  end
@@ -19,7 +19,7 @@ module Cg
19
19
 
20
20
  def init_settings
21
21
  unless email.blank?
22
- response = CG::API.create_request(email)
22
+ response = CG::API.create_app_request(email)
23
23
  unless response["success"] == false
24
24
  @id = response["id"]
25
25
  @secret_id = response["secret_id"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codegears
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12.pre
4
+ version: 0.0.13.pre
5
5
  prerelease: 7
6
6
  platform: ruby
7
7
  authors: