auth-lh 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 816c465c92d8a14b91895d532cf34b6a5ca9ad8e
4
- data.tar.gz: 9aeb20d317f08c906b1d7a6b618138c5a24d28ea
3
+ metadata.gz: 61f2629f90e2ab77c21d46cafc88dd6c939bfefb
4
+ data.tar.gz: 5c09f271879ddeb02b2e3c27fa543a0670e111fb
5
5
  SHA512:
6
- metadata.gz: 95002195749cbbb9663b1c3f0c937d4177984e2f5348fdb706270290e642ef25e58c73d289c79c3feb6600525fd801ef4d07dcb396c01f297ee13d38cf265a30
7
- data.tar.gz: 40a1e3b932277f74b9d2e4b808ca9a5a079005e8afd46f911b74d482e81dfe8141ada7bf4a20ce0cefc9c42fd17fc8d8f107f5d54e5581845ececec30376462a
6
+ metadata.gz: 3bdaa790458c55db4b22ee2e418f5625ff91aeb61be92240956d84f04cbbd8fbbb49d2bee290aacab30e3871bcaa9f8a22dc90d08b2246af86e9fa77c002b598
7
+ data.tar.gz: 59ebb2732aaf6bfd80def2376b25ce255c0b7e7621a1a9def1fe90a5c1fa70ee14d38c5c8f8e5ede48acaf6c095323f62eca21890bc9ca0ed4474eab6465f679
data/CHANGELOG.md CHANGED
@@ -1,30 +1,30 @@
1
1
  ## v0.0.1
2
2
 
3
- * Initial release
3
+ * Initial release.
4
4
 
5
5
  ## v0.0.2
6
6
 
7
- * Bugfix: mistyped variable
7
+ * Bugfix: mistyped variable.
8
8
 
9
9
  ## v0.0.3
10
10
 
11
- * Bugfix: namespace bad typed
11
+ * Bugfix: namespace bad typed.
12
12
 
13
13
  ## v0.0.4
14
14
 
15
- * Implemented method to get users from api
15
+ * Implemented method to get users from api.
16
16
 
17
17
  ## v0.0.5
18
18
 
19
- * Bugfix: access token not being set in configuration
19
+ * Bugfix: access token not being set in configuration.
20
20
 
21
21
  ## v0.0.6
22
22
 
23
- * Bugfix: api method url mistyped
23
+ * Bugfix: api method url mistyped.
24
24
 
25
25
  ## v0.0.7
26
26
 
27
- * Make return url optional
27
+ * Make return url optional.
28
28
 
29
29
  ## v0.0.8
30
30
 
@@ -40,92 +40,96 @@
40
40
 
41
41
  ## v0.0.11
42
42
 
43
- * Added fields to users, added method to get all users
43
+ * Added fields to users, added method to get all users.
44
44
 
45
45
  ## v0.0.12
46
46
 
47
- * Added external apps methods
47
+ * Added external apps methods.
48
48
 
49
49
  ## v0.1.0
50
50
 
51
- * Authentication methods put into module
51
+ * Authentication methods put into module.
52
52
 
53
53
  ## v0.1.1
54
54
 
55
- * API Reorganization
55
+ * API Reorganization.
56
56
 
57
57
  ## v0.2.0
58
58
 
59
- * Enable users to change password
59
+ * Enable users to change password.
60
60
 
61
61
  ## v0.2.1
62
62
 
63
- * Get role by code
63
+ * Get role by code.
64
64
 
65
65
  ## v0.2.2
66
66
 
67
- * Added has_role method to user
67
+ * Added has_role method to user.
68
68
 
69
69
  ## v0.2.3
70
70
 
71
- * Remove cache external users
71
+ * Remove cache external users.
72
72
 
73
73
  ## v0.2.4
74
74
 
75
- * Fixed runtime dependencies
75
+ * Fixed runtime dependencies.
76
76
 
77
77
  ## v0.3.0
78
78
 
79
- * Added whatsmyshop method
79
+ * Added whatsmyshop method.
80
80
 
81
81
  ## v0.3.1
82
82
 
83
- * Remove caching from get current user method
83
+ * Remove caching from get current user method.
84
84
 
