mno-enterprise-api 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -0
  3. data/Rakefile +12 -0
  4. data/app/assets/javascripts/mno_enterprise/angular/loading-page.app.js.coffee +156 -0
  5. data/app/assets/javascripts/mno_enterprise/application.js +13 -0
  6. data/app/controllers/devise/password_expired_controller.rb +55 -0
  7. data/app/controllers/mno_enterprise/auth/confirmations_controller.rb +5 -0
  8. data/app/controllers/mno_enterprise/auth/omniauth_callbacks_controller.rb +30 -0
  9. data/app/controllers/mno_enterprise/auth/passwords_controller.rb +5 -0
  10. data/app/controllers/mno_enterprise/auth/registrations_controller.rb +5 -0
  11. data/app/controllers/mno_enterprise/auth/sessions_controller.rb +7 -0
  12. data/app/controllers/mno_enterprise/auth/unlocks_controller.rb +5 -0
  13. data/app/controllers/mno_enterprise/deletion_requests_controller.rb +5 -0
  14. data/app/controllers/mno_enterprise/impersonate_controller.rb +48 -0
  15. data/app/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller.rb +16 -0
  16. data/app/controllers/mno_enterprise/jpi/v1/admin/base_resource_controller.rb +5 -0
  17. data/app/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller.rb +46 -0
  18. data/app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb +47 -0
  19. data/app/controllers/mno_enterprise/jpi/v1/admin/organizations_controller.rb +27 -0
  20. data/app/controllers/mno_enterprise/jpi/v1/admin/tenant_invoices_controller.rb +14 -0
  21. data/app/controllers/mno_enterprise/jpi/v1/admin/users_controller.rb +63 -0
  22. data/app/controllers/mno_enterprise/jpi/v1/app_instances_controller.rb +24 -0
  23. data/app/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller.rb +36 -0
  24. data/app/controllers/mno_enterprise/jpi/v1/base_resource_controller.rb +32 -0
  25. data/app/controllers/mno_enterprise/jpi/v1/current_users_controller.rb +5 -0
  26. data/app/controllers/mno_enterprise/jpi/v1/deletion_requests_controller.rb +5 -0
  27. data/app/controllers/mno_enterprise/jpi/v1/impac/dashboards_controller.rb +5 -0
  28. data/app/controllers/mno_enterprise/jpi/v1/impac/kpis_controller.rb +80 -0
  29. data/app/controllers/mno_enterprise/jpi/v1/impac/widgets_controller.rb +63 -0
  30. data/app/controllers/mno_enterprise/jpi/v1/industry_bundle_controller.rb +25 -0
  31. data/app/controllers/mno_enterprise/jpi/v1/marketplace_controller.rb +22 -0
  32. data/app/controllers/mno_enterprise/jpi/v1/organizations_controller.rb +5 -0
  33. data/app/controllers/mno_enterprise/jpi/v1/shopping_cart_controller.rb +93 -0
  34. data/app/controllers/mno_enterprise/jpi/v1/teams_controller.rb +88 -0
  35. data/app/controllers/mno_enterprise/org_invites_controller.rb +5 -0
  36. data/app/controllers/mno_enterprise/pages_controller.rb +5 -0
  37. data/app/controllers/mno_enterprise/provision_controller.rb +5 -0
  38. data/app/controllers/mno_enterprise/status_controller.rb +27 -0
  39. data/app/controllers/mno_enterprise/webhook/o_auth_controller.rb +5 -0
  40. data/app/mailers/mno_enterprise/system_notification_mailer.rb +5 -0
  41. data/app/models/mno_enterprise/health_check.rb +16 -0
  42. data/app/views/devise/password_expired/show.html.haml +32 -0
  43. data/app/views/mno_enterprise/auth/confirmations/default/_form.html.haml +49 -0
  44. data/app/views/mno_enterprise/auth/confirmations/default/_lounge.html.haml +34 -0
  45. data/app/views/mno_enterprise/auth/confirmations/default/_show.html.haml +10 -0
  46. data/app/views/mno_enterprise/auth/confirmations/lounge.html.haml +4 -0
  47. data/app/views/mno_enterprise/auth/confirmations/material/_form.html.haml +44 -0
  48. data/app/views/mno_enterprise/auth/confirmations/material/_lounge.html.haml +18 -0
  49. data/app/views/mno_enterprise/auth/confirmations/material/_show.html.haml +21 -0
  50. data/app/views/mno_enterprise/auth/confirmations/new.html.haml +31 -0
  51. data/app/views/mno_enterprise/auth/confirmations/show.html.haml +4 -0
  52. data/app/views/mno_enterprise/auth/mailer/confirmation_instructions.html.haml +4 -0
  53. data/app/views/mno_enterprise/auth/mailer/reset_password_instructions.html.haml +6 -0
  54. data/app/views/mno_enterprise/auth/mailer/unlock_instructions.html.haml +5 -0
  55. data/app/views/mno_enterprise/auth/passwords/edit.html.haml +53 -0
  56. data/app/views/mno_enterprise/auth/passwords/new.html.haml +34 -0
  57. data/app/views/mno_enterprise/auth/registrations/default/_form.html.haml +35 -0
  58. data/app/views/mno_enterprise/auth/registrations/default/_new.html.haml +11 -0
  59. data/app/views/mno_enterprise/auth/registrations/material/_form.html.haml +30 -0
  60. data/app/views/mno_enterprise/auth/registrations/material/_new.html.haml +10 -0
  61. data/app/views/mno_enterprise/auth/registrations/new.html.haml +4 -0
  62. data/app/views/mno_enterprise/auth/sessions/default/_form.html.haml +17 -0
  63. data/app/views/mno_enterprise/auth/sessions/default/_new.html.haml +11 -0
  64. data/app/views/mno_enterprise/auth/sessions/material/_form.html.haml +26 -0
  65. data/app/views/mno_enterprise/auth/sessions/material/_new.html.haml +11 -0
  66. data/app/views/mno_enterprise/auth/sessions/new.html.haml +4 -0
  67. data/app/views/mno_enterprise/auth/shared/_links.html.haml +24 -0
  68. data/app/views/mno_enterprise/auth/unlocks/new.html.haml +10 -0
  69. data/app/views/mno_enterprise/deletion_requests/show.html.haml +131 -0
  70. data/app/views/mno_enterprise/jpi/v1/admin/audit_events/_audit_event.json.jbuilder +5 -0
  71. data/app/views/mno_enterprise/jpi/v1/admin/audit_events/index.json.jbuilder +4 -0
  72. data/app/views/mno_enterprise/jpi/v1/admin/cloud_apps/_cloud_app.json.jbuilder +1 -0
  73. data/app/views/mno_enterprise/jpi/v1/admin/cloud_apps/index.json.jbuilder +1 -0
  74. data/app/views/mno_enterprise/jpi/v1/admin/cloud_apps/show.json.jbuilder +1 -0
  75. data/app/views/mno_enterprise/jpi/v1/admin/invoices/_invoice.json.jbuilder +2 -0
  76. data/app/views/mno_enterprise/jpi/v1/admin/invoices/index.json.jbuilder +1 -0
  77. data/app/views/mno_enterprise/jpi/v1/admin/invoices/show.json.jbuilder +2 -0
  78. data/app/views/mno_enterprise/jpi/v1/admin/organizations/_credit_card.json.jbuilder +7 -0
  79. data/app/views/mno_enterprise/jpi/v1/admin/organizations/_invoices.json.jbuilder +8 -0
  80. data/app/views/mno_enterprise/jpi/v1/admin/organizations/_member.json.jbuilder +14 -0
  81. data/app/views/mno_enterprise/jpi/v1/admin/organizations/_organization.json.jbuilder +1 -0
  82. data/app/views/mno_enterprise/jpi/v1/admin/organizations/in_arrears.json.jbuilder +8 -0
  83. data/app/views/mno_enterprise/jpi/v1/admin/organizations/index.json.jbuilder +7 -0
  84. data/app/views/mno_enterprise/jpi/v1/admin/organizations/show.json.jbuilder +11 -0
  85. data/app/views/mno_enterprise/jpi/v1/admin/tenant_invoices/_tenant_invoice.json.jbuilder +5 -0
  86. data/app/views/mno_enterprise/jpi/v1/admin/tenant_invoices/index.json.jbuilder +1 -0
  87. data/app/views/mno_enterprise/jpi/v1/admin/tenant_invoices/show.json.jbuilder +1 -0
  88. data/app/views/mno_enterprise/jpi/v1/admin/users/_user.json.jbuilder +1 -0
  89. data/app/views/mno_enterprise/jpi/v1/admin/users/index.json.jbuilder +2 -0
  90. data/app/views/mno_enterprise/jpi/v1/admin/users/show.json.jbuilder +9 -0
  91. data/app/views/mno_enterprise/jpi/v1/app_instances/_resource.json.jbuilder +23 -0
  92. data/app/views/mno_enterprise/jpi/v1/app_instances/index.json.jbuilder +9 -0
  93. data/app/views/mno_enterprise/jpi/v1/app_instances/show.json.jbuilder +3 -0
  94. data/app/views/mno_enterprise/jpi/v1/billing/index.json.jbuilder +0 -0
  95. data/app/views/mno_enterprise/jpi/v1/current_users/show.json.jbuilder +37 -0
  96. data/app/views/mno_enterprise/jpi/v1/impac/dashboards/_dashboard.json.jbuilder +9 -0
  97. data/app/views/mno_enterprise/jpi/v1/impac/dashboards/index.json.jbuilder +1 -0
  98. data/app/views/mno_enterprise/jpi/v1/impac/dashboards/show.json.jbuilder +1 -0
  99. data/app/views/mno_enterprise/jpi/v1/impac/kpis/_kpi.json.jbuilder +1 -0
  100. data/app/views/mno_enterprise/jpi/v1/impac/kpis/show.json.jbuilder +1 -0
  101. data/app/views/mno_enterprise/jpi/v1/impac/widgets/_widget.json.jbuilder +6 -0
  102. data/app/views/mno_enterprise/jpi/v1/impac/widgets/show.json.jbuilder +1 -0
  103. data/app/views/mno_enterprise/jpi/v1/marketplace/_app.json.jbuilder +14 -0
  104. data/app/views/mno_enterprise/jpi/v1/marketplace/index.json.jbuilder +3 -0
  105. data/app/views/mno_enterprise/jpi/v1/marketplace/show.json.jbuilder +3 -0
  106. data/app/views/mno_enterprise/jpi/v1/organizations/_arrears.json.jbuilder +11 -0
  107. data/app/views/mno_enterprise/jpi/v1/organizations/_billing.json.jbuilder +4 -0
  108. data/app/views/mno_enterprise/jpi/v1/organizations/_credit_card.json.jbuilder +7 -0
  109. data/app/views/mno_enterprise/jpi/v1/organizations/_current_user.json.jbuilder +5 -0
  110. data/app/views/mno_enterprise/jpi/v1/organizations/_invoices.json.jbuilder +8 -0
  111. data/app/views/mno_enterprise/jpi/v1/organizations/_member.json.jbuilder +13 -0
  112. data/app/views/mno_enterprise/jpi/v1/organizations/_organization.json.jbuilder +13 -0
  113. data/app/views/mno_enterprise/jpi/v1/organizations/credit_card.json.jbuilder +1 -0
  114. data/app/views/mno_enterprise/jpi/v1/organizations/index.json.jbuilder +1 -0
  115. data/app/views/mno_enterprise/jpi/v1/organizations/members.json.jbuilder +3 -0
  116. data/app/views/mno_enterprise/jpi/v1/organizations/show.json.jbuilder +15 -0
  117. data/app/views/mno_enterprise/jpi/v1/organizations/show_reduced.json.jbuilder +3 -0
  118. data/app/views/mno_enterprise/jpi/v1/shopping_cart/organizations.json.jbuilder +5 -0
  119. data/app/views/mno_enterprise/jpi/v1/shopping_cart/show.json.jbuilder +59 -0
  120. data/app/views/mno_enterprise/jpi/v1/shopping_cart/show_item.json.jbuilder +34 -0
  121. data/app/views/mno_enterprise/jpi/v1/teams/_team.json.jbuilder +20 -0
  122. data/app/views/mno_enterprise/jpi/v1/teams/index.json.jbuilder +1 -0
  123. data/app/views/mno_enterprise/jpi/v1/teams/show.json.jbuilder +3 -0
  124. data/app/views/mno_enterprise/pages/app_access_unauthorized.html.haml +19 -0
  125. data/app/views/mno_enterprise/pages/app_logout.html.haml +18 -0
  126. data/app/views/mno_enterprise/pages/billing_details_required.html.haml +19 -0
  127. data/app/views/mno_enterprise/pages/loading.html.erb +69 -0
  128. data/app/views/mno_enterprise/provision/_provision_apps.html.haml +42 -0
  129. data/app/views/mno_enterprise/provision/_select_organization.html.haml +17 -0
  130. data/app/views/mno_enterprise/provision/new.html.haml +4 -0
  131. data/app/views/mno_enterprise/webhook/o_auth/authorize.html.haml +26 -0
  132. data/app/views/mno_enterprise/webhook/o_auth/providers/myob.html.haml +29 -0
  133. data/app/views/mno_enterprise/webhook/o_auth/providers/xero.html.haml +34 -0
  134. data/config/initializers/devise.rb +273 -0
  135. data/config/initializers/devise_extension.rb +9 -0
  136. data/config/initializers/devise_log.rb +12 -0
  137. data/config/initializers/health_check.rb +35 -0
  138. data/config/initializers/main_app_version.rb +6 -0
  139. data/config/routes.rb +152 -0
  140. data/lib/mno-enterprise-api.rb +1 -0
  141. data/lib/mno_enterprise/api.rb +14 -0
  142. data/lib/mno_enterprise/api/engine.rb +9 -0
  143. data/lib/mno_enterprise/concerns/controllers/deletion_requests_controller.rb +108 -0
  144. data/lib/mno_enterprise/concerns/controllers/jpi/v1/admin/base_resource_controller.rb +34 -0
  145. data/lib/mno_enterprise/concerns/controllers/jpi/v1/current_users_controller.rb +58 -0
  146. data/lib/mno_enterprise/concerns/controllers/jpi/v1/deletion_requests_controller.rb +69 -0
  147. data/lib/mno_enterprise/concerns/controllers/jpi/v1/impac/dashboards_controller.rb +76 -0
  148. data/lib/mno_enterprise/concerns/controllers/jpi/v1/organizations_controller.rb +180 -0
  149. data/lib/mno_enterprise/concerns/controllers/org_invites_controller.rb +44 -0
  150. data/lib/mno_enterprise/concerns/controllers/pages_controller.rb +78 -0
  151. data/lib/mno_enterprise/concerns/controllers/provision_controller.rb +71 -0
  152. data/lib/mno_enterprise/concerns/controllers/webhook/o_auth_controller.rb +107 -0
  153. data/lib/mno_enterprise/concerns/mailers/system_notification_mailer.rb +158 -0
  154. data/lib/mno_enterprise/event_logger.rb +32 -0
  155. data/spec/controllers/mno_enterprise/auth/confirmation_controller_spec.rb +68 -0
  156. data/spec/controllers/mno_enterprise/deletion_requests_controller_spec.rb +141 -0
  157. data/spec/controllers/mno_enterprise/impersonate_controller_spec.rb +48 -0
  158. data/spec/controllers/mno_enterprise/jpi/v1/admin/audit_events_controller_spec.rb +51 -0
  159. data/spec/controllers/mno_enterprise/jpi/v1/admin/cloud_apps_controller_spec.rb +92 -0
  160. data/spec/controllers/mno_enterprise/jpi/v1/admin/invoices_controller_spec.rb +159 -0
  161. data/spec/controllers/mno_enterprise/jpi/v1/admin/organizations_controller_spec.rb +116 -0
  162. data/spec/controllers/mno_enterprise/jpi/v1/admin/tenant_invoices_controller_spec.rb +92 -0
  163. data/spec/controllers/mno_enterprise/jpi/v1/admin/users_controller_spec.rb +136 -0
  164. data/spec/controllers/mno_enterprise/jpi/v1/app_instances_controller_spec.rb +76 -0
  165. data/spec/controllers/mno_enterprise/jpi/v1/app_instances_sync_controller_spec.rb +94 -0
  166. data/spec/controllers/mno_enterprise/jpi/v1/current_users_controller_spec.rb +128 -0
  167. data/spec/controllers/mno_enterprise/jpi/v1/deletion_requests_controller_spec.rb +72 -0
  168. data/spec/controllers/mno_enterprise/jpi/v1/impac/kpis_controller_spec.rb +80 -0
  169. data/spec/controllers/mno_enterprise/jpi/v1/marketplace_controller_spec.rb +115 -0
  170. data/spec/controllers/mno_enterprise/jpi/v1/organizations_controller_spec.rb +516 -0
  171. data/spec/controllers/mno_enterprise/jpi/v1/team_controller_spec.rb +86 -0
  172. data/spec/controllers/mno_enterprise/org_invites_controller_spec.rb +29 -0
  173. data/spec/controllers/mno_enterprise/pages_controller_spec.rb +49 -0
  174. data/spec/controllers/mno_enterprise/provision_controller_spec.rb +94 -0
  175. data/spec/controllers/mno_enterprise/status_controller_spec.rb +34 -0
  176. data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +104 -0
  177. data/spec/lib/mno_enterprise/event_logger_spec.rb +28 -0
  178. data/spec/mailer/mno_enterprise/system_notification_mailer_spec.rb +132 -0
  179. data/spec/rails_helper.rb +94 -0
  180. data/spec/requests/devise/authentication_spec.rb +43 -0
  181. data/spec/requests/devise/registration_spec.rb +64 -0
  182. data/spec/routing/devise/confirmation_routing_spec.rb +20 -0
  183. data/spec/routing/devise/passwords_routing_spec.rb +24 -0
  184. data/spec/routing/devise/registrations_routing_spec.rb +16 -0
  185. data/spec/routing/devise/sessions_routing_spec.rb +20 -0
  186. data/spec/routing/mno_enterprise/deletion_requests_controller_routing_spec.rb +20 -0
  187. data/spec/routing/mno_enterprise/impersonate_controller_routing.spec.rb +15 -0
  188. data/spec/routing/mno_enterprise/jpi/v1/admin/audit_events_controller_routing_spec.rb +11 -0
  189. data/spec/routing/mno_enterprise/jpi/v1/admin/cloud_apps_controller_routing_spec.rb +24 -0
  190. data/spec/routing/mno_enterprise/jpi/v1/admin/invoices_controller_routing_spec.rb +37 -0
  191. data/spec/routing/mno_enterprise/jpi/v1/admin/organizations_controller_routing_spec.rb +20 -0
  192. data/spec/routing/mno_enterprise/jpi/v1/admin/tenant_invoices_controller_routing_spec.rb +16 -0
  193. data/spec/routing/mno_enterprise/jpi/v1/admin/users_controller_routing_spec.rb +24 -0
  194. data/spec/routing/mno_enterprise/jpi/v1/app_instances_controller_routing_spec.rb +12 -0
  195. data/spec/routing/mno_enterprise/jpi/v1/app_instances_sync_controller_routing_spec.rb +15 -0
  196. data/spec/routing/mno_enterprise/jpi/v1/current_users_controller_routing_spec.rb +28 -0
  197. data/spec/routing/mno_enterprise/jpi/v1/deletion_requests_controller_routing_spec.rb +24 -0
  198. data/spec/routing/mno_enterprise/jpi/v1/impac/kpis_controller_routing_spec.rb +22 -0
  199. data/spec/routing/mno_enterprise/jpi/v1/marketplace_controller_routing_spec.rb +16 -0
  200. data/spec/routing/mno_enterprise/jpi/v1/organizations_controller_routing_spec.rb +44 -0
  201. data/spec/routing/mno_enterprise/jpi/v1/teams_controller_routing_spec.rb +36 -0
  202. data/spec/routing/mno_enterprise/org_invites_controller_routing_spec.rb +12 -0
  203. data/spec/routing/mno_enterprise/pages_controller_routing_spec.rb +29 -0
  204. data/spec/routing/mno_enterprise/provision_controller_routing_spec.rb +15 -0
  205. data/spec/routing/mno_enterprise/status_controller_routing_spec.rb +19 -0
  206. data/spec/routing/mno_enterprise/webhook/o_auth_controller_routing_spec.rb +27 -0
  207. data/spec/spec_helper.rb +88 -0
  208. metadata +402 -0
