megam_api 0.63 → 0.65

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.
@@ -16,54 +16,49 @@
16
16
 
17
17
  module Megam
18
18
  class Organizations < Megam::ServerAPI
19
- def initialize(email=nil, api_key=nil)
20
- @id = nil
21
- @name = nil
22
- @accounts_id = nil
23
- @created_at = nil
24
- super(email, api_key)
25
- end
26
-
27
-
28
- def organization
29
- self
30
- end
31
-
32
- def id(arg=nil)
33
- if arg != nil
34
- @id = arg
35
- else
36
- @id
37
- end
38
- end
39
-
40
- def accounts_id(arg=nil)
41
- if arg != nil
42
- @accounts_id = arg
43
- else
44
- @accounts_id
45
- end
46
- end
47
-
48
- def name(arg=nil)
49
- if arg != nil
50
- @name = arg
51
- else
52
- @name
53
- end
54
- end
19
+ def initialize(email=nil, api_key=nil, host=nil)
20
+ @id = nil
21
+ @name = nil
22
+ @accounts_id = nil
23
+ @created_at = nil
24
+ super(email, api_key, host)
25
+ end
55
26
 
27
+ def organization
28
+ self
29
+ end
56
30
 
31
+ def id(arg=nil)
32
+ if arg != nil
33
+ @id = arg
34
+ else
35
+ @id
36
+ end
37
+ end
57
38
 
58
- def created_at(arg=nil)
59
- if arg != nil
60
- @created_at = arg
61
- else
62
- @created_at
63
- end
64
- end
39
+ def accounts_id(arg=nil)
40
+ if arg != nil
41
+ @accounts_id = arg
42
+ else
43
+ @accounts_id
44
+ end
45
+ end
65
46
 
47
+ def name(arg=nil)
48
+ if arg != nil
49
+ @name = arg
50
+ else
51
+ @name
52
+ end
53
+ end
66
54
 
55
+ def created_at(arg=nil)
56
+ if arg != nil
57
+ @created_at = arg
58
+ else
59
+ @created_at
60
+ end
61
+ end
67
62
 
68
63
  # Transform the ruby obj -> to a Hash
69
64
  def to_hash
@@ -101,7 +96,7 @@ end
101
96
  end
102
97
 
103
98
  def self.from_hash(o)
104
- org = self.new(o[:email], o[:api_key])
99
+ org = self.new(o[:email], o[:api_key], o[:host])
105
100
  org.from_hash(o)
106
101
  org
107
102
  end
@@ -130,7 +125,6 @@ end
130
125
  org.megam_rest.get_organizations
131
126
  end
132
127
 
133
-
134
128
  def create
135
129
  megam_rest.post_organizations(to_hash)
136
130
  end
@@ -16,7 +16,7 @@
16
16
  #
17
17
  module Megam
18
18
  class PredefCloud < Megam::ServerAPI
19
- def initialize(email=nil, api_key=nil)
19
+ def initialize(email=nil, api_key=nil, host=nil)
20
20
  @id = nil
21
21
  @name = nil
22
22
  @accounts_id = nil
@@ -26,7 +26,7 @@ module Megam
26
26
  #@performance = nil
27
27
  @created_at = nil
28
28
  @some_msg = {}
29
- super(email, api_key)
29
+ super(email, api_key, host)
30
30
  end
31
31
 
32
32
  def predef_cloud
@@ -178,8 +178,8 @@ module Megam
178
178
  predefcd
179
179
  end
180
180
 
181
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
182
- predefcd = self.new(tmp_email, tmp_api_key)
181
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
182
+ predefcd = self.new(tmp_email, tmp_api_key, tmp_host)
183
183
  predefcd.from_hash(o)
184
184
  predefcd
185
185
  end
@@ -195,8 +195,8 @@ module Megam
195
195
  self
196
196
  end
197
197
 
