Method: Megam::JSONCompat.class_for_json_class

Defined in:
lib/megam/core/json_compat.rb

.class_for_json_class(json_class) ⇒ Object

Map JSON_CLAZ to a Class object. We use a case instead of a Hash assigned to a constant because otherwise this file could not be loaded until all the constants were defined, which means you’d have to load the world to get json.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/megam/core/json_compat.rb', line 145

def class_for_json_class(json_class)
  case json_class
  when MEGAM_ERROR
    Megam::Error
  when MEGAM_AUTH
    Megam::Auth
  when 
    Megam::
  when MEGAM_ASSEMBLIES
    Megam::Assemblies
  when MEGAM_ASSEMBLIESCOLLECTION
    Megam::AssembliesCollection
  when MEGAM_ASSEMBLY
    Megam::Assembly
  when MEGAM_ASSEMBLYCOLLECTION
    Megam::AssemblyCollection
  when MEGAM_COMPONENTS
    Megam::Components
  when MEGAM_COMPONENTSCOLLECTION
    Megam::ComponentsCollection
  when MEGAM_REQUEST
    Megam::Request
  when MEGAM_REQUESTCOLLECTION
    Megam::RequestCollection
  when MEGAM_PREDEFCLOUD
    Megam::PredefCloud
  when MEGAM_PREDEFCLOUDCOLLECTION
    Megam::PredefCloudCollection
  when MEGAM_SSHKEY
    Megam::SshKey
  when MEGAM_SSHKEYCOLLECTION
    Megam::SshKeyCollection
  when MEGAM_MARKETPLACE
    Megam::MarketPlace
  when MEGAM_MARKETPLACECOLLECTION
    Megam::MarketPlaceCollection
  when MEGAM_MARKETPLACEADDON
    Megam::MarketPlaceAddons
  when MEGAM_MARKETPLACEADDONCOLLECTION
    Megam::MarketPlaceAddonsCollection
  when MEGAM_ORGANIZATION
    Megam::Organizations
  when MEGAM_ORGANIZATIONSCOLLECTION
    Megam::OrganizationsCollection
  when MEGAM_CSAR
    Megam::CSAR
  when MEGAM_CSARCOLLECTION
    Megam::CSARCollection
  when MEGAM_DOMAIN
    Megam::Domains
  when MEGAM_CATREQUESTS
    Megam::CatRequests
  when MEGAM_CATREQUESTSCOLLECTION
    Megam::CatRequestsCollection
  when MEGAM_EVENT
    Megam::Event
  when MEGAM_AVAILABLEUNITS
    Megam::Availableunits
  when MEGAM_AVAILABLEUNITSCOLLECTION
    Megam::AvailableunitsCollection
  when MEGAM_BALANCES
    Megam::Balances
  when MEGAM_BALANCESCOLLECTION
    Megam::BalancesCollection
  when MEGAM_BILLINGHISTORIES
    Megam::Billinghistories
  when MEGAM_BILLINGHISTORIESCOLLECTION
    Megam::BillinghistoriesCollection
  when MEGAM_BILLINGS
    Megam::Billings
  when MEGAM_BILLINGSCOLLECTION
    Megam::BillingsCollection
  when MEGAM_CREDITHISTORIES
    Megam::Credithistories
  when MEGAM_CREDITHISTORIESCOLLECTION
    Megam::CredithistoriesCollection
  when MEGAM_DISCOUNTS
    Megam::Discounts
  when MEGAM_DISCOUNTSCOLLECTION
    Megam::DiscountsCollection
  when MEGAM_SUBSCRIPTIONS
    Megam::Subscriptions
  when MEGAM_SUBSCRIPTIONSCOLLECTION
    Megam::SubscriptionsCollection
  when MEGAM_PROMOS
    Megam::Promos
  else
  raise JSON::ParserError, "Unsupported `json_class` type '#{json_class}'"
  end
end