@@ -0,0 +1,5 @@
1
+ json.extract! audit_event, :id, :key, :user_id, :description, :created_at, :user
2
+
3
+ if audit_event.formatted_details.present?
4
+ json.details audit_event.formatted_details
5
+ end
@@ -0,0 +1,4 @@
1
+ json.audit_events do
2
+ json.array! @audit_events, partial: 'audit_event', as: :audit_event
3
+ end
4
+ json.metadata @audit_events.metadata
@@ -0,0 +1 @@
1
+ json.extract! cloud_app, :id, :uid, :name, :tiny_description, :description, :api_key, :metadata_url, :details, :terms_url
@@ -0,0 +1 @@
1
+ json.cloud_apps @cloud_apps, partial: 'cloud_app', as: :cloud_app
@@ -0,0 +1 @@
1
+ json.cloud_app @cloud_app, :id, :uid, :name, :tiny_description, :description, :api_key, :metadata_url, :details
@@ -0,0 +1,2 @@
1
+ json.extract! invoice, :id, :price, :started_at, :ended_at, :created_at, :updated_at, :paid_at, :slug,
2
+ :tax_pips_applied, :billing_address
@@ -0,0 +1 @@
1
+ json.invoices @invoices, partial: 'invoice', as: :invoice
@@ -0,0 +1,2 @@
1
+ json.invoice @invoice, :id, :price, :started_at, :ended_at, :created_at, :updated_at, :paid_at, :slug,
2
+ :tax_pips_applied, :billing_address
@@ -0,0 +1,7 @@
1
+ json.credit_card do
2
+ if credit_card.try(:id)
3
+ json.presence true
4
+ else
5
+ json.presence false
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ json.invoices do
2
+ json.array! organization.invoices.order_by('ended_at.desc') do |invoice|
3
+ json.started_at invoice.started_at
4
+ json.ended_at invoice.ended_at
5
+ json.amount AccountingjsSerializer.serialize(invoice.total_due)
6
+ json.paid invoice.paid?
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ if member.is_a?(MnoEnterprise::User)
2
+ json.id member.id
3
+ json.uid member.uid
4
+ json.entity 'User'
5
+ json.name member.name
6
+ json.surname member.surname
7
+ json.email member.email
8
+ json.role member.role(organization)
9
+ elsif member.is_a?(MnoEnterprise::OrgInvite)
10
+ json.id member.id
11
+ json.entity 'OrgInvite'
12
+ json.email member.user_email
13
+ json.role member.user_role
14
+ end
@@ -0,0 +1 @@
1
+ json.extract! organization, :id, :name, :uid, :soa_enabled, :created_at
@@ -0,0 +1,8 @@
1
+ json.in_arrears do
2
+ json.array!(@arrears) do |arrear|
3
+ json.name arrear.name
4
+ json.amount AccountingjsSerializer.serialize(arrear.payment) if arrear.payment
5
+ json.category arrear.category
6
+ json.status arrear.status
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ json.organizations do
2
+ json.array! @organizations do |organization|
3
+ json.partial! 'organization', organization: organization
4
+ json.partial! 'credit_card', credit_card: organization.credit_card
5
+ end
6
+ end
7
+ json.metadata @organizations.metadata
@@ -0,0 +1,11 @@
1
+ json.organization do
2
+ json.partial! 'organization', organization: @organization
3
+ json.members @organization.members, partial: 'member', as: :member, organization: @organization
4
+ json.partial! 'credit_card', credit_card: @organization.credit_card
5
+ json.partial! 'invoices', organization: @organization
6
+ json.active_apps @organization_active_apps do |instance|
7
+ json.extract! instance, :id, :name, :stack, :uid
8
+ json.app_name instance.app.name
9
+ json.app_logo instance.app.logo
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ json.extract! tenant_invoice, :id, :started_at, :ended_at, :created_at, :updated_at, :paid_at, :slug
2
+
3
+ json.total_portfolio_amount AccountingjsSerializer.serialize(tenant_invoice.total_portfolio_amount)
4
+ json.total_commission_amount AccountingjsSerializer.serialize(tenant_invoice.total_commission_amount)
5
+ json.non_commissionable_amount AccountingjsSerializer.serialize(tenant_invoice.non_commissionable_amount)
@@ -0,0 +1 @@
1
+ json.tenant_invoices @tenant_invoices, partial: 'tenant_invoice', as: :tenant_invoice
@@ -0,0 +1 @@
1
+ json.tenant_invoice @tenant_invoice, :id, :started_at, :ended_at, :created_at, :updated_at, :paid_at, :slug
@@ -0,0 +1 @@
1
+ json.extract! user, :id, :uid, :email, :name, :surname, :admin_role, :created_at
@@ -0,0 +1,2 @@
1
+ json.users @users, partial: 'user', as: :user
2
+ json.metadata @users.metadata
@@ -0,0 +1,9 @@
1
+ json.user do
2
+ json.extract! @user, :id, :uid, :email, :phone, :name, :surname, :admin_role, :created_at, :confirmed_at, :last_sign_in_at
3
+ json.organizations @user_organizations do |org|
4
+ json.id org.id
5
+ json.uid org.uid
6
+ json.name org.name
7
+ json.created_at org.created_at
8
+ end
9
+ end
@@ -0,0 +1,23 @@
1
+ json.id app_instance.id
2
+ json.uid app_instance.uid
3
+ json.stack app_instance.stack
4
+ json.name app_instance.name
5
+ json.status app_instance.status
6
+ json.oauth_keys_valid app_instance.oauth_keys_valid
7
+ #json.http_url app_instance.http_url
8
+ #json.microsoft_trial_url app_instance.microsoft_trial_url
9
+ json.created_at app_instance.created_at
10
+
11
+ if app_instance.oauth_company
12
+ json.oauth_company_name app_instance.oauth_company
13
+ end
14
+ #
15
+ # if app_instance.connector_stack? && app_instance.oauth_keys && app_instance.oauth_keys[:version]
16
+ # json.connector_version app_instance.oauth_keys[:version]
17
+ # end
18
+
19
+ app_instance.app.tap do |a|
20
+ json.app_name a.name
21
+ json.app_nid a.nid
22
+ json.logo a.logo
23
+ end
@@ -0,0 +1,9 @@
1
+ json.timestamp Time.now.to_i
2
+
3
+ json.set! :app_instances do
4
+ @app_instances.each do |app_instance|
5
+ json.set! app_instance.id.to_s do
6
+ json.partial! 'resource', app_instance: app_instance
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ json.app_instance do
2
+ json.partial! 'resource', app_instance: @app_instance
3
+ end
@@ -0,0 +1,37 @@
1
+ json.cache! ['v1', @user.cache_key] do
2
+ json.current_user do
3
+ json.id @user.id
4
+ json.name @user.name
5
+ json.surname @user.surname
6
+ json.email @user.email
7
+ json.logged_in !!@user.id
8
+ json.created_at @user.created_at ? @user.created_at.iso8601 : nil
9
+ json.company @user.company
10
+ json.phone @user.phone
11
+ json.phone_country_code @user.phone_country_code
12
+ json.country_code @user.geo_country_code || 'US'
13
+ json.website @user.website
14
+ json.sso_session @user.sso_session
15
+ json.admin_role @user.admin_role
16
+
17
+ # Embed association if user is persisted
18
+ if @user.id
19
+ json.organizations do
20
+ json.array! (@user.organizations || []) do |o|
21
+ json.id o.id
22
+ json.uid o.uid
23
+ json.name o.name
24
+ json.currency o.billing_currency
25
+ json.current_user_role o.role
26
+ json.has_myob_essentials_only o.has_myob_essentials_only?
27
+ end
28
+ end
29
+
30
+ if @user.deletion_request.present?
31
+ json.deletion_request do
32
+ json.extract! @user.deletion_request, :id, :token
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,9 @@
1
+ json.extract! dashboard, :id, :name, :full_name, :widgets_templates, :currency
2
+
3
+ json.data_sources dashboard.organizations.compact.map do |org|
4
+ json.id org.id
5
+ json.uid org.uid
6
+ json.label org.name
7
+ end
8
+ json.widgets dashboard.sorted_widgets, partial: 'mno_enterprise/jpi/v1/impac/widgets/widget', as: :widget
9
+ json.kpis dashboard.kpis, partial: 'mno_enterprise/jpi/v1/impac/kpis/kpi', as: :kpi
@@ -0,0 +1 @@
1
+ json.array! @dashboards, partial: 'dashboard', as: :dashboard
@@ -0,0 +1 @@
1
+ json.partial! 'dashboard', dashboard: @dashboard
@@ -0,0 +1 @@
1
+ json.extract! kpi, :id, :name, :element_watched, :endpoint, :source, :targets, :settings, :extra_params
@@ -0,0 +1 @@
1
+ json.partial! 'kpi', kpi: @kpi
@@ -0,0 +1,6 @@
1
+ json.id widget.id
2
+ json.name widget.name
3
+ json.category widget.widget_category
4
+ json.width widget.width
5
+ json.metadata widget.settings
6
+ json.owner widget.owner
@@ -0,0 +1 @@
1
+ json.partial! 'widget', widget: @widget
@@ -0,0 +1,14 @@
1
+ json.extract! app, :id, :nid, :name, :stack, :key_benefits, :categories, :tags, :tiny_description,
2
+ :testimonials, :pictures, :pricing_plans
3
+
4
+ json.description markdown(app.sanitized_description)
5
+
6
+ json.is_responsive app.responsive?
7
+ json.is_star_ready app.star_ready?
8
+ json.is_connec_ready app.connec_ready?
9
+ json.is_coming_soon app.coming_soon?
10
+ json.single_billing app.single_billing?
11
+
12
+ if app.logo
13
+ json.logo app.logo.to_s
14
+ end
@@ -0,0 +1,3 @@
1
+ json.categories @categories
2
+
3
+ json.apps @apps, partial: 'app', as: :app
@@ -0,0 +1,3 @@
1
+ json.app do
2
+ json.partial! 'app', app: @app
3
+ end
@@ -0,0 +1,11 @@
1
+ # arrears_situations ||= @organization.arrears_situations.in_progress
2
+ #
3
+ # json.arrears_situations do
4
+ # json.array! [arrears_situations].flatten do |sit|
5
+ # json.id sit.id
6
+ # json.owner_id sit.owner_id
7
+ # json.owner_type sit.owner_type
8
+ # json.category sit.category
9
+ # json.status sit.status
10
+ # end
11
+ # end
@@ -0,0 +1,4 @@
1
+ json.billing do
2
+ json.current AccountingjsSerializer.serialize(organization.current_billing)
3
+ json.credit AccountingjsSerializer.serialize(organization.current_credit)
4
+ end
@@ -0,0 +1,7 @@
1
+ json.credit_card do
2
+ if credit_card
3
+ json.extract! credit_card, :id, :title,:first_name,:last_name,:month,:year,:country,:billing_address,:billing_city,:billing_postcode, :billing_country
4
+ json.number credit_card.masked_number
5
+ json.verification_value 'CVV'
6
+ end
7
+ end
@@ -0,0 +1,5 @@
1
+ json.id user.id
2
+ json.name user.name
3
+ json.surname user.surname
4
+ json.email user.email
5
+ json.role user.role(organization)
@@ -0,0 +1,8 @@
1
+ json.invoices do
2
+ json.array! organization.invoices.order_by('ended_at.desc') do |invoice|
3
+ json.period invoice.period_label
4
+ json.amount AccountingjsSerializer.serialize(invoice.total_due)
5
+ json.paid invoice.paid?
6
+ json.link mno_enterprise.invoice_path(invoice.slug)
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ if member.is_a?(MnoEnterprise::User)
2
+ json.id member.id
3
+ json.entity 'User'
4
+ json.name member.name
5
+ json.surname member.surname
6
+ json.email member.email
7
+ json.role member.role(organization)
8
+ elsif member.is_a?(MnoEnterprise::OrgInvite)
9
+ json.id member.id
10
+ json.entity 'OrgInvite'
11
+ json.email member.user_email
12
+ json.role member.user_role
13
+ end
@@ -0,0 +1,13 @@
1
+ json.extract! organization, :id, :name, :soa_enabled #, :current_support_plan
2
+ # json.show_new_db_features !!organization.get_meta_data(:show_new_db_features)
3
+ # if organization.support_plan
4
+ # json.custom_training_credits organization.support_plan.custom_training_credits
5
+ # end
6
+
7
+ # json.bootstrap_tasks do
8
+ # json.app_launched (@organization.app_instances.count > 0)
9
+ # json.credit_card_details @organization.credit_card?
10
+ # json.data_uploaded !!@organization.get_meta_data(:data_uploaded)
11
+ # json.colleagues_invited (@organization.orga_invites.count > 0)
12
+ # json.connec_promo !!@organization.get_meta_data(:connec_promo)
13
+ # end
@@ -0,0 +1 @@
1
+ json.partial! 'credit_card', credit_card: @credit_card
@@ -0,0 +1 @@
1
+ json.organizations @organizations, partial: 'organization', as: :organization
@@ -0,0 +1,3 @@
1
+ json.members do
2
+ json.partial! 'member', collection: @organization.members, as: :member, organization: @organization
3
+ end
@@ -0,0 +1,15 @@
1
+ json.organization do
2
+ json.partial! 'organization', organization: @organization
3
+ json.members @organization.members, partial: 'member', as: :member, organization: @organization
4
+ end
5
+
6
+ json.current_user do
7
+ json.partial! 'current_user', user: current_user, organization: @organization
8
+ end
9
+
10
+ if current_user.role(@organization) == 'Super Admin'
11
+ json.partial! 'billing', organization: @organization
12
+ json.partial! 'invoices', organization: @organization
13
+ json.partial! 'credit_card', credit_card: @organization.credit_card
14
+ #json.partial! 'arrears', arrears_situations: @organization.arrears_situations.in_progress
15
+ end
@@ -0,0 +1,3 @@
1
+ json.organization do
2
+ json.partial! 'organization', organization: @organization
3
+ end
@@ -0,0 +1,5 @@
1
+ json.array! @orgs do |org|
2
+ json.id org.id
3
+ json.name org.name
4
+ json.role current_user.role(org)
5
+ end
@@ -0,0 +1,59 @@
1
+ json.id @cart.id
2
+ json.pdfUrl @cart.read_attribute(:pdf) ? cart_invoice_url(@cart.slug) : nil
3
+
4
+ json.content do
5
+ json.appInstances (@cart.content[:app_instances] || {}).values
6
+ json.services (@cart.content[:services] || {}).values
7
+ json.support @cart.content[:support]
8
+ json.deal @cart.content[:deal]
9
+ end
10
+
11
+ json.total do
12
+ json.monthly @cart.total_monthly
13
+ json.monthlyRaw @cart.total_monthly_raw
14
+
15
+ json.hourly @cart.total_hourly
16
+ json.adhoc @cart.total_adhoc
17
+
18
+ json.upfrontWithTax @cart.total_upfront_with_tax
19
+ json.upfrontTax @cart.total_upfront_tax
20
+
21
+ json.upfront @cart.total_upfront
22
+ json.upfrontBeforeCredit @cart.total_upfront_before_credit
23
+ json.upfrontRaw @cart.total_upfront_raw
24
+
25
+ json.upfrontSavings @cart.total_upfront_savings
26
+ json.supportCredit @cart.total_support_credit
27
+ end
28
+
29
+ json.orderList @cart.order_list
30
+
31
+ json.setting do
32
+ json.prepayMonths @cart.prepay_months
33
+ json.reductionPercent @cart.reduction_whole_percent
34
+ json.underFreeTrial @cart.under_free_trial?
35
+ json.freeTrialEligible @cart.free_trial_eligible?
36
+ json.creditCardRequired @cart.credit_card_required?
37
+ json.monthlyCreditAvailable @cart.monthly_credit_available?
38
+ json.ownedSupportPlan @cart.owned_support_plan
39
+ end
40
+
41
+ json.creditCard do
42
+ if @cart.credit_card
43
+ cc = @cart.credit_card
44
+
45
+ json.id cc.id
46
+ json.title cc.title
47
+ json.first_name cc.first_name
48
+ json.last_name cc.last_name
49
+ json.number cc.masked_number
50
+ json.month cc.month
51
+ json.year cc.year
52
+ json.country cc.country
53
+
54
+ json.billing_address cc.billing_address
55
+ json.billing_city cc.billing_city
56
+ json.billing_postcode cc.billing_postcode
57
+ json.billing_country cc.billing_country
58
+ end
59
+ end