Class: SKApi::Resources::Client

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

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

.schema_propsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/resources/client.rb', line 14

def self.schema_props
 {
     "id"           => {"type" => "string", "identity" => true, "optional" => true, "readonly" => true},
     "number"       => {"type" => "string", "optional" => true},
     "organisation" => {"type" => "string"},
     "first_name"   => {"type" => "string", "optional" => true},
     "last_name"    => {"type" => "string", "optional" => true},
     "title"        => {"type" => "string", "optional" => true},
     "position"     => {"type" => "string", "optional" => true},
     "gender"       => {"type" => "string", "enum" => ["male", "female"] , "optional" => true},
     "email"        => {"type" => "string", "optional" => true},
     "birthday"     => {"type" => "string", "format" =>"date", "optional" => true},
     "url"          => {"type" => "string", "optional" => true},
     "phone_fax"    => {"type" => "string", "optional" => true},
     "phone_mobile" => {"type" => "string", "optional" => true},
     "phone_office" => {"type" => "string", "optional" => true},
     "phone_home"   => {"type" => "string", "optional" => true},
     "bank_owner"   => {"type" => "string", "optional" => true},
     "bank_name"    => {"type" => "string", "optional" => true},
     "bank_number"  => {"type" => "string", "optional" => true},
     "bank_account_number" => {"type" => "string", "optional" => true},
     "bank_iban"      => {"type" => "string", "optional" => true},
     "bank_swift"     => {"type" => "string", "optional" => true},
     "vat_number"     => {"type" => "string", "optional" => true},
     "tax_number"     => {"type" => "string", "optional" => true},
     "tag_list"       => {"type" => "string", "optional" => true},
     "cash_discount"  => {"type" => "number", "optional" => true},
     "due_days"       => {"type" => "integer", "optional" => true},
     "payment_method" => {"type" => "string", "enum" => ["draft", "open", "closed"], "optional" => true},
     "sending_method" => {"type" => "string", "enum" => ["draft", "open", "closed"], "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},
     "address_field"  => {"type" => "string", "optional" => true, "readonly" => true},
     "addresses"      => {"type" => "array","properties" => SKApi::Resources::Address.schema_props, "optional" => true}
   }
end

Instance Method Details

#saveObject



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

def save
  save_with_validation
end