caboose-cms 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzQ3NGMzNjNhNWE2NWYyNGZjNjk1MWQ2ZjJkNWJhNTMyYmU4YmJjMQ==
4
+ NjZlMTNjZTdjYTgyNDgwNjAzNDcyM2I0MWRjODJjOThhYjY0NmY1Zg==
5
5
  data.tar.gz: !binary |-
6
- MTZjMzAxMGUxYTFhNDY3ZWY5NGY4NzJhMmViZGU0MjQxZjI4NWRhMw==
6
+ ZTBiMjA0NDM1NDEyYjIzMmFjMTI5NzVjNWEyN2VmZWRmZDU3NDMzYQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YjAyNWIzOWIyNTdlNDgwMjFkMjljODcyYjIyNzhjYjRlNGMxNjZhNjgxM2Zj
10
- MWJhNWU0ZTIxMzBhYzliODliN2U5MTU4NTUwNGQ4ZTJiMTVkMjkxM2UzNTM3
11
- Y2QwZThhODg0MDIyYTViMDMzNzEzODA2ZDFiMzQ0YTBhYWE0Nzc=
9
+ ZGVmNjgzZTI2MjE2NGI2NTg0NGQ1ZWM1ZjhiOGQyZmI2ODY3OGQ0MGIzYTk2
10
+ ODQ3YjVmZjg1NjkyNmI3YjE0MjE3OTY2ZjRkZmEwNzMxNTVhMTA3ZDljNGU1
11
+ ZWUzZTg5YzE5ZmE4MTNjNDJiYTAwNzdhNjRmYWZiNWYwZDNlOTQ=
12
12
  data.tar.gz: !binary |-
13
- OWNjNDk4YjhlNGIyNGFiMDM0OGVjMDA5MWU1YWMzNWIxYmQzYmI1NTYyZmRk
14
- ZTM4OGE2YTExYmNjZTU1MjEyNWI3MDg4YTBjZWVhY2JkNjU3Y2M3MTM1NDM5
15
- YWE5ZmE1Nzg1ZjUwZGVhN2MzYmMxZTAxM2RmYTM5YWM4OWFiMDE=
13
+ M2M5ODVjMjdhYTY0M2U0N2EyNWM0MzhjMzgxY2I3MTM5OTIyMDNmODI4YmVm
14
+ ZDBmMmY2N2MwMWU4ZjUyNDg0OWEyNzU4YTQwODEzZTJkMmNkNTE3YWMwNWIw
15
+ Yzc3MmIxYzdiNjNiOWU1NGI2YzZjNDZhM2VjNDg2OTFjZTM2NTI=
@@ -106,19 +106,25 @@ module Caboose
106
106
  }
107
107
  end
108
108
 
109
+ #=============================================================================
110
+ # API actions
111
+ #=============================================================================
112
+
109
113
  # GET /api/products
110
- def api_list
114
+ def api_index
111
115
  render :json => Product.where(:status => 'Active')
112
116
  end
113
117
 
114
118
  # GET /api/products/:id
115
119
  def api_details
116
- render :json => Product.find(params[:id])
120
+ p = Product.where(:id => params[:id]).first
121
+ render :json => p ? p : { :error => 'Invalid product ID' }
117
122
  end
118
123
 
119
124
  # GET /api/products/:id/variants
120
125
  def api_variants
121
- render :json => Product.find(params[:id]).variants
126
+ p = Product.where(:id => params[:id]).first
127
+ render :json => p ? p.variants : { :error => 'Invalid product ID' }
122
128
  end
123
129
 
124
130
  #=============================================================================
@@ -372,8 +372,12 @@ Caboose::Engine.routes.draw do
372
372
  delete "/admin/orders/:id" => "orders#admin_delete"
373
373
 
374
374
  # API
375
- get "caboose/block-types" => "block_types#api_block_type_list"
376
- get "caboose/block-types/:name" => "block_types#api_block_type"
375
+ get "/api/products" => "products#api_index"
376
+ get "/api/products/:id" => "products#api_details"
377
+ get "/api/products/:id/variants" => "products#api_variants"
378
+
379
+ get "caboose/block-types" => "block_types#api_block_type_list"
380
+ get "caboose/block-types/:name" => "block_types#api_block_type"
377
381
 
378
382
  match '*path' => 'pages#show'
379
383
  root :to => 'pages#show'
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.5.7'
2
+ VERSION = '0.5.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry