megam_api 0.36 → 0.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/lib/megam/api.rb +22 -3
- data/lib/megam/api/accounts.rb +15 -1
- data/lib/megam/api/availableunits.rb +35 -0
- data/lib/megam/api/balances.rb +46 -0
- data/lib/megam/api/billinghistories.rb +35 -0
- data/lib/megam/api/billings.rb +35 -0
- data/lib/megam/api/components.rb +2 -2
- data/lib/megam/api/credithistories.rb +35 -0
- data/lib/megam/api/discounts.rb +35 -0
- data/lib/megam/api/profile.rb +42 -0
- data/lib/megam/api/subscriptions.rb +35 -0
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/account.rb +85 -8
- data/lib/megam/core/assembly.rb +5 -9
- data/lib/megam/core/availableunits.rb +181 -0
- data/lib/megam/core/availableunits_collection.rb +144 -0
- data/lib/megam/core/balances.rb +201 -0
- data/lib/megam/core/balances_collection.rb +144 -0
- data/lib/megam/core/billinghistories.rb +206 -0
- data/lib/megam/core/billinghistories_collection.rb +144 -0
- data/lib/megam/core/billings.rb +242 -0
- data/lib/megam/core/billings_collection.rb +144 -0
- data/lib/megam/core/credithistories.rb +191 -0
- data/lib/megam/core/credithistories_collection.rb +144 -0
- data/lib/megam/core/discounts.rb +191 -0
- data/lib/megam/core/discounts_collection.rb +144 -0
- data/lib/megam/core/json_compat.rb +57 -15
- data/lib/megam/core/subscriptions.rb +191 -0
- data/lib/megam/core/subscriptions_collection.rb +144 -0
- data/megam_api.gemspec +2 -2
- data/test/test_accounts.rb +19 -0
- data/test/test_availableunits.rb +29 -0
- data/test/test_balances.rb +39 -0
- data/test/test_billinghistories.rb +31 -0
- data/test/test_billings.rb +34 -0
- data/test/test_credithistories.rb +30 -0
- data/test/test_discounts.rb +30 -0
- data/test/test_helper.rb +2 -2
- data/test/test_subscriptions.rb +30 -0
- metadata +61 -7
@@ -34,24 +34,38 @@ module Megam
|
|
34
34
|
MEGAM_REQUEST = "Megam::Request".freeze
|
35
35
|
MEGAM_REQUESTCOLLECTION = "Megam::RequestCollection".freeze
|
36
36
|
MEGAM_ORGANIZATION = "Megam::Organizations".freeze
|
37
|
-
MEGAM_ORGANIZATIONSCOLLECTION
|
37
|
+
MEGAM_ORGANIZATIONSCOLLECTION = "Megam::OrganizationsCollection".freeze
|
38
38
|
MEGAM_DOMAIN = "Megam::Domains".freeze
|
39
|
-
MEGAM_APPREQUEST
|
40
|
-
MEGAM_APPREQUESTCOLLECTION
|
39
|
+
MEGAM_APPREQUEST = "Megam::AppRequest".freeze
|
40
|
+
MEGAM_APPREQUESTCOLLECTION = "Megam::AppRequestCollection".freeze
|
41
41
|
MEGAM_EVENT = "Megam::Event".freeze
|
42
|
+
MEGAM_PREDEFCLOUD = "Megam::PredefCloud".freeze
|
43
|
+
MEGAM_PREDEFCLOUDCOLLECTION = "Megam::PredefCloudCollection".freeze
|
44
|
+
MEGAM_CLOUDTOOLSETTING = "Megam::CloudToolSetting".freeze
|
45
|
+
MEGAM_CLOUDTOOLSETTINGCOLLECTION = "Megam::CloudToolSettingCollection".freeze
|
46
|
+
MEGAM_SSHKEY = "Megam::SshKey".freeze
|
47
|
+
MEGAM_SSHKEYCOLLECTION = "Megam::SshKeyCollection".freeze
|
48
|
+
MEGAM_MARKETPLACE = "Megam::MarketPlace".freeze
|
49
|
+
MEGAM_MARKETPLACECOLLECTION = "Megam::MarketPlaceCollection".freeze
|
50
|
+
MEGAM_MARKETPLACEADDON = "Megam::MarketPlaceAddons".freeze
|
51
|
+
MEGAM_MARKETPLACEADDONCOLLECTION = "Megam::MarketPlaceAddonsCollection".freeze
|
52
|
+
MEGAM_CSAR = "Megam::CSAR".freeze
|
53
|
+
MEGAM_CSARCOLLECTION = "Megam::CSARCollection".freeze
|
54
|
+
MEGAM_AVAILABLEUNITS = "Megam::Availableunits".freeze
|
55
|
+
MEGAM_AVAILABLEUNITSCOLLECTION = "Megam::AvailableunitsCollection".freeze
|
56
|
+
MEGAM_BALANCES = "Megam::Balances".freeze
|
57
|
+
MEGAM_BALANCESCOLLECTION = "Megam::BalancesCollection".freeze
|
58
|
+
MEGAM_BILLINGHISTORIES = "Megam::Billinghistories".freeze
|
59
|
+
MEGAM_BILLINGHISTORIESCOLLECTION = "Megam::BillinghistoriesCollection".freeze
|
60
|
+
MEGAM_BILLINGS = "Megam::Billings".freeze
|
61
|
+
MEGAM_BILLINGSCOLLECTION = "Megam::BillingsCollection".freeze
|
62
|
+
MEGAM_CREDITHISTORIES = "Megam::Credithistories".freeze
|
63
|
+
MEGAM_CREDITHISTORIESCOLLECTION = "Megam::CredithistoriesCollection".freeze
|
64
|
+
MEGAM_DISCOUNTS = "Megam::Discounts".freeze
|
65
|
+
MEGAM_DISCOUNTSCOLLECTION = "Megam::DiscountsCollection".freeze
|
66
|
+
MEGAM_SUBSCRIPTIONS = "Megam::Subscriptions".freeze
|
67
|
+
MEGAM_SUBSCRIPTIONSCOLLECTION = "Megam::SubscriptionsCollection".freeze
|
42
68
|
|
43
|
-
MEGAM_PREDEFCLOUD = "Megam::PredefCloud".freeze
|
44
|
-
MEGAM_PREDEFCLOUDCOLLECTION = "Megam::PredefCloudCollection".freeze
|
45
|
-
MEGAM_CLOUDTOOLSETTING = "Megam::CloudToolSetting".freeze
|
46
|
-
MEGAM_CLOUDTOOLSETTINGCOLLECTION= "Megam::CloudToolSettingCollection".freeze
|
47
|
-
MEGAM_SSHKEY = "Megam::SshKey".freeze
|
48
|
-
MEGAM_SSHKEYCOLLECTION = "Megam::SshKeyCollection".freeze
|
49
|
-
MEGAM_MARKETPLACE = "Megam::MarketPlace".freeze
|
50
|
-
MEGAM_MARKETPLACECOLLECTION = "Megam::MarketPlaceCollection".freeze
|
51
|
-
MEGAM_MARKETPLACEADDON = "Megam::MarketPlaceAddons".freeze
|
52
|
-
MEGAM_MARKETPLACEADDONCOLLECTION= "Megam::MarketPlaceAddonsCollection".freeze
|
53
|
-
MEGAM_CSAR = "Megam::CSAR".freeze
|
54
|
-
MEGAM_CSARCOLLECTION = "Megam::CSARCollection".freeze
|
55
69
|
|
56
70
|
class <<self
|
57
71
|
# Increase the max nesting for JSON, which defaults
|
@@ -183,6 +197,34 @@ module Megam
|
|
183
197
|
Megam::AppRequestCollection
|
184
198
|
when MEGAM_EVENT
|
185
199
|
Megam::Event
|
200
|
+
when MEGAM_AVAILABLEUNITS
|
201
|
+
Megam::Availableunits
|
202
|
+
when MEGAM_AVAILABLEUNITSCOLLECTION
|
203
|
+
Megam::AvailableunitsCollection
|
204
|
+
when MEGAM_BALANCES
|
205
|
+
Megam::Balances
|
206
|
+
when MEGAM_BALANCESCOLLECTION
|
207
|
+
Megam::BalancesCollection
|
208
|
+
when MEGAM_BILLINGHISTORIES
|
209
|
+
Megam::Billinghistories
|
210
|
+
when MEGAM_BILLINGHISTORIESCOLLECTION
|
211
|
+
Megam::BillinghistoriesCollection
|
212
|
+
when MEGAM_BILLINGS
|
213
|
+
Megam::Billings
|
214
|
+
when MEGAM_BILLINGSCOLLECTION
|
215
|
+
Megam::BillingsCollection
|
216
|
+
when MEGAM_CREDITHISTORIES
|
217
|
+
Megam::Credithistories
|
218
|
+
when MEGAM_CREDITHISTORIESCOLLECTION
|
219
|
+
Megam::CredithistoriesCollection
|
220
|
+
when MEGAM_DISCOUNTS
|
221
|
+
Megam::Discounts
|
222
|
+
when MEGAM_DISCOUNTSCOLLECTION
|
223
|
+
Megam::DiscountsCollection
|
224
|
+
when MEGAM_SUBSCRIPTIONS
|
225
|
+
Megam::Subscriptions
|
226
|
+
when MEGAM_SUBSCRIPTIONSCOLLECTION
|
227
|
+
Megam::SubscriptionsCollection
|
186
228
|
else
|
187
229
|
raise JSON::ParserError, "Unsupported `json_class` type '#{json_class}'"
|
188
230
|
end
|
@@ -0,0 +1,191 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2012, 2014 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
module Megam
|
17
|
+
class Subscriptions < Megam::ServerAPI
|
18
|
+
|
19
|
+
def initialize(email=nil, api_key=nil)
|
20
|
+
@id = nil
|
21
|
+
@accounts_id = nil
|
22
|
+
@assembly_id = nil
|
23
|
+
@start_date = nil
|
24
|
+
@end_date = nil
|
25
|
+
@created_at = nil
|
26
|
+
@some_msg = {}
|
27
|
+
super(email, api_key)
|
28
|
+
end
|
29
|
+
|
30
|
+
def subscriptions
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def id(arg=nil)
|
36
|
+
if arg != nil
|
37
|
+
@id = arg
|
38
|
+
else
|
39
|
+
@id
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def accounts_id(arg=nil)
|
44
|
+
if arg != nil
|
45
|
+
@accounts_id= arg
|
46
|
+
else
|
47
|
+
@accounts_id
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def assembly_id(arg=nil)
|
52
|
+
if arg != nil
|
53
|
+
@assembly_id = arg
|
54
|
+
else
|
55
|
+
@assembly_id
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def start_date(arg=nil)
|
60
|
+
if arg != nil
|
61
|
+
@start_date = arg
|
62
|
+
else
|
63
|
+
@start_date
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def end_date(arg=nil)
|
68
|
+
if arg != nil
|
69
|
+
@end_date = arg
|
70
|
+
else
|
71
|
+
@end_date
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def created_at(arg=nil)
|
76
|
+
if arg != nil
|
77
|
+
@created_at = arg
|
78
|
+
else
|
79
|
+
@created_at
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def some_msg(arg=nil)
|
84
|
+
if arg != nil
|
85
|
+
@some_msg = arg
|
86
|
+
else
|
87
|
+
@some_msg
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def error?
|
92
|
+
crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
|
93
|
+
end
|
94
|
+
|
95
|
+
# Transform the ruby obj -> to a Hash
|
96
|
+
def to_hash
|
97
|
+
index_hash = Hash.new
|
98
|
+
index_hash["json_claz"] = self.class.name
|
99
|
+
index_hash["id"] = id
|
100
|
+
index_hash["accounts_id"] = accounts_id
|
101
|
+
index_hash["assembly_id"] = assembly_id
|
102
|
+
index_hash["start_date"] = start_date
|
103
|
+
index_hash["end_date"] = end_date
|
104
|
+
index_hash["created_at"] = created_at
|
105
|
+
index_hash["some_msg"] = some_msg
|
106
|
+
index_hash
|
107
|
+
end
|
108
|
+
|
109
|
+
# Serialize this object as a hash: called from JsonCompat.
|
110
|
+
# Verify if this called from JsonCompat during testing.
|
111
|
+
def to_json(*a)
|
112
|
+
for_json.to_json(*a)
|
113
|
+
end
|
114
|
+
|
115
|
+
def for_json
|
116
|
+
result = {
|
117
|
+
"id" => id,
|
118
|
+
"accounts_id" => accounts_id,
|
119
|
+
"assembly_id" => assembly_id,
|
120
|
+
"start_date" => start_date,
|
121
|
+
"end_date" => end_date,
|
122
|
+
"created_at" => created_at
|
123
|
+
}
|
124
|
+
result
|
125
|
+
end
|
126
|
+
|
127
|
+
#
|
128
|
+
def self.json_create(o)
|
129
|
+
cts = new
|
130
|
+
cts.id(o["id"]) if o.has_key?("id")
|
131
|
+
cts.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
|
132
|
+
cts.assembly_id(o["assembly_id"]) if o.has_key?("assembly_id")
|
133
|
+
cts.start_date(o["start_date"]) if o.has_key?("start_date")
|
134
|
+
cts.end_date(o["end_date"]) if o.has_key?("end_date")
|
135
|
+
|
136
|
+
cts.created_at(o["created_at"]) if o.has_key?("created_at")
|
137
|
+
#success or error
|
138
|
+
cts.some_msg[:code] = o["code"] if o.has_key?("code")
|
139
|
+
cts.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
140
|
+
cts.some_msg[:msg]= o["msg"] if o.has_key?("msg")
|
141
|
+
cts.some_msg[:links] = o["links"] if o.has_key?("links")
|
142
|
+
cts
|
143
|
+
end
|
144
|
+
|
145
|
+
def self.from_hash(o,tmp_email=nil, tmp_api_key=nil)
|
146
|
+
cts = self.new(tmp_email,tmp_api_key)
|
147
|
+
cts.from_hash(o)
|
148
|
+
cts
|
149
|
+
end
|
150
|
+
|
151
|
+
def from_hash(o)
|
152
|
+
@id = o[:id] if o.has_key?(:id)
|
153
|
+
@accounts_id = o[:accounts_id] if o.has_key?(:accounts_id)
|
154
|
+
@assembly_id = o[:assembly_id] if o.has_key?(:assembly_id)
|
155
|
+
@start_date = o[:start_date] if o.has_key?(:start_date)
|
156
|
+
@end_date = o[:end_date] if o.has_key?(:end_date)
|
157
|
+
@created_at = o[:created_at] if o.has_key?(:created_at)
|
158
|
+
self
|
159
|
+
end
|
160
|
+
|
161
|
+
def self.create(o,tmp_email=nil, tmp_api_key=nil)
|
162
|
+
acct = from_hash(o,tmp_email, tmp_api_key)
|
163
|
+
acct.create
|
164
|
+
end
|
165
|
+
|
166
|
+
# Create the subscriptions via the REST API
|
167
|
+
def create
|
168
|
+
megam_rest.post_subscriptions(to_hash)
|
169
|
+
end
|
170
|
+
|
171
|
+
# Load all subscriptions -
|
172
|
+
# returns a subscriptionsCollection
|
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)
|
176
|
+
cts.megam_rest.get_subscriptions
|
177
|
+
end
|
178
|
+
|
179
|
+
# Show a particular subscriptions by name,
|
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)
|
183
|
+
pre.megam_rest.get_subscriptions(p_name)
|
184
|
+
end
|
185
|
+
|
186
|
+
def to_s
|
187
|
+
Megam::Stuff.styled_hash(to_hash)
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
end
|
@@ -0,0 +1,144 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2012, 2014 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
module Megam
|
17
|
+
class SubscriptionsCollection
|
18
|
+
include Enumerable
|
19
|
+
|
20
|
+
attr_reader :iterator
|
21
|
+
def initialize
|
22
|
+
@subscriptions = Array.new
|
23
|
+
@subscriptions_by_name = Hash.new
|
24
|
+
@insert_after_idx = nil
|
25
|
+
end
|
26
|
+
|
27
|
+
def all_subscriptions
|
28
|
+
@subscriptions
|
29
|
+
end
|
30
|
+
|
31
|
+
def [](index)
|
32
|
+
@subscriptions[index]
|
33
|
+
end
|
34
|
+
|
35
|
+
def []=(index, arg)
|
36
|
+
is_megam_subscriptions(arg)
|
37
|
+
@subscriptions[index] = arg
|
38
|
+
@subscriptions_by_name[arg.repo_name] = index
|
39
|
+
end
|
40
|
+
|
41
|
+
def <<(*args)
|
42
|
+
args.flatten.each do |a|
|
43
|
+
is_megam_subscriptions(a)
|
44
|
+
@subscriptions << a
|
45
|
+
@subscriptions_by_name[a.repo_name] =@subscriptions.length - 1
|
46
|
+
end
|
47
|
+
self
|
48
|
+
end
|
49
|
+
|
50
|
+
# 'push' is an alias method to <<
|
51
|
+
alias_method :push, :<<
|
52
|
+
|
53
|
+
def insert(subscriptions)
|
54
|
+
is_megam_subscriptions(subscriptions)
|
55
|
+
if @insert_after_idx
|
56
|
+
# in the middle of executing a run, so any subscriptions inserted now should
|
57
|
+
# be placed after the most recent addition done by the currently executing
|
58
|
+
# subscriptions
|
59
|
+
@subscriptions.insert(@insert_after_idx + 1, subscriptions)
|
60
|
+
# update name -> location mappings and register new subscriptions
|
61
|
+
@subscriptions_by_name.each_key do |key|
|
62
|
+
@subscriptions_by_name[key] += 1 if@subscriptions_by_name[key] > @insert_after_idx
|
63
|
+
end
|
64
|
+
@subscriptions_by_name[subscriptions.repo_name] = @insert_after_idx + 1
|
65
|
+
@insert_after_idx += 1
|
66
|
+
else
|
67
|
+
@subscriptions << subscriptions
|
68
|
+
@subscriptions_by_name[subscriptions.repo_name] =@subscriptions.length - 1
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def each
|
73
|
+
@subscriptions.each do |subscriptions|
|
74
|
+
yield subscriptions
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def each_index
|
79
|
+
@subscriptions.each_index do |i|
|
80
|
+
yield i
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def empty?
|
85
|
+
@subscriptions.empty?
|
86
|
+
end
|
87
|
+
|
88
|
+
def lookup(subscriptions)
|
89
|
+
lookup_by = nil
|
90
|
+
if subscriptions.kind_of?(Megam::Subscriptions)
|
91
|
+
lookup_by = subscriptions.repo_name
|
92
|
+
elsif subscriptions.kind_of?(String)
|
93
|
+
lookup_by = subscriptions
|
94
|
+
else
|
95
|
+
raise ArgumentError, "Must pass a Megam::subscriptions or String to lookup"
|
96
|
+
end
|
97
|
+
res =@subscriptions_by_name[lookup_by]
|
98
|
+
unless res
|
99
|
+
raise ArgumentError, "Cannot find a subscriptions matching #{lookup_by} (did you define it first?)"
|
100
|
+
end
|
101
|
+
@subscriptions[res]
|
102
|
+
end
|
103
|
+
|
104
|
+
# Transform the ruby obj -> to a Hash
|
105
|
+
def to_hash
|
106
|
+
index_hash = Hash.new
|
107
|
+
self.each do |subscriptions|
|
108
|
+
index_hash[subscriptions.repo_name] = subscriptions.to_s
|
109
|
+
end
|
110
|
+
index_hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Serialize this object as a hash: called from JsonCompat.
|
114
|
+
# Verify if this called from JsonCompat during testing.
|
115
|
+
def to_json(*a)
|
116
|
+
for_json.to_json(*a)
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.json_create(o)
|
120
|
+
collection = self.new()
|
121
|
+
o["results"].each do |subscriptions_list|
|
122
|
+
subscriptions_array = subscriptions_list.kind_of?(Array) ? subscriptions_list : [ subscriptions_list ]
|
123
|
+
subscriptions_array.each do |subscriptions|
|
124
|
+
collection.insert(subscriptions)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
collection
|
128
|
+
end
|
129
|
+
|
130
|
+
private
|
131
|
+
|
132
|
+
def is_megam_subscriptions(arg)
|
133
|
+
unless arg.kind_of?(Megam::Subscriptions)
|
134
|
+
raise ArgumentError, "Members must be Megam::Subscriptions"
|
135
|
+
end
|
136
|
+
true
|
137
|
+
end
|
138
|
+
|
139
|
+
def to_s
|
140
|
+
Megam::Stuff.styled_hash(to_hash)
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
end
|
data/megam_api.gemspec
CHANGED
@@ -16,11 +16,11 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
|
-
s.add_runtime_dependency 'excon', '~> 0.
|
19
|
+
s.add_runtime_dependency 'excon', '~> 0.45.3'
|
20
20
|
s.add_runtime_dependency 'highline', '~> 1.7'
|
21
21
|
s.add_runtime_dependency 'yajl-ruby', '~> 1.2'
|
22
22
|
s.add_runtime_dependency 'mixlib-config', '~> 2.1'
|
23
23
|
s.add_runtime_dependency 'mixlib-log', '~> 1.6'
|
24
|
-
s.add_development_dependency 'minitest', '~> 5.
|
24
|
+
s.add_development_dependency 'minitest', '~> 5.6'
|
25
25
|
s.add_development_dependency 'rake', '~> 10.4'
|
26
26
|
end
|
data/test/test_accounts.rb
CHANGED
@@ -12,6 +12,25 @@ class TestAccounts < MiniTest::Unit::TestCase
|
|
12
12
|
response.body.to_s
|
13
13
|
assert_equal(200, response.status)
|
14
14
|
end
|
15
|
+
|
16
|
+
def test_post_profile_good
|
17
|
+
tmp_hash = {
|
18
|
+
"id" => "000099090909000",
|
19
|
+
"first_name" => "Darth",
|
20
|
+
"last_name" => "Vader",
|
21
|
+
"email" => "coolvader@enterprise.com",
|
22
|
+
"phone" => "19090909090",
|
23
|
+
"api_key" => "IamAtlas{74}NobdyCanSedfefdeME#07",
|
24
|
+
"password" => "test",
|
25
|
+
"authority" => "admin",
|
26
|
+
"password_reset_key" => "",
|
27
|
+
"created_at" => "2014-10-29 13:24:06 +0000"
|
28
|
+
}
|
29
|
+
response =megams.post_accounts(tmp_hash)
|
30
|
+
response.body.to_s
|
31
|
+
assert_equal(201, response.status)
|
32
|
+
end
|
33
|
+
|
15
34
|
=begin
|
16
35
|
def test_get_accounts_bad
|
17
36
|
assert_raises(Megam::API::Errors::NotFound) do
|