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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a2463e80552146071e8930054a1e1720af31f17056bdb3c2807d4272f811270
4
- data.tar.gz: e5f17e24902dfa1f2f54681e6cda6090d49524f47526a2ce0feaae01c7b01656
3
+ metadata.gz: a1b096152d21875f0281e736b4c2d540a3995b3c90a74c0a23467eee1c741f2f
4
+ data.tar.gz: 2224c21f9e84d2cfc53343c6e32ea331608d6090825573848062734d6830475f
5
5
  SHA512:
6
- metadata.gz: 315656cff670717492f722302f851290d8160f1fe4545f1a9be8d3d39422469901dba158341d5283ef8728f93cdf2381c3d36e0db1395174b72b457e8dd6775e
7
- data.tar.gz: f438b6ab6e2c3521fd3890b19067648c175d078dda69598110301b098349b9b49a3a6a79c3344e1848293f5cd862052d188694e648c54b7ef7bec3b209cca530
6
+ metadata.gz: 9bf926c9fcc2ec9e28f7ad0b1fc34cf5ebe7d69cca6542d6d4ebcd4ea5534107903d20ffd878f1d1d9639eedd398bdb833de2fa8cba8903da621d485badcf101
7
+ data.tar.gz: 3082a9b1906903f3e45af96c02b9d6ebbcaa5d085bc049180fb4ac3a785d93052cdcb73e581176d5c7301cb0c153124c040f909e1b108bb3662b208e2b117454
data/Rakefile CHANGED
@@ -14,10 +14,4 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
-
18
-
19
-
20
-
21
-
22
- Bundler::GemHelper.install_tasks
23
-
17
+ Bundler::GemHelper.install_tasks
@@ -1,14 +1,25 @@
1
1
  require "xmlrpc/client"
2
2
 
3
- module OdooClient
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
- def initialize(url, database, username, password)
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 count_records(model_name, filters=[])
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 list_records(model_name, filters=[])
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 read_records(model_name, filters=[], select_fields=[], offset=nil, limit=nil)
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 create_record(model_name, params)
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 update_record(model_name, id, params)
65
+ def update(model_name, id, params)
49
66
  update_records(model_name, [id], params)
50
67
  end
51
68
 
52
- def update_records(model_name, record_ids, params)
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 delete_records(model_name, params)
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
@@ -1,4 +1,4 @@
1
- require_relative 'odoo_client/client'
1
+ require 'odoo_client/client'
2
2
 
3
- module OdooClient
3
+ module Odoo
4
4
  end
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.6
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: 2021-02-16 00:00:00.000000000 Z
12
- dependencies: []
13
- description: Ruby Client for Odoo ERP.
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/jberhang/odoo_client
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.2.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: []
@@ -1,3 +0,0 @@
1
- module OdooClient
2
- VERSION = "0.0.6"
3
- end