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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 271894fb639567159273c4022e475b5110fcdd10
4
- data.tar.gz: 3eff3dd70b91086d365ffa90276cf45ccd601e51
3
+ metadata.gz: 396ae54e417f9d73a4acc609ea187aa1d409bec8
4
+ data.tar.gz: 4d4d75ef881b83312490e25a3a88cc0d90a9878f
5
5
  SHA512:
6
- metadata.gz: 2edbeff9fa4f6a9ecab4ee4427a90d1b55fcf9a017463bffe0a1c9a156339e8c163701f57957378981f0832ea57dc6335e08305bc8fa1520a424acbc010d3b31
7
- data.tar.gz: 964bdd26ac9373791597a889289e3f10ba368460103d95c0754b91b45d8a87cd366481817f49ced6cb39d42d6ec76fa123ef0c85ead240378a6ffc47e8910b31
6
+ metadata.gz: 6b1f5241bf38114873a406284dc149c2d919af4db95374fc32954021ae7d4adac36e6a0bd5aacc4746c174aec696c07b29e1e5aeb0f8941215e33c7af59f5715
7
+ data.tar.gz: 6d05626aa9e462f5c0e6ecc2807ebbd5316d8e4f39c0cbe334a1fe103566ff791cf977262cec5cf3b838ca437ea799eec551018482dd9706ac164daabd62b02a
data/README.md CHANGED
@@ -86,7 +86,7 @@ For more implementation details [see meggy](https://github.com/megamsys/meggy.gi
86
86
 
87
87
  We are glad to help if you have questions, or request for new features..
88
88
 
89
- [twitter @megamsys](http://twitter.com/megamsys) [email support@megam.co.in](<support@megam.co.in>)
89
+ [twitter @megamsys](http://twitter.com/megamsys) [email support@megam.io](<support@megam.io>)
90
90
 
91
91
 
92
92
 
@@ -100,7 +100,7 @@ We are glad to help if you have questions, or request for new features..
100
100
  | | Yeshwanth Kumar (<getyesh@megam.io>)
101
101
  | | Subash Sethurajan (<subash.avc@gmail.com>)
102
102
  | | Thomas Alrin (<thomasalrin@megam.io>)
103
- | **Copyright:** | Copyright (c) 2012-2014 Megam Systems.
103
+ | **Copyright:** | Copyright (c) 2013-2015 Megam Systems.
104
104
  | **License:** | Apache License, Version 2.0
105
105
 
106
106
  Licensed under the Apache License, Version 2.0 (the "License");
@@ -129,8 +129,9 @@ module Megam
129
129
  # 2. The options as passed via the instantiation of API will override global options. The ones that are passed are :email and :api_key and will
130
130
  # be merged into a class variable @options
131
131
  # 3. Upon merge of the options, the api_key, email as available in the @options is deleted.
132
- def initialize(options = {})
132
+ def initialize(options = {})
133
133
  @options = OPTIONS.merge(options)
134
+ puts @options
134
135
  @api_key = @options.delete(:api_key) || ENV['MEGAM_API_KEY']
135
136
  @email = @options.delete(:email)
136
137
  fail ArgumentError, 'You must specify [:email, :api_key]' if @email.nil? || @api_key.nil?
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.63"
3
+ VERSION = "0.65"
4
4
  end
5
5
  end
@@ -15,7 +15,7 @@
15
15
  #
16
16
  module Megam
17
17
  class Account < 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
  @email = nil
21
21
  @api_key = nil
@@ -28,7 +28,7 @@ module Megam
28
28
  @password_reset_sent_at = nil
29
29
  @created_at = nil
30
30
  @some_msg = {}
31
- super(email, api_key)
31
+ super(email, api_key, host)
32
32
  end
33
33
 
34
34
  #used by resque workers and any other background job
@@ -201,7 +201,7 @@ module Megam
201
201
  end
202
202
 
203
203
  def self.from_hash(o)
204
- acct = self.new(o[:email], o[:api_key])
204
+ acct = self.new(o[:email], o[:api_key], o[:host])
205
205
  acct.from_hash(o)
206
206
  acct
207
207
  end
@@ -233,8 +233,8 @@ module Megam
233
233
 
234
234
 
235
235
  # Load a account by email_p
236
- def self.show(email,api_key=nil)
237
- acct = self.new(email, api_key)
236
+ def self.show(email,api_key,host=nil)
237
+ acct = self.new(email, api_key, host)
238
238
  acct.megam_rest.get_accounts(email)
239
239
  end
240
240
 
@@ -16,14 +16,14 @@
16
16
 
17
17
  module Megam
18
18
  class Assemblies < 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
  @accounts_id = nil
22
22
  @name = nil
23
23
  @assemblies = []
24
24
  @inputs = []
25
25
  @created_at = nil
26
- super(email, api_key)
26
+ super(email, api_key, host)
27
27
  end
28
28
 
29
29
  def assemblies
@@ -126,8 +126,8 @@ module Megam
126
126
  asm
127
127
  end
128
128
 
129
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
130
- asm = self.new(tmp_email, tmp_api_key)
129
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
130
+ asm = self.new(tmp_email, tmp_api_key, tmp_host)
131
131
  asm.from_hash(o)
132
132
  asm
133
133
  end
@@ -143,7 +143,7 @@ module Megam
143
143
  end
144
144
 
145
145
  def self.create(params)
146
- asm = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key])
146
+ asm = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key], params["host"] || params[:host])
147
147
  asm.create
148
148
  end
149
149
 
@@ -153,13 +153,13 @@ module Megam
153
153
  end
154
154
 
155
155
  # Load a account by email_p
156
- def self.show(one_assemblies_id, tmp_email=nil, tmp_api_key=nil)
157
- asm = self.new(tmp_email, tmp_api_key)
156
+ def self.show(one_assemblies_id, tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
157
+ asm = self.new(tmp_email, tmp_api_key, tmp_host)
158
158
  asm.megam_rest.get_one_assemblies(one_assemblies_id)
159
159
  end
160
160
 
161
161
  def self.list(params)
162
- asm = self.new(params["email"], params["api_key"])
162
+ asm = self.new(params["email"], params["api_key"], params["host"])
163
163
  asm.megam_rest.get_assemblies
164
164
  end
165
165
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  module Megam
18
18
  class Assembly < 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
  @tosca_type = nil
@@ -28,7 +28,7 @@ module Megam
28
28
  @outputs = []
29
29
  @status = nil
30
30
  @created_at = nil
31
- super(email, api_key)
31
+ super(email, api_key, host)
32
32
  end
33
33
 
34
34
  def assembly
@@ -185,8 +185,8 @@ module Megam
185
185
  asm
186
186
  end
187
187
 
188
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
189
- asm = self.new(tmp_email, tmp_api_key)
188
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
189
+ asm = self.new(tmp_email, tmp_api_key, tmp_host)
190
190
  asm.from_hash(o)
191
191
  asm
192
192
  end
@@ -208,12 +208,12 @@ module Megam
208
208
 
209
209
 
210
210
  def self.show(params)
211
- asm = self.new(params["email"], params["api_key"])
211
+ asm = self.new(params["email"], params["api_key"], params["host"])
212
212
  asm.megam_rest.get_one_assembly(params["id"])
213
213
  end
214
214
 
215
215
  def self.update(params)
216
- asm = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key])
216
+ asm = from_hash(params, params["email"] || params[:email], params["api_key"] || params[:api_key], params["host"] || params[:host])
217
217
  asm.update
218
218
  end
219
219
 
@@ -26,7 +26,7 @@ module Megam
26
26
  end
27
27
 
28
28
  def megam_rest
29
- Megam::API.new(Megam::Config[:email], Megam::Config[:api_key])
29
+ Megam::API.new(Megam::Config[:email], Megam::Config[:api_key], Megam::Config[:host])
30
30
  end
31
31
 
32
32
  def some_msg(arg=nil)
@@ -15,14 +15,14 @@
15
15
  ##
16
16
  module Megam
17
17
  class Availableunits < 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
  @duration = nil
22
22
  @charges_per_duration = 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 availableunits
@@ -127,8 +127,8 @@ module Megam
127
127
  aunit
128
128
  end
129
129
 
130
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
131
- aunit = self.new(tmp_email, tmp_api_key)
130
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
131
+ aunit = self.new(tmp_email, tmp_api_key, tmp_host)
132
132
  aunit.from_hash(o)
133
133
  aunit
134
134
  end
@@ -142,8 +142,8 @@ module Megam
142
142
  self
143
143
  end
144
144
 
145
- def self.create(o,tmp_email=nil, tmp_api_key=nil)
146
- acct = from_hash(o,tmp_email, tmp_api_key)
145
+ def self.create(o,tmp_email=nil, tmp_api_key=nil, tmp_host)
146
+ acct = from_hash(o,tmp_email, tmp_api_key, tmp_host)
147
147
  acct.create
148
148
  end
149
149
 
@@ -155,20 +155,20 @@ module Megam
155
155
  # Load all available units -
156
156
  # returns a AvailableUnitsCollection
