Module: Seoshop::ShopScript
- Included in:
- Client
- Defined in:
- lib/seoshop-api/api/shop_script.rb
Instance Method Summary collapse
- #delete_script(script_id) ⇒ Object
- #get_script(script_id) ⇒ Object
- #get_scripts(params = {}) ⇒ Object
- #get_scripts_count(params = {}) ⇒ Object
- #post_script(params) ⇒ Object
- #update_script(script_id, params) ⇒ Object
Instance Method Details
#delete_script(script_id) ⇒ Object
27 28 29 30 |
# File 'lib/seoshop-api/api/shop_script.rb', line 27 def delete_script(script_id) response = delete("#{@shop_language}/shop/scripts/#{script_id}.json") true end |
#get_script(script_id) ⇒ Object
23 24 25 26 |
# File 'lib/seoshop-api/api/shop_script.rb', line 23 def get_script(script_id) response = get("#{@shop_language}/shop/scripts/#{script_id}.json") response.body ? response.body['shopScript'] : nil end |
#get_scripts(params = {}) ⇒ Object
8 9 10 11 |
# File 'lib/seoshop-api/api/shop_script.rb', line 8 def get_scripts(params = {}) response = get("#{@shop_language}/shop/scripts.json", params) response.body ? response.body['shopScript'] || [] : [] end |
#get_scripts_count(params = {}) ⇒ Object
4 5 6 7 |
# File 'lib/seoshop-api/api/shop_script.rb', line 4 def get_scripts_count(params = {}) response = get("#{@shop_language}/shop/scripts/count.json", params) response.body ? response.body['count'].to_i : 0 end |
#post_script(params) ⇒ Object
13 14 15 16 |
# File 'lib/seoshop-api/api/shop_script.rb', line 13 def post_script(params) response = post("#{@shop_language}/shop/scripts.json", { "shopScript" => params }) response.body ? response.body['shopScript'] : false end |
#update_script(script_id, params) ⇒ Object
18 19 20 21 |
# File 'lib/seoshop-api/api/shop_script.rb', line 18 def update_script(script_id, params) response = put("#{@shop_language}/shop/scripts/#{script_id}.json", { "shopScript" => params } ) response.body ? response.body['shopScript'] : {} end |