Class: SKApi::Resources::Product

Inherits:
Base show all
Defined in:
lib/resources/product.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, set_connection

Methods included from Utils::Serializer

included

Methods inherited from ActiveResource::Base

#encode, instantiate_collection, #load_attributes_from_response

Constructor Details

This class inherits a constructor from SKApi::Resources::Base

Class Method Details

.schemaObject



9
10
11
12
# File 'lib/resources/product.rb', line 9

def self.schema
  { "type" => "object",
  "properties" => SKApi::Resources::Product.schema_props}
end

.schema_propsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/resources/product.rb', line 14

def self.schema_props
  {
     "id"           => {"type" => "string", "identity" => true , "readonly" => true},
     "number"       => {"type" => "string", "optional" => true},
     "name"         => {"type" => "string"},
     "description"  => {"type" => "string", "optional" => true},
     "price"        => {"type" => "number"},
     "tax"          => {"type" => "number", "optional" => true},
     "quantity_unit"=> {"type" => "string", "optional" => true},
     "tag_list"     => {"type" => "string", "optional" => true},
     "lock_version" => {"type" => "integer", "readonly" => true, "optional" => true},
     "created_at"   => {"type" => "string", "format" =>"date-time", "optional" => true, "readonly" => true },
     "updated_at"   => {"type" => "string", "format" =>"date-time", "optional" => true, "readonly" => true },
   }
end

Instance Method Details

#saveObject



5
6
7
# File 'lib/resources/product.rb', line 5

def save
  save_with_validation
end