157
157
  # don't return self. check if the Megam::AvailableUnitsCollection is returned.
158
- def self.list(tmp_email=nil, tmp_api_key=nil)
159
- aunit = self.new(tmp_email,tmp_api_key)
158
+ def self.list(tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
159
+ aunit = self.new(tmp_email,tmp_api_key,tmp_host)
160
160
  aunit.megam_rest.get_availableunits
161
161
  end
162
162
 
163
163
  # Show a particular available units by name,
164
164
  # Megam::Availables
165
- def self.show(p_name,tmp_email=nil, tmp_api_key=nil)
166
- pre = self.new(tmp_email,tmp_api_key)
165
+ def self.show(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
166
+ pre = self.new(tmp_email,tmp_api_key, tmp_host)
167
167
  pre.megam_rest.get_availableunit(p_name)
168
168
  end
169
169
 
170
- def self.delete(p_name,tmp_email=nil, tmp_api_key=nil)
171
- pre = self.new(tmp_email,tmp_api_key)
170
+ def self.delete(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
171
+ pre = self.new(tmp_email,tmp_api_key,tmp_host)
172
172
  pre.megam_rest.delete_availableunit(p_name)
173
173
  end
174
174
 
@@ -15,7 +15,7 @@
15
15
  ##
16
16
  module Megam
17
17
  class Balances < 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
  @accounts_id = nil
21
21
  @name = nil
@@ -23,7 +23,7 @@ module Megam
23
23
  @created_at = nil
24
24
  @updated_at = nil
25
25
  @some_msg = {}
26
- super(email, api_key)
26
+ super(email, api_key, host)
27
27
  end
28
28
 
29
29
  def balances
@@ -137,8 +137,8 @@ module Megam
137
137
  balances
138
138
  end
139
139
 
140
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
141
- balances = self.new(tmp_email, tmp_api_key)
140
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
141
+ balances = self.new(tmp_email, tmp_api_key, tmp_host)
142
142
  balances.from_hash(o)
143
143
  balances
144
144
  end
@@ -154,7 +154,7 @@ module Megam
154
154
  end
155
155
 
156
156
  def self.create(params)
157
- acct = from_hash(params,params["email"], params["api_key"])
157
+ acct = from_hash(params,params["email"], params["api_key"], params["host"])
158
158
  acct.create
159
159
  end
160
160
 
@@ -167,24 +167,24 @@ module Megam
167
167
  # returns a BalanceCollection
168
168
  # don't return self. check if the Megam::BalanceCollection is returned.
169
169
  def self.list(params)
170
- balance = self.new(params["email"], params["api_key"])
170
+ balance = self.new(params["email"], params["api_key"], params["host"])
171
171
  balance.megam_rest.get_balances
172
172
  end
173
173
 
174
174
  # Show a particular balance by name,
175
175
  # Megam::Balance
176
176
  def self.show(params)
177
- pre = self.new(params["email"], params["api_key"])
177
+ pre = self.new(params["email"], params["api_key"], params["host"])
178
178
  pre.megam_rest.get_balance(params["email"])
179
179
  end
180
180
 
181
- def self.delete(p_name,tmp_email=nil, tmp_api_key=nil)
182
- pre = self.new(tmp_email,tmp_api_key)
181
+ def self.delete(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.delete_balance(p_name)
184
184
  end
185
185
 
186
186
  def self.update(params)
187
- asm = from_hash(params, params["email"], params["api_key"])
187
+ asm = from_hash(params, params["email"], params["api_key"], params["host"])
188
188
  asm.update
189
189
  end
190
190
 
@@ -15,7 +15,7 @@
15
15
  ##
16
16
  module Megam
17
17
  class Billinghistories < 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
  @accounts_id = nil
21
21
  @assembly_id = nil
@@ -24,7 +24,7 @@ module Megam
24
24
  @currency_type = 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 billinghistories
@@ -150,8 +150,8 @@ module Megam
150
150
  bal
151
151
  end
152
152
 
153
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
154
- bal = self.new(tmp_email, tmp_api_key)
153
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
154
+ bal = self.new(tmp_email, tmp_api_key, tmp_host)
155
155
  bal.from_hash(o)
156
156
  bal
157
157
  end
@@ -167,8 +167,8 @@ module Megam
167
167
  self
168
168
  end
169
169
 
170
- def self.create(o,tmp_email=nil, tmp_api_key=nil)
171
- acct = from_hash(o,tmp_email, tmp_api_key)
170
+ def self.create(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
171
+ acct = from_hash(o,tmp_email, tmp_api_key, tmp_host)
172
172
  acct.create
173
173
  end
174
174
 
@@ -181,19 +181,19 @@ module Megam
181
181
  # returns a BillingHistoriesCollection
182
182
  # don't return self. check if the Megam::BillingHistoriesCollection is returned.
183
183
  def self.list(params)
184
- billhistory = self.new(params["email"], params["api_key"])
184
+ billhistory = self.new(params["email"], params["api_key"], params["host"])
185
185
  billhistory.megam_rest.get_billinghistories
186
186
  end
187
187
 
188
188
  # Show a particular billing history by name,
189
189
  # Megam::BillingHistory
190
- def self.show(p_name,tmp_email=nil, tmp_api_key=nil)
191
- pre = self.new(tmp_email,tmp_api_key)
190
+ def self.show(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
191
+ pre = self.new(tmp_email,tmp_api_key, tmp_host)
192
192
  pre.megam_rest.get_billinghistory(p_name)
193
193
  end
194
194
 
195
- def self.delete(p_name,tmp_email=nil, tmp_api_key=nil)
196
- pre = self.new(tmp_email,tmp_api_key)
195
+ def self.delete(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
196
+ pre = self.new(tmp_email,tmp_api_key, tmp_host)
197
197
  pre.megam_rest.delete_billinghistory(p_name)
198
198
  end
199
199
 
@@ -16,7 +16,7 @@
16
16
  module Megam
17
17
  class Billings < 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
  @line1 = nil
@@ -28,7 +28,7 @@ module Megam
28
28
  @bill_type = nil
29
29
  @created_at = nil
30
30
  @some_msg = {}
31
- super(email, api_key)
31
+ super(email, api_key, host)
32
32
  end
33
33
 
34
34
  def billings
@@ -190,8 +190,8 @@ module Megam
190
190
  cts
191
191
  end
192
192
 
193
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
194
- cts = self.new(tmp_email,tmp_api_key)
193
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
194
+ cts = self.new(tmp_email,tmp_api_key,tmp_host)
195
195
  cts.from_hash(o)
196
196
  cts
197
197
  end
@@ -209,8 +209,8 @@ module Megam
209
209
  self
210
210
  end
211
211
 
212
- def self.create(o,tmp_email=nil, tmp_api_key=nil)
213
- acct = from_hash(o,tmp_email, tmp_api_key)
212
+ def self.create(o,tmp_email=nil, tmp_api_key=nil,tmp_host=nil)
213
+ acct = from_hash(o,tmp_email, tmp_api_key, tmp_host)
214
214
  acct.create
215
215
  end
216
216
 
@@ -222,15 +222,15 @@ module Megam
222
222
  # Load all billings -
223
223
  # returns a billingsCollection
224
224
  # don't return self. check if the Megam::billingsCollection is returned.
225
- def self.list(tmp_email=nil, tmp_api_key=nil)
226
- cts = self.new(tmp_email, tmp_api_key)
225
+ def self.list(tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
226
+ cts = self.new(tmp_email, tmp_api_key, tmp_host)
227
227
  cts.megam_rest.get_billings
228
228
  end
229
229
 
230
230
  # Show a particular billings by name,
231
231
  # Megam::billings
232
- def self.show(p_name,tmp_email=nil, tmp_api_key=nil)
233
- pre = self.new(tmp_email, tmp_api_key)
232
+ def self.show(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
233
+ pre = self.new(tmp_email, tmp_api_key, tmp_host)
234
234
  pre.megam_rest.get_billing(p_name)
235
235
  end
236
236
 
@@ -16,7 +16,7 @@
16
16
  module Megam
17
17
  class CatRequests < 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
  @cat_id = nil
22
22
  @cattype = nil
@@ -24,7 +24,7 @@ module Megam
24
24
  @action = nil
25
25
  @some_msg = {}
26
26
  @created_at = nil
27
- super(email, api_key)
27
+ super(email, api_key, host)
28
28
  end
29
29
 
30
30
  def cat_request
@@ -143,8 +143,8 @@ module Megam
143
143
  node
144
144
  end
145
145
 
146
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
147
- node = self.new(tmp_email, tmp_api_key)
146
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
147
+ node = self.new(tmp_email, tmp_api_key, tmp_host)
148
148
  node.from_hash(o)
149
149
  node
150
150
  end
@@ -161,7 +161,7 @@ module Megam
161
161
 
162
162
 
163
163
  def self.create(o)
164
- acct = from_hash(o, o["email"], o["api_key"])
164
+ acct = from_hash(o, o["email"], o["api_key"], o["host"])
165
165
  acct.create
166
166
  end
167
167