Class: SKApi::Resources::LineItem

Inherits:
Base show all
Defined in:
lib/resources/line_item.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/line_item.rb', line 9

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

.schema_propsObject



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

def self.schema_props
  {
     "id"             => {"type" => "string", "identity" => true , "readonly" => true},
     "position"       => {"type" => "integer"},
     "product_id"     => {"type" => "string", "optional" => true},
     "quantity"       => {"type" => "number"},
     "quantity_unit"  => {"type" => "string", "optional" => true},
     "name"           => {"type" => "string", "optional" => true},
     "description"    => {"type" => "string", "optional" => true},
     "price_single"   => {"type" => "number"},
     "discount"       => {"type" => "number", "optional" => true},
     "tax"            => {"type" => "number", "optional" => true},
     "use_product"    => {"type" => "integer", "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/line_item.rb', line 5

def save
  save_with_validation
end