85
85
  ## v0.3.2
86
86
 
87
- * Added new fields to entities
87
+ * Added new fields to entities.
88
88
 
89
89
  ## v0.4.0
90
90
 
91
- * Improved auth interface
91
+ * Improved auth interface.
92
92
 
93
93
  ## v0.4.1
94
94
 
95
- * Changed field in session response
95
+ * Changed field in session response.
96
96
 
97
97
  ## v0.4.2
98
98
 
99
- * Added filters to get users extended
99
+ * Added filters to get users extended.
100
100
 
101
101
  ## v0.5.0
102
102
 
103
- * Added shop_id to user
103
+ * Added shop_id to user.
104
104
 
105
105
  ## v0.6.0
106
106
 
107
- * Changed get current shop return type
107
+ * Changed get current shop return type.
108
108
 
109
109
  ## v0.6.1
110
110
 
111
- * Bugfix on response for get current shop
111
+ * Bugfix on response for get current shop.
112
112
 
113
113
  ## v0.7.0
114
114
 
115
- * Added working time field
115
+ * Added working time field.
116
116
 
117
117
  ## v0.8.0
118
118
 
119
- * Added has attendance control field
119
+ * Added has attendance control field.
120
120
 
121
121
  ## v0.8.1
122
122
 
123
- * Removed birthdate field
123
+ * Removed birthdate field.
124
124
 
125
125
  ## v0.8.2
126
126
 
127
- * Refactored external apps fields
127
+ * Refactored external apps fields.
128
128
 
129
129
  ## v0.9.0
130
130
 
131
131
  * Added enabled apps for user.
132
+
133
+ ## v0.10.0
134
+
135
+ * Added seller code and method to update attributes from users.
@@ -1,5 +1,5 @@
1
1
  module Auth
2
2
  module Lh
3
- VERSION = "0.9.0"
3
+ VERSION = "0.10.0"
4
4
  end
5
5
  end
data/lib/auth_lh.rb CHANGED
@@ -9,6 +9,10 @@ module AuthLh
9
9
  User.new(get_request("/api/users/#{code_or_login}"))
10
10
  end
11
11
 
12
+ def self.update_user(code_or_login, attrs={})
13
+ User.new(get_request("/api/users/#{code_or_login}", attrs))
14
+ end
15
+
12
16
  def self.get_users(filters={})
13
17
  results = get_request('/api/users', filters)
14
18
  results.map { |r| User.new(r) }
@@ -82,6 +86,17 @@ module AuthLh
82
86
 
83
87
  def self.get_request(action, params={})
84
88
  response = RestClient.get("#{@endpoint}#{action}", {params: params}.merge(auth_headers))
89
+
90
+ if response.body == 'null'
91
+ nil
92
+ else
93
+ JSON.parse(response.body)
94
+ end
95
+ end
96
+
97
+ def put_request(action, params={}, headers={})
98
+ response = RestClient.put("#{@endpoint_url}#{action}", params, headers.merge(auth_headers))
99
+
85
100
  if response.body == 'null'
86
101
  nil
87
102
  else
data/lib/auth_lh/user.rb CHANGED
@@ -2,7 +2,7 @@ module AuthLh
2
2
  class User
3
3
  attr_accessor :code, :email, :jabber, :name, :login, :shop_code,
4
4
  :shop_id, :shop_name, :enabled, :role_codes, :password_expired,
5
- :dni, :has_attendance_control, :external_apps
5
+ :dni, :has_attendance_control, :external_apps, :seller_code
6
6
 
7
7
  def initialize(attributes={})
8
8
  attributes.each do |k,v|
@@ -4,7 +4,7 @@ module AuthLh
4
4
  :password_expired, :enabled, :shop_code, :allow_remote_access,
5
5
  :session_timeout, :access_level, :only_working_time, :birthdate,
6
6
  :allow_multiple_sessions, :working_time, :dni, :app_codes, :role_codes,
7
- :has_attendance_control
7
+ :has_attendance_control, :seller_code
8
8
 
9
9
  def initialize(attributes={})
10
10
  attributes.each do |k,v|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth-lh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Hick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-04 00:00:00.000000000 Z
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler