megam_api 0.69 → 0.70

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: e15d29936192b95962d7f3b42696e9565f263da2
4
- data.tar.gz: afa01f4b4c89107eee768d1712030c1e74cba2ca
3
+ metadata.gz: f019d82e42dc40c2625b58694fb2caffecc7186c
4
+ data.tar.gz: 9e79d4b3ede0ac1b4731f337405420c17a01d4b0
5
5
  SHA512:
6
- metadata.gz: 67eebae80976dfb24ec61aeda4d5dfa737e5c88f68fe719b0c28db004cbd4b68aa9110e8e94abcd1bf504daf59a2ae1e5a4d25598e792f834ff968f5a06a3d50
7
- data.tar.gz: d29fd9e6c401f98397687b772d492b809c95f0623db3e884e4dbf2f7feaee83a093b80e7108b6615967203ed493d4513ba938c9539464e1272debcbcbe15f2e3
6
+ metadata.gz: 92f632aafb6e527ba5b64dc1d14a6f0cc554f98d2e0aeecda8964b1d63b18c0f0f342e00a6f6534f975211204a82209cc7f2015ff67a410492eeffac04e19285
7
+ data.tar.gz: d05a6a62227ca20d86915cabb29282bab18bb4ad1ab3905cd441c1c75db2ffc72fe19e0f742c20e544a0f20aa213fc73b6524ca16a6a8160e598d2278f3c9078
@@ -4,18 +4,18 @@ module Megam
4
4
  def get_organizations
5
5
 
6
6
  @options = {:path => '/organizations',:body => ''}.merge(@options)
7
-
7
+
8
8
  request(
9
9
  :expects => 200,
10
10
  :method => :get,
11
11
  :body => @options[:body]
12
-
12
+
13
13
  )
14
14
  end
15
-
16
- def get_organization(name)
17
15
 
18
- @options = {:path => "/organizations/#{name}",
16
+ def get_organization(id)
17
+
18
+ @options = {:path => "/organizations/#{id}",
19
19
  :body => ''}.merge(@options)
20
20
 
21
21
  request(
@@ -38,5 +38,20 @@ def post_organization(new_organization)
38
38
  :body => @options[:body]
39
39
  )
40
40
  end
41
+
42
+
43
+
44
+ def update_organization(new_organization)
45
+
46
+ @options = {:path => '/organizations/update',
47
+ :body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
48
+
49
+
50
+ request(
51
+ :expects => 201,
52
+ :method => :post,
53
+ :body => @options[:body]
54
+ )
55
+ end
41
56
  end
42
57
  end
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.69"
3
+ VERSION = "0.70"
4
4
  end
5
5
  end
@@ -19,6 +19,7 @@ module Megam
19
19
  def initialize(email=nil, api_key=nil, host=nil)
20
20
  @id = nil
21
21
  @accounts_id = nil
22
+ @org_id = nil
22
23
  @name = nil
23
24
  @assemblies = []
24
25
  @inputs = []
@@ -30,7 +31,7 @@ module Megam
30
31
  self
31
32
  end
32
33
 
33
-
34
+
34
35
  def id(arg=nil)
35
36
  if arg != nil
36
37
  @id = arg
@@ -47,6 +48,14 @@ module Megam
47
48
  end
48
49
  end
49
50
 
51
+ def org_id(arg=nil)
52
+ if arg != nil
53
+ @org_id = arg
54
+ else
55
+ @org_id
56
+ end
57
+ end
58
+
50
59
  def name(arg=nil)
51
60
  if arg != nil
52
61
  @name = arg
@@ -63,7 +72,7 @@ module Megam
63
72
  end
64
73
  end
65
74
 
66
-
75
+
67
76
  def inputs(arg=[])
68
77
  if arg != []
69
78
  @inputs = arg
@@ -89,6 +98,7 @@ module Megam
89
98
  index_hash = Hash.new
90
99
  index_hash["json_claz"] = self.class.name
91
100
  index_hash["id"] = id
101
+ index_hash["org_id"] = org_id
92
102
  index_hash["name"] = name
93
103
  index_hash["accounts_id"] = accounts_id
94
104
  index_hash["inputs"] = inputs
@@ -108,6 +118,7 @@ module Megam
108
118
  "id" => id,
109
119
  "name" => name,
110
120
  "accounts_id" => accounts_id,
121
+ "org_id" => org_id,
111
122
  "assemblies" => assemblies,
112
123
  "inputs" => inputs,
113
124
  "created_at" => created_at
@@ -120,8 +131,9 @@ module Megam
120
131
  asm.id(o["id"]) if o.has_key?("id")
121
132
  asm.name(o["name"]) if o.has_key?("name")
122
133
  asm.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
134
+ asm.org_id(o["org_id"]) if o.has_key?("org_id")
123
135
  asm.assemblies(o["assemblies"]) if o.has_key?("assemblies") #this will be an array? can hash store array?
124
- asm.inputs(o["inputs"]) if o.has_key?("inputs")
136
+ asm.inputs(o["inputs"]) if o.has_key?("inputs")
125
137
  asm.created_at(o["created_at"]) if o.has_key?("created_at")
126
138
  asm
127
139
  end
@@ -136,6 +148,7 @@ module Megam
136
148
  @id = o["id"] if o.has_key?("id")
137
149
  @name = o["name"] if o.has_key?("name")
138
150
  @accounts_id = o["accounts_id"] if o.has_key?("accounts_id")
151
+ @org_id = o["org_id"] if o.has_key?("org_id")
139
152
  @assemblies = o["assemblies"] if o.has_key?("assemblies")
140
153
  @inputs = o["inputs"] if o.has_key?("inputs")
141
154
  @created_at = o["created_at"] if o.has_key?("created_at")
@@ -20,6 +20,7 @@ module Megam
20
20
  @id = nil
21
21
  @name = nil
22
22
  @accounts_id = nil
23
+ @related_orgs = []
23
24
  @created_at = nil
24
25
  super(email, api_key, host)
25
26
  end
@@ -52,6 +53,15 @@ module Megam
52
53
  end
53
54
  end
54
55
 
56
+
57
+ def related_orgs(arg=[])
58
+ if arg != []
59
+ @related_orgs = arg
60
+ else
61
+ @related_orgs
62
+ end
63
+ end
64
+
55
65
  def created_at(arg=nil)
56
66
  if arg != nil
57
67
  @created_at = arg
@@ -67,6 +77,7 @@ module Megam
67
77
  index_hash["id"] = id
68
78
  index_hash["name"] = name
69
79
  index_hash["accounts_id"] = accounts_id
80
+ index_hash["related_orgs"] = related_orgs
70
81
  index_hash["created_at"] = created_at
71
82
  index_hash
72
83
  end
@@ -80,6 +91,7 @@ module Megam
80
91
  "id" => id,
81
92
  "name" => name,
82
93
  "accounts_id" => accounts_id,
94
+ "related_orgs" => related_orgs,
83
95
  "created_at" => created_at
84
96
  }
85
97
  result
@@ -91,6 +103,7 @@ module Megam
91
103
  org.id(o["id"]) if o.has_key?("id")
92
104
  org.name(o["name"]) if o.has_key?("name")
93
105
  org.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
106
+ org.related_orgs(o["related_orgs"]) if o.has_key?("related_orgs")
94
107
  org.created_at(o["created_at"]) if o.has_key?("created_at")
95
108
  org
96
109
  end
@@ -105,6 +118,7 @@ module Megam
105
118
  @id = o[:id] if o.has_key?(:id)
106
119
  @name = o[:name] if o.has_key?(:name)
107
120
  @accounts_id = o[:accounts_id] if o.has_key?(:accounts_id)
121
+ @related_orgs = o[:related_orgs] if o.has_key?(:related_orgs)
108
122
  @created_at = o[:created_at] if o.has_key?(:created_at)
109
123
  self
110
124
  end
@@ -120,13 +134,24 @@ module Megam
120
134
  org.megam_rest.get_organizations(email)
121
135
  end
122
136
 
137
+ def self.update(o)
138
+ org = from_hash(o)
139
+ org.update
140
+ end
141
+
142
+ # Create the node via the REST API
143
+ def update
144
+ megam_rest.update_organization(to_hash)
145
+ end
146
+
147
+
123
148
  def self.list(o)
124
149
  org = from_hash(o)
125
150
  org.megam_rest.get_organizations
126
151
  end
127
152
 
128
153
  def create
129
- megam_rest.post_organizations(to_hash)
154
+ megam_rest.post_organization(to_hash)
130
155
  end
131
156
 
132
157
  def to_s
@@ -184,7 +184,6 @@ module Megam
184
184
 
185
185
 
186
186
  def self.create(params)
187
- puts "Entering megam_api-->"
188
187
  acct = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key], params["host"] || params[:host])
189
188
  acct.create
190
189
  end
@@ -2,14 +2,26 @@ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestApps < MiniTest::Unit::TestCase
4
4
 
5
-
5
+ =begin
6
6
  def test_get_assemblies
7
7
  response = megams.get_assemblies
8
8
  assert_equal(200, response.status)
9
9
  end
10
-
10
+ =end
11
11
  def test_get_assembly
12
- response = megams.get_one_assemblies("AMS1133263480544165888")
12
+ response = megams.get_one_assemblies("AMS1257720849197301760")
13
13
  assert_equal(200, response.status)
14
14
  end
15
+ =begin
16
+ def test_post_assembly
17
+ tmp_hash = {
18
+ "name" => "testAsm",
19
+ "org_id" => "ORG123",
20
+ "assemblies" => [],
21
+ "inputs" => []
22
+ }
23
+ response = megams.post_assemblies(tmp_hash)
24
+ assert_equal(200, response.status)
25
+ end
26
+ =end
15
27
  end
data/test/test_helper.rb CHANGED
@@ -69,9 +69,11 @@ def sandbox_name
69
69
  end
70
70
 
71
71
  def sandbox_apikey
72
- "AOMtgPx0unVpnbWwwiHAkw=="
72
+ "7bwpJHv1bvnfF-lAFZwWZQ==" #{}"IamAtlas{74}NobdyCanSedfefdeME#07"
73
73
  end
74
74
 
75
75
  def sandbox_email
76
- "ffr@qwet.com"
76
+ # "darth@vader.com"
77
+ #"coolvader@iamswag.com"
78
+ "cloud2@cloud.com"
77
79
  end
@@ -7,9 +7,6 @@ class TestOrganizations < MiniTest::Unit::TestCase
7
7
  $tom_email = "tom@gomegam.com"
8
8
  $bob_email = "bob@gomegam.com"
9
9
 
10
-
11
-
12
-
13
10
  =begin
14
11
  def test_get_organizations_good
15
12
  response =megams.get_organization(sandbox_name)
@@ -17,19 +14,38 @@ class TestOrganizations < MiniTest::Unit::TestCase
17
14
  assert_equal(200, response.status)
18
15
  end
19
16
 
20
-
21
17
  def test_post_organizations_good
22
18
  tmp_hash = {
23
- "name" => "org.megam"}
19
+ "name" => "org.megam1"}
24
20
  response =megams.post_organization(tmp_hash)
25
- response.body.to_s
26
- assert_equal(201, response.status)
21
+ puts "printing--------------------->>>>"
22
+ puts response.body.to_s
23
+ puts "printingzzzzzzzzzzzzzzzzzzzzzzzz>>>>>"
24
+ #response.body.to_s
25
+ #assert_equal(201, response.status)
27
26
  end
28
- =end
29
27
 
30
28
  def test_get_organizations_good1
31
29
  response =megams.get_organizations
32
30
  assert_equal(200, response.status)
33
31
  end
34
-
32
+ =end
33
+ def test_update_organizations
34
+ tmp_hash = {
35
+ "id" => "ORG123",
36
+ "accounts_id" => "ACT123123",
37
+ "name" => "org1",
38
+ "related_orgs" => ["etst"],
39
+ "created_at" => ""
40
+ }
41
+ response = megams.update_organization(tmp_hash)
42
+ response.body.to_s
43
+ assert_equal(201, response.status)
44
+ end
45
+ =begin
46
+ def test_get_organization
47
+ response = megams.get_organization("ORG1257711897088753664")
48
+ assert_equal(200, response.status)
49
+ end
50
+ =end
35
51
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megam_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.69'
4
+ version: '0.70'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan,