limelm 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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/Gemfile +15 -0
  4. data/Gemfile.lock +75 -0
  5. data/LICENSE.txt +20 -0
  6. data/README.md +75 -0
  7. data/Rakefile +50 -0
  8. data/TODO.md +10 -0
  9. data/VERSION +1 -0
  10. data/lib/lime_lm/connection.rb +23 -0
  11. data/lib/lime_lm/exceptions.rb +6 -0
  12. data/lib/lime_lm/feature.rb +62 -0
  13. data/lib/lime_lm/key.rb +83 -0
  14. data/lib/lime_lm/utils.rb +7 -0
  15. data/lib/limelm.rb +30 -0
  16. data/limelm.gemspec +89 -0
  17. data/spec/fixtures/dish_cassettes/all_features.yml +47 -0
  18. data/spec/fixtures/dish_cassettes/create_custom_feature.yml +46 -0
  19. data/spec/fixtures/dish_cassettes/create_detailed_key.yml +46 -0
  20. data/spec/fixtures/dish_cassettes/create_key_default_configuration.yml +46 -0
  21. data/spec/fixtures/dish_cassettes/create_key_new_version.yml +46 -0
  22. data/spec/fixtures/dish_cassettes/create_keys_with_email.yml +46 -0
  23. data/spec/fixtures/dish_cassettes/create_product_default_feature.yml +46 -0
  24. data/spec/fixtures/dish_cassettes/default_search.yml +46 -0
  25. data/spec/fixtures/dish_cassettes/default_search_pagination.yml +46 -0
  26. data/spec/fixtures/dish_cassettes/destroy_feature.yml +46 -0
  27. data/spec/fixtures/dish_cassettes/destroy_key.yml +46 -0
  28. data/spec/fixtures/dish_cassettes/destroy_random_key.yml +47 -0
  29. data/spec/fixtures/dish_cassettes/details_for_a_given_key.yml +46 -0
  30. data/spec/fixtures/dish_cassettes/details_for_a_given_key_with_tags.yml +46 -0
  31. data/spec/fixtures/dish_cassettes/find_keys_by_email.yml +46 -0
  32. data/spec/fixtures/dish_cassettes/id_for_a_given_key.yml +46 -0
  33. data/spec/fixtures/dish_cassettes/remove_tag_for_a_given_key.yml +46 -0
  34. data/spec/fixtures/dish_cassettes/revoke_key.yml +46 -0
  35. data/spec/fixtures/dish_cassettes/set_tags_for_a_given_key.yml +46 -0
  36. data/spec/fixtures/dish_cassettes/unrevoke_key.yml +46 -0
  37. data/spec/fixtures/dish_cassettes/update_custom_feature.yml +46 -0
  38. data/spec/lib/lime_lm/feature_spec.rb +86 -0
  39. data/spec/lib/lime_lm/key_spec.rb +212 -0
  40. data/spec/lib/limelm_spec.rb +37 -0
  41. data/spec/spec_helper.rb +70 -0
  42. metadata +142 -0
@@ -0,0 +1,7 @@
1
+ module LimeLm
2
+ class Utils
3
+ def self.stringify_keys(hash)
4
+ Hash[hash.map{ |k, v| [k.to_s, v] }]
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,30 @@
1
+ require 'httparty'
2
+ require 'yaml'
3
+
4
+ Dir[File.dirname(__FILE__) + '/lime_lm/*.rb'].each { |file| require file }
5
+
6
+ module LimeLm
7
+ # Configuration defaults, TO set if a demo environment is available on the future
8
+ @@config = { api_key: '', version_id: '' }
9
+ @@valid_config_keys = @@config.keys
10
+
11
+ class << self
12
+ def configure(opts = {})
13
+ opts.each {|k,v| @@config[k.to_sym] = v if @@valid_config_keys.include? k.to_sym}
14
+ end
15
+
16
+ def configure_with(path_to_yaml_file)
17
+ config = YAML::load(IO.read(path_to_yaml_file))
18
+ rescue Errno::ENOENT
19
+ log(:warning, "YAML configuration file couldn't be found. Using defaults."); return
20
+ rescue Psych::SyntaxError
21
+ log(:warning, "YAML configuration file contains invalid syntax. Using defaults."); return
22
+ else
23
+ configure(config)
24
+ end
25
+
26
+ def config
27
+ @@config
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,89 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: limelm 0.1.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "limelm"
9
+ s.version = "0.1.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Damien Imberdis"]
14
+ s.date = "2015-03-04"
15
+ s.description = "limelm is a Ruby wrapper for the LimeLM JSON API. LimeLM is a powerfull Licence and Online Activation Manager"
16
+ s.email = "imberdis.damien@gmail.com"
17
+ s.extra_rdoc_files = [
18
+ "LICENSE.txt",
19
+ "README.md"
20
+ ]
21
+ s.files = [
22
+ ".document",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE.txt",
26
+ "README.md",
27
+ "Rakefile",
28
+ "TODO.md",
29
+ "VERSION",
30
+ "lib/lime_lm/connection.rb",
31
+ "lib/lime_lm/exceptions.rb",
32
+ "lib/lime_lm/feature.rb",
33
+ "lib/lime_lm/key.rb",
34
+ "lib/lime_lm/utils.rb",
35
+ "lib/limelm.rb",
36
+ "limelm.gemspec",
37
+ "spec/fixtures/dish_cassettes/all_features.yml",
38
+ "spec/fixtures/dish_cassettes/create_custom_feature.yml",
39
+ "spec/fixtures/dish_cassettes/create_detailed_key.yml",
40
+ "spec/fixtures/dish_cassettes/create_key_default_configuration.yml",
41
+ "spec/fixtures/dish_cassettes/create_key_new_version.yml",
42
+ "spec/fixtures/dish_cassettes/create_keys_with_email.yml",
43
+ "spec/fixtures/dish_cassettes/create_product_default_feature.yml",
44
+ "spec/fixtures/dish_cassettes/default_search.yml",
45
+ "spec/fixtures/dish_cassettes/default_search_pagination.yml",
46
+ "spec/fixtures/dish_cassettes/destroy_feature.yml",
47
+ "spec/fixtures/dish_cassettes/destroy_key.yml",
48
+ "spec/fixtures/dish_cassettes/destroy_random_key.yml",
49
+ "spec/fixtures/dish_cassettes/details_for_a_given_key.yml",
50
+ "spec/fixtures/dish_cassettes/details_for_a_given_key_with_tags.yml",
51
+ "spec/fixtures/dish_cassettes/find_keys_by_email.yml",
52
+ "spec/fixtures/dish_cassettes/id_for_a_given_key.yml",
53
+ "spec/fixtures/dish_cassettes/remove_tag_for_a_given_key.yml",
54
+ "spec/fixtures/dish_cassettes/revoke_key.yml",
55
+ "spec/fixtures/dish_cassettes/set_tags_for_a_given_key.yml",
56
+ "spec/fixtures/dish_cassettes/unrevoke_key.yml",
57
+ "spec/fixtures/dish_cassettes/update_custom_feature.yml",
58
+ "spec/lib/lime_lm/feature_spec.rb",
59
+ "spec/lib/lime_lm/key_spec.rb",
60
+ "spec/lib/limelm_spec.rb",
61
+ "spec/spec_helper.rb"
62
+ ]
63
+ s.homepage = "http://github.com/dam/limelm"
64
+ s.licenses = ["MIT"]
65
+ s.rubygems_version = "2.2.2"
66
+ s.summary = "limelm is a Ruby wrapper for the LimeLM JSON API"
67
+
68
+ if s.respond_to? :specification_version then
69
+ s.specification_version = 4
70
+
71
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
72
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
73
+ s.add_development_dependency(%q<rdoc>, [">= 0"])
74
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
75
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
76
+ else
77
+ s.add_dependency(%q<httparty>, [">= 0"])
78
+ s.add_dependency(%q<rdoc>, [">= 0"])
79
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
80
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
81
+ end
82
+ else
83
+ s.add_dependency(%q<httparty>, [">= 0"])
84
+ s.add_dependency(%q<rdoc>, [">= 0"])
85
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
86
+ s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
87
+ end
88
+ end
89
+
@@ -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&format=json&method=limelm.feature.getAll&version_id=2
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
+ - Mon, 02 Mar 2015 20:48:12 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - PHPSESSID=ke6eo48cpqivqd61u1pd8r3b54; 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","fields":{"field":[{"id":"1","name":"updates_expires","type":"date_time","ta_readable":"true","required":"false","description":"Date
44
+ when the license key expires."}]}})
45
+ http_version:
46
+ recorded_at: Mon, 02 Mar 2015 20:48:12 GMT
47
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&description=new%20customized%20field&format=json&method=limelm.feature.add&name=customized_plan&required=false&ta_readable=false&type=int&version_id=2
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, 03 Mar 2015 15:19:30 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - PHPSESSID=9snosrjpq96u5tatm54m5n8pv6; 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","feature":{"id":"3"}})
44
+ http_version:
45
+ recorded_at: Tue, 03 Mar 2015 15:19:30 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&deact_limit=2&email=imberdis.damien@gmail.com&format=json&method=limelm.pkey.generate&num_acts=5&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
+ - Mon, 02 Mar 2015 17:39:54 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - PHPSESSID=pt3g74k2rvkoa17p49b8sf8871; 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":{"total":1,"pkey":[{"id":"9","key":"CCCC-EEEE"}]}})
44
+ http_version:
45
+ recorded_at: Mon, 02 Mar 2015 17:39:54 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&format=json&method=limelm.pkey.generate&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
+ - Fri, 27 Feb 2015 15:54:31 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - PHPSESSID=jqhl4rs8bevo8ucpqhqsino9u3; 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":{"total":1,"pkey":[{"id":"9","key":"CCCC-BBBB"}]}})
44
+ http_version:
45
+ recorded_at: Fri, 27 Feb 2015 15:54:31 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&format=json&method=limelm.pkey.generate&version_id=2
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
+ - Mon, 02 Mar 2015 18:25:27 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - PHPSESSID=jrsn6ll5d14p5i2kmahqgv81c2; 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":{"total":1,"pkey":[{"id":"10","key":"EEE-BBB"}]}})
44
+ http_version:
45
+ recorded_at: Mon, 02 Mar 2015 18:25:27 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&email=imberdis.damien@gmail.com&format=json&method=limelm.pkey.generate&num_keys=2&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
+ - Fri, 27 Feb 2015 17:18:00 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - PHPSESSID=r9jcqne1m1323chbso8u053pc0; 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":{"total":"2","pkey":[{"id":"2","key":"ABAB-ABAB"},{"id":"3","key":"BABA-BABA"}]}})
44
+ http_version:
45
+ recorded_at: Fri, 27 Feb 2015 17:18:00 GMT
46
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://wyday.com/limelm/api/rest?api_key=new_key_from_yaml&format=json&method=limelm.feature.add&name=plan&version_id=2
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
+ - Mon, 02 Mar 2015 21:08:39 GMT
25
+ Content-Type:
26
+ - application/json
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Connection:
30
+ - keep-alive
31
+ Set-Cookie:
32
+ - PHPSESSID=06ote6o2v92sjbkrojjfhf49e6; 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","feature":{"id":"2"}})
44
+ http_version:
45
+ recorded_at: Mon, 02 Mar 2015 21:08:39 GMT
46
+ recorded_with: VCR 2.9.3