zooppa_api_v3 0.0.4 → 0.0.5

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: 6b914f28dee24250f6e4573a5cf58a364caa3e56
4
- data.tar.gz: 86058c25f05208e4fc91dd1d4fd680ba1ecceec8
3
+ metadata.gz: 93e1e0dbedd4bb87f26db3d1c4323a72ef40dc79
4
+ data.tar.gz: 3d618247d3484c4b045008a969671e8a46b9fde4
5
5
  SHA512:
6
- metadata.gz: e1f4fbeaa6c8b9ed615410158c7dc4c1b29bc2ac40775d04b8a455bca51059103f2bd7fe8a05c2b7839ac52e51237c5069d5f88dc352d9a72b730c6f8bc946cf
7
- data.tar.gz: 7ffa318a30ba36c6a35321bb2b06c9c99ec534792729dd38bf3e483343ff25f34152d9dc35df163c91529d0d5a25abd6cb9f870f48c5fc8fe404952c0c8d64da
6
+ metadata.gz: c0a5e1ff81e3965670f49e6c8e0b76b7eef9d85cb14ebf61df7deb4c8dcd64f6127d7bddca7dccf9b2da64e57cc5e7af222fa78fcfad66392aea8c7c160faa65
7
+ data.tar.gz: 8dea41292eda03544f1c3fa01ccf4d9c381356c9a19cf1d2c1cb7141c1bf84dca9574136f48c0eeb2065d5b4ae07f0693b0e1a84b3dd5084cd0ec50f5ba60ce8
data/README.md CHANGED
@@ -48,7 +48,15 @@ Possible configuration options:
48
48
 
49
49
  ###Authentication:
50
50
 
51
- `ZOOPPA_API.authenticate('email@email.com', 'pass')`
51
+ Both authentication return an access token.
52
+
53
+ Authenticate a user:
54
+
55
+ `ZOOPPA_API.authenticate_user('email@email.com', 'pass')`
56
+
57
+ Authenticate a client app:
58
+
59
+ `ZOOPPA_API.authenticate_application`
52
60
 
53
61
  If authentication was successful, it returns the access token (encrypted if encrypt is set to true) or returns JSON with an error key and message.
54
62
 
data/lib/zooppa_api_v3.rb CHANGED
@@ -5,7 +5,6 @@ require 'active_support/core_ext'
5
5
  require 'oauth2'
6
6
  require 'encryptor'
7
7
 
8
-
9
8
  class ZooppaApiV3
10
9
 
11
10
  # Initializes the Rest Request
@@ -178,7 +177,19 @@ class ZooppaApiV3
178
177
  end
179
178
  end
180
179
 
181
- def authenticate(email, password)
180
+ def authenticate_application
181
+ client = OAuth2::Client.new(
182
+ @app_id,
183
+ @app_secret,
184
+ site: @api_host
185
+ )
186
+ token = client.client_credentials.get_token.token
187
+ @encrypt ? encrypt_token(token) : token
188
+ rescue => e
189
+ parse_error_message(e)
190
+ end
191
+
192
+ def authenticate_user(email, password)
182
193
  client = OAuth2::Client.new(
183
194
  @app_id,
184
195
  @app_secret,
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "zooppa_api_v3"
8
- spec.version = '0.0.4'
8
+ spec.version = '0.0.5'
9
9
  spec.authors = ["Ulrich Soeffing"]
10
10
  spec.email = ["ulrich_soeffing@gmx.de"]
11
11
  spec.description = "Wrapper for the Zooppa api v3"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zooppa_api_v3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ulrich Soeffing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-12 00:00:00.000000000 Z
11
+ date: 2015-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler