easy-resources-adam 0.1.3 → 0.2.4

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
  SHA256:
3
- metadata.gz: 270a0d9ab17096dd3248ba8c816c6d0cb88237bfbc79c2478940310b7c43625a
4
- data.tar.gz: 4d3056afd6f106d36415df5d402b67a3d280c59e48e4885097136a54ace47811
3
+ metadata.gz: 227b4d6cc4694e80294be4b7aedeea5cc625868df58bacf7db901c8d96b84d50
4
+ data.tar.gz: a8fd0b2cadcd1d1a7f2e7f299b6676cb385453de58b60f622885e7de85d4cfc2
5
5
  SHA512:
6
- metadata.gz: 871143e60fc8e05d2705907d2c509e32f12a4bd9690c99f7018f0326b0e0fc584f06ac4e442d73f9fba10e284944c25cb8c51d04b86e220da647483b76d51c42
7
- data.tar.gz: 0ffc15e09944f7a327af9e4786187eeaa565afa51d6fe6f177db00c1d26ec4973facf2b53abae8fcf17a8bf271c4447f058738dc325a5bf561643f321ddcdd54
6
+ metadata.gz: 0b9608dd0b86b4fa51942514cfbb5ab80866f5eadc68e47a651da86fa7aa30712b74ecccd8fa136854094a677844062e2f28e720333b8be7cf8f7c281bda5d57
7
+ data.tar.gz: f881024e4d3d61c5cf8cfe996cb0e359dd8a39655fb2f7ce97b3c59ba56da69904b8e3faa19455d33fbdd05fa2fdb8789616f2d024fd60fde567082217b6fa40
@@ -7,6 +7,7 @@ module Easy
7
7
 
8
8
  autoload :Server, "easy/resources/adam/server"
9
9
  autoload :TaskExecution, "easy/resources/adam/task_execution"
10
+ autoload :TaskExecutionCommand, "easy/resources/adam/task_execution_command"
10
11
  autoload :WebApplication, "easy/resources/adam/web_application"
11
12
 
12
13
  end
@@ -3,7 +3,10 @@ module Easy
3
3
  module Adam
4
4
  class Server < ::Easy::Resource
5
5
 
6
- self.element_name = "server"
6
+ self.element_name = "server"
7
+ self.include_root_in_json = true
8
+
9
+ has_many :web_applications, class_name: 'Easy::Resources::Adam::WebApplication'
7
10
 
8
11
  def self.find_me_by_name(name)
9
12
  first(params: { w: "me|=|1,name|=|#{name}" })
@@ -3,7 +3,36 @@ module Easy
3
3
  module Adam
4
4
  class TaskExecution < ::Easy::Resource
5
5
 
6
- self.element_name = "task_execution"
6
+ has_many :task_execution_commands, class_name: 'Easy::Resources::Adam::TaskExecutionCommand'
7
+
8
+ self.element_name = "task_execution"
9
+ self.include_root_in_json = true
10
+
11
+ def error?
12
+ error.present?
13
+ end
14
+
15
+ def error
16
+ return nil if !self.output_params || self.output_params.attributes["error"].blank?
17
+
18
+ "#{self.output_params.attributes["error"].attributes["class"]}: #{self.output_params.attributes["error"].attributes["message"]}"
19
+ end
20
+
21
+ def status_scheduled?
22
+ self.status == "scheduled"
23
+ end
24
+
25
+ def status_running?
26
+ self.status == "running"
27
+ end
28
+
29
+ def status_failed?
30
+ self.status == "failed"
31
+ end
32
+
33
+ def status_ok?
34
+ self.status == "ok"
35
+ end
7
36
 
8
37
  end
9
38
  end
@@ -0,0 +1,40 @@
1
+ module Easy
2
+ module Resources
3
+ module Adam
4
+ class TaskExecutionCommand < ::Easy::Resource
5
+
6
+ belongs_to :task_execution, class_name: 'Easy::Resources::Adam::TaskExecution'
7
+
8
+ self.element_name = "task_execution_command"
9
+ self.include_root_in_json = true
10
+
11
+ def error?
12
+ error.present?
13
+ end
14
+
15
+ def error
16
+ return nil if !self.output_params || self.output_params.attributes["error"].blank?
17
+
18
+ "#{self.output_params.attributes["error"].attributes["class"]}: #{self.output_params.attributes["error"].attributes["message"]}"
19
+ end
20
+
21
+ def status_scheduled?
22
+ self.status == "scheduled"
23
+ end
24
+
25
+ def status_running?
26
+ self.status == "running"
27
+ end
28
+
29
+ def status_failed?
30
+ self.status == "failed"
31
+ end
32
+
33
+ def status_ok?
34
+ self.status == "ok"
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
@@ -1,7 +1,7 @@
1
1
  module Easy
2
2
  module Resources
3
3
  module Adam
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.4'
5
5
  end
6
6
  end
7
7
  end
@@ -3,7 +3,19 @@ module Easy
3
3
  module Adam
4
4
  class WebApplication < ::Easy::Resource
5
5
 
6
- self.element_name = "web_application"
6
+ self.element_name = "web_application"
7
+ self.include_root_in_json = true
8
+
9
+ belongs_to :server, class_name: 'Easy::Resources::Adam::Server'
10
+ has_many :task_executions, class_name: 'Easy::Resources::Adam::TaskExecution'
11
+
12
+ def self.find_by_guid(guid)
13
+ first(params: { w: "guid|=|#{guid}" })
14
+ end
15
+
16
+ def self.find_by_name(name)
17
+ first(params: { w: "name|=|#{name}" })
18
+ end
7
19
 
8
20
  end
9
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy-resources-adam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - petr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-30 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.7.0
33
+ version: 0.8.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.7.0
40
+ version: 0.8.0
41
41
  description: Description of Easy::Resources::Adam.
42
42
  email:
43
43
  - petr@easy.cz
@@ -52,6 +52,7 @@ files:
52
52
  - lib/easy/resources/adam/railtie.rb
53
53
  - lib/easy/resources/adam/server.rb
54
54
  - lib/easy/resources/adam/task_execution.rb
55
+ - lib/easy/resources/adam/task_execution_command.rb
55
56
  - lib/easy/resources/adam/version.rb
56
57
  - lib/easy/resources/adam/web_application.rb
57
58
  homepage: https://www.easysoftware.com