limelm 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +75 -0
- data/LICENSE.txt +20 -0
- data/README.md +75 -0
- data/Rakefile +50 -0
- data/TODO.md +10 -0
- data/VERSION +1 -0
- data/lib/lime_lm/connection.rb +23 -0
- data/lib/lime_lm/exceptions.rb +6 -0
- data/lib/lime_lm/feature.rb +62 -0
- data/lib/lime_lm/key.rb +83 -0
- data/lib/lime_lm/utils.rb +7 -0
- data/lib/limelm.rb +30 -0
- data/limelm.gemspec +89 -0
- data/spec/fixtures/dish_cassettes/all_features.yml +47 -0
- data/spec/fixtures/dish_cassettes/create_custom_feature.yml +46 -0
- data/spec/fixtures/dish_cassettes/create_detailed_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/create_key_default_configuration.yml +46 -0
- data/spec/fixtures/dish_cassettes/create_key_new_version.yml +46 -0
- data/spec/fixtures/dish_cassettes/create_keys_with_email.yml +46 -0
- data/spec/fixtures/dish_cassettes/create_product_default_feature.yml +46 -0
- data/spec/fixtures/dish_cassettes/default_search.yml +46 -0
- data/spec/fixtures/dish_cassettes/default_search_pagination.yml +46 -0
- data/spec/fixtures/dish_cassettes/destroy_feature.yml +46 -0
- data/spec/fixtures/dish_cassettes/destroy_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/destroy_random_key.yml +47 -0
- data/spec/fixtures/dish_cassettes/details_for_a_given_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/details_for_a_given_key_with_tags.yml +46 -0
- data/spec/fixtures/dish_cassettes/find_keys_by_email.yml +46 -0
- data/spec/fixtures/dish_cassettes/id_for_a_given_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/remove_tag_for_a_given_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/revoke_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/set_tags_for_a_given_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/unrevoke_key.yml +46 -0
- data/spec/fixtures/dish_cassettes/update_custom_feature.yml +46 -0
- data/spec/lib/lime_lm/feature_spec.rb +86 -0
- data/spec/lib/lime_lm/key_spec.rb +212 -0
- data/spec/lib/limelm_spec.rb +37 -0
- data/spec/spec_helper.rb +70 -0
- metadata +142 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
SUPPORT_ROOT = File.expand_path("../support", File.dirname(__FILE__))
|
3
|
+
|
4
|
+
describe LimeLm do
|
5
|
+
before do
|
6
|
+
@conf = { api_key: '123', version_id: '100' }
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '.config' do
|
10
|
+
it 'returns a default configuration to a LimeLM demo environment' do
|
11
|
+
config = LimeLm.config
|
12
|
+
assert !config.empty?
|
13
|
+
assert_equal LimeLm.class_variable_get(:@@valid_config_keys), config.keys
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '.configure' do
|
18
|
+
it 'configures the module passing a hash' do
|
19
|
+
LimeLm.configure(@conf)
|
20
|
+
assert_equal @conf, LimeLm.config
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'rejects unexpected keys' do
|
24
|
+
LimeLm.configure(@conf.merge({ unexpected: '234' }))
|
25
|
+
assert_equal @conf, LimeLm.config
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '.configure_with' do
|
30
|
+
it 'configures the module through a yaml file' do
|
31
|
+
LimeLm.configure_with("#{SUPPORT_ROOT}/conf.yml")
|
32
|
+
config = LimeLm.config
|
33
|
+
assert_equal 'new_key_from_yaml', config[:api_key]
|
34
|
+
assert_equal '1', config[:version_id]
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
SPEC_ROOT = File.dirname(__FILE__)
|
2
|
+
GEM_ROOT = File.expand_path("..", SPEC_ROOT)
|
3
|
+
|
4
|
+
require 'simplecov'
|
5
|
+
|
6
|
+
module SimpleCov::Configuration
|
7
|
+
def clean_filters
|
8
|
+
@filters = []
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
SimpleCov.configure do
|
13
|
+
clean_filters
|
14
|
+
load_profile 'test_frameworks'
|
15
|
+
end
|
16
|
+
|
17
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
18
|
+
add_filter "/.rvm/"
|
19
|
+
add_filter "/.rbenv/"
|
20
|
+
add_filter "/.bundle/"
|
21
|
+
end
|
22
|
+
require 'rubygems'
|
23
|
+
require 'bundler'
|
24
|
+
begin
|
25
|
+
Bundler.setup(:default, :development)
|
26
|
+
rescue Bundler::BundlerError => e
|
27
|
+
$stderr.puts e.message
|
28
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
29
|
+
exit e.status_code
|
30
|
+
end
|
31
|
+
require 'minitest/autorun'
|
32
|
+
require 'webmock/minitest'
|
33
|
+
require 'vcr'
|
34
|
+
|
35
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
36
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
37
|
+
require 'limelm'
|
38
|
+
|
39
|
+
# Support methods
|
40
|
+
Dir["#{SPEC_ROOT}/support/**/*.rb"].each { |f| require f }
|
41
|
+
|
42
|
+
# VCR configuration
|
43
|
+
VCR.configure do |c|
|
44
|
+
c.cassette_library_dir = "#{SPEC_ROOT}/fixtures/dish_cassettes"
|
45
|
+
c.hook_into :webmock
|
46
|
+
end
|
47
|
+
|
48
|
+
module LimeLmConfigurationSetup
|
49
|
+
def before_setup
|
50
|
+
super
|
51
|
+
|
52
|
+
# NOTE: As LimeLM doesn't provide a demo environment, we have to make the following tricks:
|
53
|
+
# 1) Add personal credentials configuration to the file conf.yml, verify that this file is not version controlled
|
54
|
+
# 2) Run your tests with the environment variable MODE sets to 'live': bundle exec rake spec MODE=live
|
55
|
+
# 3) The HTTP request succeed and are regitered by VCR as fixtures
|
56
|
+
# 4) Anonymize each new created VCR fixtures with the credentials available under spec/support/config.yml
|
57
|
+
# + don't forget to anonymize each creadentials presents in the API response
|
58
|
+
# 5) Add the option match_requests_on: [:path] to the VCR#use_cassette method to lock the fixture on next live MODE
|
59
|
+
# 6) Run the testing without the MODE environment variable, the fixtures should works
|
60
|
+
if ENV['MODE'] == 'live' && File.exist?("#{GEM_ROOT}/conf.yml")
|
61
|
+
LimeLm.configure_with("#{GEM_ROOT}/conf.yml")
|
62
|
+
else
|
63
|
+
LimeLm.configure_with("#{SPEC_ROOT}/support/conf.yml")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class MiniTest::Unit::TestCase
|
69
|
+
include LimeLmConfigurationSetup
|
70
|
+
end
|
metadata
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: limelm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Damien Imberdis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jeweler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.1
|
69
|
+
description: limelm is a Ruby wrapper for the LimeLM JSON API. LimeLM is a powerfull
|
70
|
+
Licence and Online Activation Manager
|
71
|
+
email: imberdis.damien@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files:
|
75
|
+
- LICENSE.txt
|
76
|
+
- README.md
|
77
|
+
files:
|
78
|
+
- ".document"
|
79
|
+
- Gemfile
|
80
|
+
- Gemfile.lock
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- TODO.md
|
85
|
+
- VERSION
|
86
|
+
- lib/lime_lm/connection.rb
|
87
|
+
- lib/lime_lm/exceptions.rb
|
88
|
+
- lib/lime_lm/feature.rb
|
89
|
+
- lib/lime_lm/key.rb
|
90
|
+
- lib/lime_lm/utils.rb
|
91
|
+
- lib/limelm.rb
|
92
|
+
- limelm.gemspec
|
93
|
+
- spec/fixtures/dish_cassettes/all_features.yml
|
94
|
+
- spec/fixtures/dish_cassettes/create_custom_feature.yml
|
95
|
+
- spec/fixtures/dish_cassettes/create_detailed_key.yml
|
96
|
+
- spec/fixtures/dish_cassettes/create_key_default_configuration.yml
|
97
|
+
- spec/fixtures/dish_cassettes/create_key_new_version.yml
|
98
|
+
- spec/fixtures/dish_cassettes/create_keys_with_email.yml
|
99
|
+
- spec/fixtures/dish_cassettes/create_product_default_feature.yml
|
100
|
+
- spec/fixtures/dish_cassettes/default_search.yml
|
101
|
+
- spec/fixtures/dish_cassettes/default_search_pagination.yml
|
102
|
+
- spec/fixtures/dish_cassettes/destroy_feature.yml
|
103
|
+
- spec/fixtures/dish_cassettes/destroy_key.yml
|
104
|
+
- spec/fixtures/dish_cassettes/destroy_random_key.yml
|
105
|
+
- spec/fixtures/dish_cassettes/details_for_a_given_key.yml
|
106
|
+
- spec/fixtures/dish_cassettes/details_for_a_given_key_with_tags.yml
|
107
|
+
- spec/fixtures/dish_cassettes/find_keys_by_email.yml
|
108
|
+
- spec/fixtures/dish_cassettes/id_for_a_given_key.yml
|
109
|
+
- spec/fixtures/dish_cassettes/remove_tag_for_a_given_key.yml
|
110
|
+
- spec/fixtures/dish_cassettes/revoke_key.yml
|
111
|
+
- spec/fixtures/dish_cassettes/set_tags_for_a_given_key.yml
|
112
|
+
- spec/fixtures/dish_cassettes/unrevoke_key.yml
|
113
|
+
- spec/fixtures/dish_cassettes/update_custom_feature.yml
|
114
|
+
- spec/lib/lime_lm/feature_spec.rb
|
115
|
+
- spec/lib/lime_lm/key_spec.rb
|
116
|
+
- spec/lib/limelm_spec.rb
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
homepage: http://github.com/dam/limelm
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.2.2
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: limelm is a Ruby wrapper for the LimeLM JSON API
|
142
|
+
test_files: []
|