198
- def self.create(o,tmp_email=nil, tmp_api_key=nil)
199
- acct = from_hash(o,tmp_email, tmp_api_key)
198
+ def self.create(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
199
+ acct = from_hash(o,tmp_email, tmp_api_key, tmp_host)
200
200
  acct.create
201
201
  end
202
202
 
@@ -208,20 +208,20 @@ module Megam
208
208
  # Load all predefs -
209
209
  # returns a PredefsCollection
210
210
  # don't return self. check if the Megam::PredefCollection is returned.
211
- def self.list(tmp_email=nil, tmp_api_key=nil)
212
- predef = self.new(tmp_email,tmp_api_key)
211
+ def self.list(tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
212
+ predef = self.new(tmp_email,tmp_api_key,tmp_host)
213
213
  predef.megam_rest.get_predefclouds
214
214
  end
215
215
 
216
216
  # Show a particular predef by name,
217
217
  # Megam::Predef
218
- def self.show(p_name,tmp_email=nil, tmp_api_key=nil)
219
- pre = self.new(tmp_email,tmp_api_key)
218
+ def self.show(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
219
+ pre = self.new(tmp_email,tmp_api_key,tmp_host)
220
220
  pre.megam_rest.get_predefcloud(p_name)
221
221
  end
222
222
 
223
- def self.delete(p_name,tmp_email=nil, tmp_api_key=nil)
224
- pre = self.new(tmp_email,tmp_api_key)
223
+ def self.delete(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
224
+ pre = self.new(tmp_email,tmp_api_key,tmp_host)
225
225
  pre.megam_rest.delete_predefcloud(p_name)
226
226
  end
227
227
 
@@ -15,13 +15,13 @@
15
15
  ##
16
16
  module Megam
17
17
  class Promos < Megam::ServerAPI
18
- def initialize(email=nil, api_key=nil)
18
+ def initialize(email=nil, api_key=nil, host=nil)
19
19
  @id = nil
20
20
  @code = nil
21
21
  @amount = nil
22
22
  @created_at = nil
23
23
  @some_msg = {}
24
- super(email, api_key)
24
+ super(email, api_key, host)
25
25
  end
26
26
 
27
27
  def promos
@@ -115,8 +115,8 @@ module Megam
115
115
  promos
116
116
  end
117
117
 
118
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
119
- promos = self.new(tmp_email, tmp_api_key)
118
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
119
+ promos = self.new(tmp_email, tmp_api_key, tmp_host)
120
120
  promos.from_hash(o)
121
121
  promos
122
122
  end
@@ -130,7 +130,7 @@ module Megam
130
130
  end
131
131
 
132
132
  def self.create(params)
133
- promo = from_hash(params,params["email"], params["api_key"])
133
+ promo = from_hash(params,params["email"], params["api_key"], params["host"])
134
134
  promo.create
135
135
  end
136
136
 
@@ -140,7 +140,7 @@ module Megam
140
140
  end
141
141
 
142
142
  def self.list(params)
143
- promos = self.new(params["email"], params["api_key"])
143
+ promos = self.new(params["email"], params["api_key"], params["host"])
144
144
  promos.megam_rest.get_promos
145
145
  end
146
146
 
@@ -15,7 +15,7 @@
15
15
  #
16
16
  module Megam
17
17
  class Request < Megam::ServerAPI
18
- def initialize(email=nil, api_key=nil)
18
+ def initialize(email=nil, api_key=nil, host=nil)
19
19
  @id = nil
20
20
  @cat_id = nil
21
21
  @name = nil
@@ -23,7 +23,7 @@ module Megam
23
23
  @command =nil
24
24
  @some_msg = {}
25
25
  @created_at = nil
26
- super(email, api_key)
26
+ super(email, api_key, host)
27
27
  end
28
28
 
29
29
  def request
@@ -137,8 +137,8 @@ module Megam
137
137
  node
138
138
  end
139
139
 
140
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
141
- node = self.new(tmp_email, tmp_api_key)
140
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
141
+ node = self.new(tmp_email, tmp_api_key, tmp_host)
142
142
  node.from_hash(o)
143
143
  node
144
144
  end
@@ -156,7 +156,7 @@ module Megam
156
156
 
157
157
  def self.create(params)
158
158
  puts "Entering megam_api-->"
159
- acct = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key])
159
+ acct = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key], params["host"] || params[:host])
160
160
  acct.create
161
161
  end
162
162
 
@@ -168,12 +168,12 @@ module Megam
168
168
 
169
169
 
170
170
  def self.show(params)
171
- prede = self.new(params["email"] || params[:email], params["api_key"] || params[:api_key])
171
+ prede = self.new(params["email"] || params[:email], params["api_key"] || params[:api_key], params["host"] || params[:host])
172
172
  prede.megam_rest.get_requests
173
173
  end
174
174
 
175
- def self.list(n_name,tmp_email=nil, tmp_api_key=nil)
176
- prede = self.new(tmp_email,tmp_api_key)
175
+ def self.list(n_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
176
+ prede = self.new(tmp_email,tmp_api_key, tmp_host)
177
177
  prede.megam_rest.get_request(n_name)
178
178
  end
179
179
 
@@ -21,15 +21,17 @@ module Megam
21
21
 
22
22
  attr_reader :email
23
23
  attr_reader :api_key
24
+ attr_reader :host
24
25
 
25
26
 
26
27
  # Create a Megam REST object. The supplied email and api_key is used as the base for
27
28
  # all subsequent requests. For example, when initialized with an email, api_key url
28
29
  # https://api.megam.io, a call to +get+ with 'accounts' will make an
29
30
  # HTTP GET request to https://api.megam.io/accounts using the email, api_key
30
- def initialize(email=nil, api_key=nil)
31
+ def initialize(email=nil, api_key=nil, host=nil)
31
32
  @email = email
32
33
  @api_key = api_key
34
+ @host = host
33
35
  end
34
36
 
35
37
  # Build a megam api client
@@ -37,7 +39,7 @@ module Megam
37
39
  # === Parameters
38
40
  # api:: The Megam::API client
39
41
  def megam_rest
40
- options = { :email =>email || Megam::Config[:email], :api_key => api_key || Megam::Config[:api_key]}
42
+ options = { :email =>email || Megam::Config[:email], :api_key => api_key || Megam::Config[:api_key], :host => host || Megam::Config[:host]}
41
43
  Megam::API.new(options)
42
44
  end
43
45
 
@@ -15,14 +15,14 @@
15
15
  #
16
16
  module Megam
17
17
  class SshKey < Megam::ServerAPI
18
- def initialize(email=nil, api_key=nil)
18
+ def initialize(email=nil, api_key=nil, host=nil)
19
19
  @id = nil
20
20
  @name = nil
21
21
  @accounts_id = nil
22
22
  @path=nil
23
23
  @created_at = nil
24
24
  @some_msg = {}
25
- super(email, api_key)
25
+ super(email, api_key, host)
26
26
  end
27
27
 
28
28
  def sshkey
@@ -125,8 +125,8 @@ module Megam
125
125
  sshKey
126
126
  end
127
127
 
128
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
129
- sshKey = self.new(tmp_email, tmp_api_key)
128
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
129
+ sshKey = self.new(tmp_email, tmp_api_key, tmp_host)
130
130
  sshKey.from_hash(o)
131
131
  sshKey
132
132
  end
@@ -140,7 +140,7 @@ module Megam
140
140
  end
141
141
 
142
142
  def self.create(params)
143
- acct = from_hash(params, params["email"], params["api_key"])
143
+ acct = from_hash(params, params["email"], params["api_key"], params["host"])
144
144
  acct.create
145
145
  end
146
146
 
@@ -153,14 +153,14 @@ module Megam
153
153
  # returns a sshkeysCollection
154
154
  # don't return self. check if the Megam::SshKeyCollection is returned.
155
155
  def self.list(params)
156
- sshKey = self.new(params["email"], params["api_key"])
156
+ sshKey = self.new(params["email"], params["api_key"], params["host"])
157
157
  sshKey.megam_rest.get_sshkeys
158
158
  end
159
159
 
160
160
  # Show a particular sshKey by name,
161
161
  # Megam::SshKey
162
162
  def self.show(params)
163
- pre = self.new(params["email"], params["api_key"])
163
+ pre = self.new(params["email"], params["api_key"], params["host"])
164
164
  pre.megam_rest.get_sshkey(params["name"])
165
165
  end
166
166
 
@@ -16,7 +16,7 @@
16
16
  module Megam
17
17
  class Subscriptions < Megam::ServerAPI
18
18
 
19
- def initialize(email=nil, api_key=nil)
19
+ def initialize(email=nil, api_key=nil, host=nil)
20
20
  @id = nil
21
21
  @accounts_id = nil
22
22
  @assembly_id = nil
@@ -24,7 +24,7 @@ module Megam
24
24
  @end_date = nil
25
25
  @created_at = nil
26
26
  @some_msg = {}
27
- super(email, api_key)
27
+ super(email, api_key, host)
28
28
  end
29
29
 
30
30
  def subscriptions
@@ -142,8 +142,8 @@ module Megam
142
142
  cts
143
143
  end
144
144
 
145
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
146
- cts = self.new(tmp_email,tmp_api_key)
145
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
146
+ cts = self.new(tmp_email,tmp_api_key,tmp_host)
147
147
  cts.from_hash(o)
148
148
  cts
149
149
  end
@@ -158,8 +158,8 @@ module Megam
158
158
  self
159
159
  end
160
160
 
161
- def self.create(o,tmp_email=nil, tmp_api_key=nil)
162
- acct = from_hash(o,tmp_email, tmp_api_key)
161
+ def self.create(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
162
+ acct = from_hash(o,tmp_email, tmp_api_key, tmp_host)
163
163
  acct.create
164
164
  end
165
165
 
@@ -171,15 +171,15 @@ module Megam
171
171
  # Load all subscriptions -
172
172
  # returns a subscriptionsCollection
173
173
  # don't return self. check if the Megam::subscriptionsCollection is returned.
174
- def self.list(tmp_email=nil, tmp_api_key=nil)
175
- cts = self.new(tmp_email, tmp_api_key)
174
+ def self.list(tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
175
+ cts = self.new(tmp_email, tmp_api_key, tmp_host)
176
176
  cts.megam_rest.get_subscriptions
177
177
  end
178
178
 
179
179
  # Show a particular subscriptions by name,
180
180
  # Megam::subscriptions
181
- def self.show(p_name,tmp_email=nil, tmp_api_key=nil)
182
- pre = self.new(tmp_email, tmp_api_key)
181
+ def self.show(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
182
+ pre = self.new(tmp_email, tmp_api_key, tmp_host)
183
183
  pre.megam_rest.get_subscriptions(p_name)
184
184
  end
185
185
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megam_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.63'
4
+ version: '0.65'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-29 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  version: '0'
258
258
  requirements: []
259
259
  rubyforge_project:
260
- rubygems_version: 2.4.7
260
+ rubygems_version: 2.4.8
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Ruby Client for the Megam