odoo_client 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -7
- data/lib/odoo_client/client.rb +29 -12
- data/lib/odoo_client.rb +2 -2
- metadata +23 -8
- data/lib/odoo_client/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1b096152d21875f0281e736b4c2d540a3995b3c90a74c0a23467eee1c741f2f
|
4
|
+
data.tar.gz: 2224c21f9e84d2cfc53343c6e32ea331608d6090825573848062734d6830475f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bf926c9fcc2ec9e28f7ad0b1fc34cf5ebe7d69cca6542d6d4ebcd4ea5534107903d20ffd878f1d1d9639eedd398bdb833de2fa8cba8903da621d485badcf101
|
7
|
+
data.tar.gz: 3082a9b1906903f3e45af96c02b9d6ebbcaa5d085bc049180fb4ac3a785d93052cdcb73e581176d5c7301cb0c153124c040f909e1b108bb3662b208e2b117454
|
data/Rakefile
CHANGED
data/lib/odoo_client/client.rb
CHANGED
@@ -1,14 +1,25 @@
|
|
1
1
|
require "xmlrpc/client"
|
2
2
|
|
3
|
-
module
|
3
|
+
module Odoo
|
4
4
|
class Client
|
5
5
|
|
6
|
+
VERSION = "0.1.0"
|
7
|
+
|
6
8
|
class AuthenticationError < StandardError
|
7
9
|
end
|
8
10
|
|
9
|
-
|
11
|
+
##
|
12
|
+
# Initialize a new Odoo client
|
13
|
+
# @param url [String] The URL of the Odoo server
|
14
|
+
# @param database [String] The name of the database to connect to
|
15
|
+
# @param username [String] The username to use for authentication
|
16
|
+
# @param password [String] The password to use for authentication
|
17
|
+
def initialize(url, database, username, password, options={})
|
10
18
|
@url = url
|
11
19
|
@common = XMLRPC::Client.new2("#{@url}/xmlrpc/2/common")
|
20
|
+
|
21
|
+
@common.instance_variable_get(:@http).verify_mode = OpenSSL::SSL::VERIFY_NONE if options[:skip_tls]
|
22
|
+
|
12
23
|
@db = database
|
13
24
|
@password = password
|
14
25
|
|
@@ -18,42 +29,48 @@ module OdooClient
|
|
18
29
|
raise AuthenticationError.new if @uid == false
|
19
30
|
end
|
20
31
|
|
32
|
+
##
|
33
|
+
# Get the Odoo instance version
|
34
|
+
# @return [String] The version of the Odoo instance
|
21
35
|
def version
|
22
36
|
@common.call('version')["server_version"]
|
23
37
|
end
|
24
38
|
|
39
|
+
##
|
40
|
+
# Get logged user id
|
41
|
+
# @return [Integer] The user id
|
25
42
|
def me
|
26
43
|
@uid
|
27
44
|
end
|
28
45
|
|
29
|
-
def
|
46
|
+
def count(model_name, filters=[])
|
30
47
|
models.execute_kw(@db, @uid, @password, model_name, 'search_count', [filters], {})
|
31
48
|
end
|
32
49
|
|
33
|
-
def
|
50
|
+
def list(model_name, filters=[])
|
34
51
|
models.execute_kw(@db, @uid, @password, model_name, 'search', [filters], {})
|
35
52
|
end
|
36
53
|
|
37
|
-
def
|
54
|
+
def read(model_name, filters=[], select_fields=[], offset=nil, limit=nil)
|
38
55
|
optional_params = {fields: select_fields}
|
39
56
|
optional_params[:offset] = offset unless offset.nil?
|
40
57
|
optional_params[:limit] = limit unless limit.nil?
|
41
58
|
models.execute_kw(@db, @uid, @password, model_name, 'search_read', [filters], optional_params)
|
42
59
|
end
|
43
60
|
|
44
|
-
def
|
61
|
+
def create(model_name, params)
|
45
62
|
models.execute_kw(@db, @uid, @password, model_name, 'create', [params])
|
46
63
|
end
|
47
64
|
|
48
|
-
def
|
65
|
+
def update(model_name, id, params)
|
49
66
|
update_records(model_name, [id], params)
|
50
67
|
end
|
51
68
|
|
52
|
-
def
|
69
|
+
def update(model_name, record_ids, params)
|
53
70
|
models.execute_kw(@db, @uid, @password, model_name, 'write', [record_ids, params])
|
54
71
|
end
|
55
72
|
|
56
|
-
def
|
73
|
+
def delete(model_name, params)
|
57
74
|
models.execute_kw(@db, @uid, @password, model_name, 'unlink', [params])
|
58
75
|
end
|
59
76
|
|
@@ -67,9 +84,9 @@ module OdooClient
|
|
67
84
|
end
|
68
85
|
|
69
86
|
private
|
70
|
-
def models
|
71
|
-
@models ||= XMLRPC::Client.new2("#{@url}/xmlrpc/2/object").proxy
|
72
|
-
end
|
73
87
|
|
88
|
+
def models
|
89
|
+
@models ||= XMLRPC::Client.new2("#{@url}/xmlrpc/2/object").proxy
|
90
|
+
end
|
74
91
|
end
|
75
92
|
end
|
data/lib/odoo_client.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: odoo_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Valentin LAMBOLEY
|
7
8
|
- Justin Berhang
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
|
12
|
+
date: 2022-11-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: xmlrpc
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.3.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.3.0
|
28
|
+
description: Connect to Odoo ERP and perform CRUD operations.
|
14
29
|
email:
|
30
|
+
- vlamboley@zeto.fr
|
15
31
|
- justin@scratch.com
|
16
32
|
executables: []
|
17
33
|
extensions: []
|
@@ -21,9 +37,8 @@ files:
|
|
21
37
|
- Rakefile
|
22
38
|
- lib/odoo_client.rb
|
23
39
|
- lib/odoo_client/client.rb
|
24
|
-
- lib/odoo_client/version.rb
|
25
40
|
- lib/tasks/odoo_client_tasks.rake
|
26
|
-
homepage: https://github.com/
|
41
|
+
homepage: https://github.com/Yub0/odoo_client
|
27
42
|
licenses:
|
28
43
|
- MIT
|
29
44
|
metadata: {}
|
@@ -42,8 +57,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
57
|
- !ruby/object:Gem::Version
|
43
58
|
version: '0'
|
44
59
|
requirements: []
|
45
|
-
rubygems_version: 3.
|
60
|
+
rubygems_version: 3.3.19
|
46
61
|
signing_key:
|
47
62
|
specification_version: 4
|
48
|
-
summary: Ruby Client for Odoo ERP
|
63
|
+
summary: Pure Ruby Client for Odoo ERP
|
49
64
|
test_files: []
|
data/lib/odoo_client/version.rb
DELETED