limelm 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -6
- data/Rakefile +1 -1
- data/TODO.md +0 -1
- data/VERSION +1 -1
- data/lib/lime_lm/key.rb +14 -0
- data/limelm.gemspec +6 -4
- data/spec/fixtures/dish_cassettes/default_activity.yml +48 -0
- data/spec/fixtures/dish_cassettes/no_activity.yml +47 -0
- data/spec/lib/lime_lm/key_spec.rb +20 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 600c6d87ca9354de4c78dcc31776e2cc9f0afd01
|
4
|
+
data.tar.gz: fed5c40eee968bcfc110383f66fd4c97767b818c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e181348de4d7f910b8de858e363384dcada7775c22e91541c4813ad5c0f900aede21215ebe1f9df6882928942e73fdd494e4af1b705b65292cffb20ff120d35e
|
7
|
+
data.tar.gz: a9e453fe128ef39c5cdc378568593a2d7227718938ead006b85e494afe93e2216d589f89bf523ae30c2701dfe711fc2343ef86cf3abf4b50242e7e7cf5b3cd5f
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# limelm
|
2
2
|
|
3
|
-
A Ruby API wrapper for the LimeLM API. LimeLM is a powerfull
|
3
|
+
A Ruby API wrapper for the LimeLM API. LimeLM is a powerfull License and Online Activation Manager. For more information, see: http://wyday.com/limelm/
|
4
4
|
|
5
5
|
Documentation for the LimeLM API can be found here: https://wyday.com/limelm/help/api/
|
6
6
|
|
@@ -39,7 +39,6 @@ LimeLm::Key.find('imberdis.damien@gmail.com', version_id: '1')
|
|
39
39
|
* [manual offline activation of a key](https://wyday.com/limelm/help/api/limelm.pkey.manualActivation/)
|
40
40
|
* [manual offline deactivation of a key](https://wyday.com/limelm/help/api/limelm.pkey.manualDeactivation/)
|
41
41
|
* [trial extension CRUD operation](https://wyday.com/limelm/help/api/)
|
42
|
-
* [Gets the activity of a product version between a date range](https://wyday.com/limelm/help/api/limelm.pkey.activity/)
|
43
42
|
* [Remove a tag from all product keys](https://wyday.com/limelm/help/api/limelm.tag.delete/)
|
44
43
|
|
45
44
|
## Contribute to limelm
|
@@ -58,10 +57,10 @@ All tests can be run by the command `rake spec`. By default, all the API request
|
|
58
57
|
|
59
58
|
As LimeLM not providing yet a demo environment, you will need to use your own product version to implement new functionalities:
|
60
59
|
|
61
|
-
* create a conf.yml file under the project root directory that will
|
62
|
-
*
|
63
|
-
* write new test (cf. other tests as examples on how to use VCR for mocking the HTTP requests), launch them with the command `rake spec MODE=live`.
|
64
|
-
* Once VCR generated the fixtures, anonymize
|
60
|
+
* create a conf.yml file under the project root directory that will contain your personal credentials `api_key` and `version_id`.
|
61
|
+
* never share that file via your source control tool.
|
62
|
+
* write a new test (cf. other tests as examples on how to use VCR for mocking the HTTP requests), launch them with the command `rake spec MODE=live`.
|
63
|
+
* Once VCR generated the fixtures, anonymize all credentials (replace every api_key, version_id, key ids and values by fake data).
|
65
64
|
|
66
65
|
|
67
66
|
## Disclaimer
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |gem|
|
|
18
18
|
gem.homepage = "http://github.com/dam/limelm"
|
19
19
|
gem.license = "MIT"
|
20
20
|
gem.summary = %Q{limelm is a Ruby wrapper for the LimeLM JSON API}
|
21
|
-
gem.description = %Q{limelm is a Ruby wrapper for the LimeLM JSON API. LimeLM is a powerfull
|
21
|
+
gem.description = %Q{limelm is a Ruby wrapper for the LimeLM JSON API. LimeLM is a powerfull License and Online Activation Manager}
|
22
22
|
gem.email = "imberdis.damien@gmail.com"
|
23
23
|
gem.authors = ["Damien Imberdis"]
|
24
24
|
end
|
data/TODO.md
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
* [manual offline activation of a key](https://wyday.com/limelm/help/api/limelm.pkey.manualActivation/)
|
4
4
|
* [manual offline deactivation of a key](https://wyday.com/limelm/help/api/limelm.pkey.manualDeactivation/)
|
5
5
|
* [trial extension CRUD operation](https://wyday.com/limelm/help/api/)
|
6
|
-
* [Gets the activity of a product version between a date range](https://wyday.com/limelm/help/api/limelm.pkey.activity/)
|
7
6
|
* [Remove a tag from all product keys](https://wyday.com/limelm/help/api/limelm.tag.delete/)
|
8
7
|
|
9
8
|
# Tests
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/lime_lm/key.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'date'
|
2
|
+
|
1
3
|
module LimeLm
|
2
4
|
class Key
|
3
5
|
attr_reader :id
|
@@ -32,6 +34,18 @@ module LimeLm
|
|
32
34
|
response = LimeLm::Connection.post_json({ method: 'limelm.pkey.advancedSearch'}.merge!(params))
|
33
35
|
response['pkeys']['pkey'].map { |k| new(k) }
|
34
36
|
end
|
37
|
+
|
38
|
+
# Returns by default activity of created product keys only to speed up the query
|
39
|
+
# Pass optional activity as parameters. Asking for activity of all the products takes a long process time
|
40
|
+
def activity(params={})
|
41
|
+
version_id = params.delete(:version_id) { LimeLm.config[:version_id] }
|
42
|
+
start = params.delete(:start) { (Date.today - 7).strftime('%Y-%m-%d') }
|
43
|
+
|
44
|
+
response = LimeLm::Connection.post_json({ method: 'limelm.pkey.activity', version_id: version_id, start: start, created: true}.merge!(params))
|
45
|
+
response['pkeys']['pkey']
|
46
|
+
rescue LimeLm::ApiError => e
|
47
|
+
e.message.include?('109') ? [] : raise(e)
|
48
|
+
end
|
35
49
|
end
|
36
50
|
|
37
51
|
def id(params={})
|
data/limelm.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: limelm 0.
|
5
|
+
# stub: limelm 0.2.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "limelm"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.2.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Damien Imberdis"]
|
14
|
-
s.date = "2015-
|
15
|
-
s.description = "limelm is a Ruby wrapper for the LimeLM JSON API. LimeLM is a powerfull
|
14
|
+
s.date = "2015-04-14"
|
15
|
+
s.description = "limelm is a Ruby wrapper for the LimeLM JSON API. LimeLM is a powerfull License and Online Activation Manager"
|
16
16
|
s.email = "imberdis.damien@gmail.com"
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"LICENSE.txt",
|
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
|
|
41
41
|
"spec/fixtures/dish_cassettes/create_key_new_version.yml",
|
42
42
|
"spec/fixtures/dish_cassettes/create_keys_with_email.yml",
|
43
43
|
"spec/fixtures/dish_cassettes/create_product_default_feature.yml",
|
44
|
+
"spec/fixtures/dish_cassettes/default_activity.yml",
|
44
45
|
"spec/fixtures/dish_cassettes/default_search.yml",
|
45
46
|
"spec/fixtures/dish_cassettes/default_search_pagination.yml",
|
46
47
|
"spec/fixtures/dish_cassettes/destroy_feature.yml",
|
@@ -50,6 +51,7 @@ Gem::Specification.new do |s|
|
|
50
51
|
"spec/fixtures/dish_cassettes/details_for_a_given_key_with_tags.yml",
|
51
52
|
"spec/fixtures/dish_cassettes/find_keys_by_email.yml",
|
52
53
|
"spec/fixtures/dish_cassettes/id_for_a_given_key.yml",
|
54
|
+
"spec/fixtures/dish_cassettes/no_activity.yml",
|
53
55
|
"spec/fixtures/dish_cassettes/remove_tag_for_a_given_key.yml",
|
54
56
|
"spec/fixtures/dish_cassettes/revoke_key.yml",
|
55
57
|
"spec/fixtures/dish_cassettes/set_tags_for_a_given_key.yml",
|
@@ -0,0 +1,48 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&created=true&format=json&method=limelm.pkey.activity&start=2015-04-07&version_id=1
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 14 Apr 2015 20:04:58 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Set-Cookie:
|
32
|
+
- PHPSESSID=6kgue1ro9k7pneoqhhgl379r57; path=/
|
33
|
+
Expires:
|
34
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
35
|
+
Cache-Control:
|
36
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Pragma:
|
38
|
+
- no-cache
|
39
|
+
X-Frame-Options:
|
40
|
+
- SAMEORIGIN
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: jsonLimeLMApi({"stat":"ok","pkeys":{"pkey":[{"id":"1","key":"AAAA","acts":"5","acts_used":"0","created":"2015-04-14
|
44
|
+
11:58:05","total_deacts":"0","deac_limit":"unlimited","for_tfs":"false","allow_vm":"no"},{"id":"2","key":"BBBB","acts":"7","acts_used":"0","created":"2015-04-14
|
45
|
+
10:01:43","total_deacts":"0","deac_limit":"unlimited","for_tfs":"false","allow_vm":"no"}]}})
|
46
|
+
http_version:
|
47
|
+
recorded_at: Tue, 14 Apr 2015 20:04:58 GMT
|
48
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&created=true&format=json&method=limelm.pkey.activity&start=2015-04-07&version_id=1
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
Server:
|
22
|
+
- nginx
|
23
|
+
Date:
|
24
|
+
- Tue, 14 Apr 2015 19:59:58 GMT
|
25
|
+
Content-Type:
|
26
|
+
- application/json
|
27
|
+
Transfer-Encoding:
|
28
|
+
- chunked
|
29
|
+
Connection:
|
30
|
+
- keep-alive
|
31
|
+
Set-Cookie:
|
32
|
+
- PHPSESSID=61qgs8as0t06qi3lc5o4tufm21; path=/
|
33
|
+
Expires:
|
34
|
+
- Thu, 19 Nov 1981 08:52:00 GMT
|
35
|
+
Cache-Control:
|
36
|
+
- no-store, no-cache, must-revalidate, post-check=0, pre-check=0
|
37
|
+
Pragma:
|
38
|
+
- no-cache
|
39
|
+
X-Frame-Options:
|
40
|
+
- SAMEORIGIN
|
41
|
+
body:
|
42
|
+
encoding: UTF-8
|
43
|
+
string: jsonLimeLMApi({"stat":"fail","code":109,"message":"No activity results
|
44
|
+
found for the parameters specified."})
|
45
|
+
http_version:
|
46
|
+
recorded_at: Tue, 14 Apr 2015 19:59:58 GMT
|
47
|
+
recorded_with: VCR 2.9.3
|
@@ -209,4 +209,24 @@ describe LimeLm::Key do
|
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
212
|
+
|
213
|
+
describe '.activity' do
|
214
|
+
it 'returns the activity of a product version for the last week by default' do
|
215
|
+
VCR.use_cassette("default_activity", match_requests_on: [:path]) do
|
216
|
+
result = LimeLm::Key.activity(version_id: '1')
|
217
|
+
assert result.is_a?(Array)
|
218
|
+
key_info = result.first
|
219
|
+
assert_equal '1', key_info["id"]
|
220
|
+
assert_equal "AAAA", key_info['key']
|
221
|
+
assert_equal "5", key_info['acts']
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
it 'returns an empty array if no activity results found' do
|
226
|
+
VCR.use_cassette("no_activity", match_requests_on: [:path]) do
|
227
|
+
result = LimeLm::Key.activity
|
228
|
+
assert_equal [], result
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
212
232
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limelm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Damien Imberdis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.0.1
|
69
69
|
description: limelm is a Ruby wrapper for the LimeLM JSON API. LimeLM is a powerfull
|
70
|
-
|
70
|
+
License and Online Activation Manager
|
71
71
|
email: imberdis.damien@gmail.com
|
72
72
|
executables: []
|
73
73
|
extensions: []
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- spec/fixtures/dish_cassettes/create_key_new_version.yml
|
98
98
|
- spec/fixtures/dish_cassettes/create_keys_with_email.yml
|
99
99
|
- spec/fixtures/dish_cassettes/create_product_default_feature.yml
|
100
|
+
- spec/fixtures/dish_cassettes/default_activity.yml
|
100
101
|
- spec/fixtures/dish_cassettes/default_search.yml
|
101
102
|
- spec/fixtures/dish_cassettes/default_search_pagination.yml
|
102
103
|
- spec/fixtures/dish_cassettes/destroy_feature.yml
|
@@ -106,6 +107,7 @@ files:
|
|
106
107
|
- spec/fixtures/dish_cassettes/details_for_a_given_key_with_tags.yml
|
107
108
|
- spec/fixtures/dish_cassettes/find_keys_by_email.yml
|
108
109
|
- spec/fixtures/dish_cassettes/id_for_a_given_key.yml
|
110
|
+
- spec/fixtures/dish_cassettes/no_activity.yml
|
109
111
|
- spec/fixtures/dish_cassettes/remove_tag_for_a_given_key.yml
|
110
112
|
- spec/fixtures/dish_cassettes/revoke_key.yml
|
111
113
|
- spec/fixtures/dish_cassettes/set_tags_for_a_given_key.yml
|