mind_meister_client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +104 -0
- data/Rakefile +2 -0
- data/lib/mind_meister_client/api_call_required_error.rb +29 -0
- data/lib/mind_meister_client/request_error.rb +57 -0
- data/lib/mind_meister_client/version.rb +3 -0
- data/lib/mind_meister_client.rb +164 -0
- data/mind_meister_client.gemspec +24 -0
- data/spec/mind_meister_client/requester_spec.rb +58 -0
- data/spec/spec_helper.rb +103 -0
- data/spec/support/.gitkeep +0 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0fc68e40add70b4b0e5e9a7ef1ce6c241c893cc5
|
4
|
+
data.tar.gz: ec3d39648ce2466c105b69fa0c4dee3afefe1c30
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1ca17f57879cc32210dbc53ecce416709d4a8eae8802895343c6be3429ff0d4b3982c36c44da3411aa5030aaf3df7dfddb3b82bcfe4e379332fe284767e17253
|
7
|
+
data.tar.gz: 3431383f4b731e75ccfefd0e34124abcf6423af43cf24dd1c228d3d23015a938a923020aba45e5a595190f34c82e91e444c572b04658246b1689f58a78a604c6
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Mailo Svetel
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
# Mind Meister Ruby client
|
2
|
+
|
3
|
+
Client for API of web based and mobile mind mapping app -- [MindMeister](https://www.mindmeister.com)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'mind_meister_client'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install mind_meister_client
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
I've maid one testing Rails app, and the usage was as follows.
|
24
|
+
|
25
|
+
app/controllers/application_controller.rb
|
26
|
+
~~~ruby
|
27
|
+
before_action :setup_mm_client
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def setup_mm_client
|
32
|
+
@mm_client = MindMeisterClient::Requester.new '1625a1388f512a203faa43e8685bcdde',
|
33
|
+
'2d845879a2f2a3b1'
|
34
|
+
|
35
|
+
@mm_client.auth_token= current_user.mm_auth_token if current_user
|
36
|
+
end
|
37
|
+
~~~
|
38
|
+
(current_user comes from [devise](https://github.com/plataformatec/devise))
|
39
|
+
|
40
|
+
app/controllers/welcome_controller.rb
|
41
|
+
|
42
|
+
~~~ruby
|
43
|
+
def index
|
44
|
+
begin
|
45
|
+
@maps = @mm_client.maps_get_list
|
46
|
+
rescue MindMeisterClient::ApiCallRequiredError => e
|
47
|
+
redirect_to e.api_call_url
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
# MindMeister will point user to this url after successful authorization
|
53
|
+
def callback
|
54
|
+
auth_data = @mm_client.callback params[:frob]
|
55
|
+
|
56
|
+
user = User.find_or_create_by email: auth_data[:auth][:user][:email] do |user|
|
57
|
+
user.mm_auth_token = auth_data[:auth][:token]
|
58
|
+
user.full_name = auth_data[:auth][:user][:fullname]
|
59
|
+
end
|
60
|
+
|
61
|
+
sign_in(:user, user)
|
62
|
+
|
63
|
+
redirect_to 'index'
|
64
|
+
end
|
65
|
+
~~~
|
66
|
+
|
67
|
+
config/routes.rb
|
68
|
+
~~~ruby
|
69
|
+
root 'welcome#index'
|
70
|
+
get 'welcome/callback'
|
71
|
+
|
72
|
+
devise_for :users
|
73
|
+
~~~
|
74
|
+
|
75
|
+
app/views/welcome/index.html.erb
|
76
|
+
~~~erb
|
77
|
+
My maps
|
78
|
+
|
79
|
+
<ul>
|
80
|
+
<% @maps[:maps][:map].each do |map_data| %>
|
81
|
+
<li><%= map_data[:title] %> (ID: <%= map_data[:id] %>)</li>
|
82
|
+
<% end %>
|
83
|
+
</ul>
|
84
|
+
~~~
|
85
|
+
|
86
|
+
And also there was needed migration to adjust scheme for User model
|
87
|
+
~~~ruby
|
88
|
+
def change
|
89
|
+
change_table :users do |t|
|
90
|
+
t.column :mm_auth_token, :string
|
91
|
+
t.column :full_name, :string
|
92
|
+
end
|
93
|
+
end
|
94
|
+
~~~
|
95
|
+
|
96
|
+
This implementation is very far from production-ready, but I hope it'll help as a quick start.
|
97
|
+
|
98
|
+
## Contributing
|
99
|
+
|
100
|
+
1. [Fork it](https://github.com/roolo/mind_meister_client/fork) ( https://github.com/roolo/mind_meister_client/fork )
|
101
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
102
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
103
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
104
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module MindMeisterClient
|
2
|
+
class ApiCallRequiredError < Exception
|
3
|
+
attr_accessor :msg
|
4
|
+
attr_accessor :template
|
5
|
+
attr_accessor :api_call_url
|
6
|
+
|
7
|
+
# @param [String] msg
|
8
|
+
# @param [String] api_call_url
|
9
|
+
def initialize msg, api_call_url
|
10
|
+
@msg = msg
|
11
|
+
@api_call_url = api_call_url
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
setup_template unless @template
|
16
|
+
|
17
|
+
data = {
|
18
|
+
api_call_url: @api_call_url,
|
19
|
+
msg: @msg
|
20
|
+
}
|
21
|
+
|
22
|
+
@template%data
|
23
|
+
end
|
24
|
+
|
25
|
+
def setup_template
|
26
|
+
@template = '%{msg}: %{api_call_url}'
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
module MindMeisterClient
|
2
|
+
class RequestError < Exception
|
3
|
+
# Object not found
|
4
|
+
MM_ERROR_OBJECT_NOT_FOUND = 20
|
5
|
+
# Well...
|
6
|
+
MM_ERROR_REQUIRED_PARAMETER_MISSING = 23
|
7
|
+
# The passed signature was invalid.
|
8
|
+
MM_ERROR_INVALID_SIGNATURE = 96
|
9
|
+
# The call required signing but no signature was sent.
|
10
|
+
MM_ERROR_MISSING_SIGNATURE = 97
|
11
|
+
# The login details or auth token passed were invalid.
|
12
|
+
MM_ERROR_LOGIN_FAILED = 98
|
13
|
+
# The API key passed was not valid or has expired.
|
14
|
+
MM_ERROR_INVALID_API_KEY = 100
|
15
|
+
# The specified frob does not exist or has already been used.
|
16
|
+
MM_ERROR_INVALID_FROB = 108
|
17
|
+
#The requested method was not found.
|
18
|
+
MM_ERROR_METHOD_NOT_FOUND = 112
|
19
|
+
|
20
|
+
attr_accessor :code
|
21
|
+
attr_accessor :msg
|
22
|
+
attr_accessor :provided_data
|
23
|
+
attr_accessor :template
|
24
|
+
|
25
|
+
# @param [String] code
|
26
|
+
# @param [String] msg
|
27
|
+
# @param [Hash] provided_data
|
28
|
+
def initialize code, msg, provided_data
|
29
|
+
@code = code
|
30
|
+
@msg = msg
|
31
|
+
@provided_data = provided_data
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
setup_template unless @template
|
36
|
+
|
37
|
+
data = @provided_data.dup
|
38
|
+
data[:code] = @code
|
39
|
+
data[:msg] = @msg
|
40
|
+
|
41
|
+
@template%data
|
42
|
+
end
|
43
|
+
|
44
|
+
def setup_template
|
45
|
+
@template = '%{code}: %{method} -- %{msg}'
|
46
|
+
case @code.to_i
|
47
|
+
when MM_ERROR_METHOD_NOT_FOUND
|
48
|
+
@template += ' (method name between >s: >%{method}<)'
|
49
|
+
when MM_ERROR_REQUIRED_PARAMETER_MISSING
|
50
|
+
@template += @provided_data.inspect
|
51
|
+
when MM_ERROR_INVALID_FROB
|
52
|
+
@template += ' (provided frob between >s: >%{frob}<)'
|
53
|
+
else
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'mind_meister_client/version'
|
3
|
+
require 'mind_meister_client/request_error'
|
4
|
+
require 'mind_meister_client/api_call_required_error'
|
5
|
+
|
6
|
+
|
7
|
+
# Before using this client you need to register your app at https://www.mindmeister.com/api -- API Keys
|
8
|
+
# For list of all available methods refer to https://www.mindmeister.com/developers/explore
|
9
|
+
module MindMeisterClient
|
10
|
+
class Requester
|
11
|
+
MM_API_SCOPES = %w( auth boundaries connections files folders ideas images maps people realtime reflection tasks
|
12
|
+
test themes user)
|
13
|
+
SERVER_ADDRESS = 'www.mindmeister.com'
|
14
|
+
|
15
|
+
attr_accessor :api_key
|
16
|
+
attr_accessor :auth_token
|
17
|
+
attr_accessor :http_client
|
18
|
+
|
19
|
+
def initialize api_key, secret_key, auth_token = nil
|
20
|
+
@api_key = api_key
|
21
|
+
@auth_token = auth_token
|
22
|
+
@secret_key = secret_key
|
23
|
+
|
24
|
+
init_http_client
|
25
|
+
end
|
26
|
+
|
27
|
+
def init_http_client
|
28
|
+
@http_client = Net::HTTP.new SERVER_ADDRESS, 443
|
29
|
+
@http_client.use_ssl = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# Handles callback call after user of MMC acquired frob
|
33
|
+
#
|
34
|
+
# @param [String] frob
|
35
|
+
#
|
36
|
+
# @return [Hash]
|
37
|
+
def callback frob
|
38
|
+
# Calling MM API to get actual auth_token
|
39
|
+
auth_get_token frob: frob
|
40
|
+
end
|
41
|
+
|
42
|
+
# When calling MM API method, it is expected to be underscore separated and without the initial mm_
|
43
|
+
#
|
44
|
+
# @param [Symbol] id Name of method originally called
|
45
|
+
def method_missing id, *args
|
46
|
+
if api_scope? id
|
47
|
+
api_method_name = prepare_api_method id
|
48
|
+
request api_method_name, *args
|
49
|
+
else
|
50
|
+
super
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Detects if method name seems to be from MM API
|
55
|
+
#
|
56
|
+
# @param [Symbol] ruby_method_name
|
57
|
+
#
|
58
|
+
# @return [TrueClass]
|
59
|
+
def api_scope? ruby_method_name
|
60
|
+
ruby_method_scope = ruby_method_name.to_s.split('_')[0]
|
61
|
+
|
62
|
+
ruby_method_scope && MM_API_SCOPES.include?(ruby_method_scope)
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
# Makes the actual call to MM API
|
67
|
+
#
|
68
|
+
# @raise [MindMeisterClient::ApiCallRequiredError] When no auth_token has been set up
|
69
|
+
# @raise [MindMeisterClient::RequestError] When MM API returns an error
|
70
|
+
#
|
71
|
+
# @param [String] api_method_name
|
72
|
+
#
|
73
|
+
# @return [Hash]
|
74
|
+
def request api_method_name, *args
|
75
|
+
unless @auth_token || api_method_name =~ /auth/
|
76
|
+
raise_auth_token_request
|
77
|
+
end
|
78
|
+
|
79
|
+
if args[0]
|
80
|
+
api_call_params = args[0].merge(api_default_params)
|
81
|
+
else
|
82
|
+
api_call_params = api_default_params
|
83
|
+
end
|
84
|
+
|
85
|
+
api_call_params[:method] = api_method_name
|
86
|
+
|
87
|
+
api_data = JSON.parse http_client.get('/services/rest?' + signed_query_string(api_call_params)).body,
|
88
|
+
symbolize_names: true
|
89
|
+
|
90
|
+
if api_data[:rsp][:stat] == 'fail'
|
91
|
+
raise RequestError.new api_data[:rsp][:err][:code].to_i,
|
92
|
+
api_data[:rsp][:err][:msg],
|
93
|
+
api_call_params
|
94
|
+
else
|
95
|
+
api_data[:rsp]
|
96
|
+
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
# @raise [ApiCallRequiredError] Every day'n'night!
|
101
|
+
def raise_auth_token_request
|
102
|
+
api_call_params = {
|
103
|
+
api_key: @api_key,
|
104
|
+
method: 'mm.auth.getToken',
|
105
|
+
perms: 'read'
|
106
|
+
}
|
107
|
+
raise ApiCallRequiredError.new 'Authentication token missing',
|
108
|
+
'https://%s/services/auth/?%s'%[
|
109
|
+
SERVER_ADDRESS,
|
110
|
+
signed_query_string(api_call_params)
|
111
|
+
]
|
112
|
+
end
|
113
|
+
|
114
|
+
# Bare minimum to send to MM API
|
115
|
+
#
|
116
|
+
# @return [Hash]
|
117
|
+
def api_default_params
|
118
|
+
{ api_key: @api_key,
|
119
|
+
auth_token: @auth_token,
|
120
|
+
response_format: 'json'
|
121
|
+
}
|
122
|
+
end
|
123
|
+
|
124
|
+
# maps_new_from_template -> mm.maps.newFromTemplate
|
125
|
+
#
|
126
|
+
# This is helper for method_missing method of this class
|
127
|
+
#
|
128
|
+
# @param [Symbol] ruby_method_name
|
129
|
+
# @return [String]
|
130
|
+
def prepare_api_method ruby_method_name
|
131
|
+
rmn_parts = ruby_method_name.to_s.split('_')
|
132
|
+
|
133
|
+
'mm.%s.%s%s'%[
|
134
|
+
rmn_parts[0],
|
135
|
+
rmn_parts[1],
|
136
|
+
rmn_parts[2..rmn_parts.length].map(&:capitalize).join('')
|
137
|
+
]
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
# From hash, this methods creates query parameters for API call. This method also appends signature, required by
|
142
|
+
# most of MindMeister API calls.
|
143
|
+
#
|
144
|
+
# More about signing MM API calls at https://www.mindmeister.com/developers/authentication
|
145
|
+
#
|
146
|
+
# @param [Hash] params
|
147
|
+
#
|
148
|
+
# @return [String]
|
149
|
+
def signed_query_string params
|
150
|
+
query_params_joined = params.sort.inject('') { |memo, key|
|
151
|
+
memo += key[0].to_s + key[1].to_s
|
152
|
+
memo
|
153
|
+
}
|
154
|
+
|
155
|
+
signature_data = @secret_key + query_params_joined
|
156
|
+
|
157
|
+
query_string_params = URI.encode_www_form(params)
|
158
|
+
|
159
|
+
signature = Digest::MD5.hexdigest(signature_data)
|
160
|
+
|
161
|
+
query_string_params + '&api_sig=' + signature
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mind_meister_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'mind_meister_client'
|
8
|
+
spec.version = MindMeisterClient::VERSION
|
9
|
+
spec.authors = ['Mailo Svetel']
|
10
|
+
spec.email = ['development@rooland.cz']
|
11
|
+
spec.summary = 'Client for API of web based mind mapping app -- MindMeister'
|
12
|
+
# spec.description = %q{TODO: Write a longer description. Optional.}
|
13
|
+
spec.homepage = 'https://github.com/roolo/mind_meister_client'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.3.0'
|
24
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
describe MindMeisterClient::Requester do
|
2
|
+
subject { MindMeisterClient::Requester.new('1625a1388f512a203faa43e8685bcdde', '2d845879a2f2a3b1') }
|
3
|
+
|
4
|
+
describe '#prepare_api_method' do
|
5
|
+
it 'prepares mm.maps.getList' do
|
6
|
+
expect(subject.prepare_api_method(:maps_get_list)).to eq 'mm.maps.getList'
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'prepares mm.auth.getToken' do
|
10
|
+
expect(subject.prepare_api_method(:auth_get_token)).to eq 'mm.auth.getToken'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'prepares mm.maps.newFromTemplate' do
|
14
|
+
expect(subject.prepare_api_method(:maps_new_from_template)).to eq 'mm.maps.newFromTemplate'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
describe '#api_scope?' do
|
20
|
+
describe 'MM API scopes' do
|
21
|
+
it 'detects MM API scope for maps_get_list' do
|
22
|
+
expect(subject.api_scope?(:maps_get_list)).to be_truthy
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'detects MM API scope for auth_get_token' do
|
26
|
+
expect(subject.api_scope?(:auth_get_token)).to be_truthy
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'detects MM API scope for maps_new_from_template' do
|
30
|
+
expect(subject.api_scope?(:maps_new_from_template)).to be_truthy
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'Ruby methods' do
|
35
|
+
it 'does not detect MM API scope for each_index' do
|
36
|
+
expect(subject.api_scope?(:each_index)).to be_falsey
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'does not detect MM API scope for to_i' do
|
40
|
+
expect(subject.api_scope?(:to_i)).to be_falsey
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
describe '#signed_query_string' do
|
47
|
+
it 'creates correct query string' do
|
48
|
+
new_params = {
|
49
|
+
x: 4,
|
50
|
+
h: 6,
|
51
|
+
a: 10
|
52
|
+
}
|
53
|
+
signed_query = subject.signed_query_string(new_params)
|
54
|
+
|
55
|
+
expect(signed_query).to eq 'x=4&h=6&a=10&api_sig=3d9576c5e7068213a40354db62f9fbc3'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
Bundler.setup
|
3
|
+
|
4
|
+
require 'mind_meister_client'
|
5
|
+
|
6
|
+
Dir['spec/support/*.rb'].each {|file| load file}
|
7
|
+
|
8
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
9
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
10
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
11
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
12
|
+
# files.
|
13
|
+
#
|
14
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
15
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
16
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
17
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
18
|
+
# a separate helper file that requires the additional dependencies and performs
|
19
|
+
# the additional setup, and require it from the spec files that actually need
|
20
|
+
# it.
|
21
|
+
#
|
22
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
23
|
+
# users commonly want.
|
24
|
+
#
|
25
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
26
|
+
RSpec.configure do |config|
|
27
|
+
# rspec-expectations config goes here. You can use an alternate
|
28
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
29
|
+
# assertions if you prefer.
|
30
|
+
config.expect_with :rspec do |expectations|
|
31
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
32
|
+
# and `failure_message` of custom matchers include text for helper methods
|
33
|
+
# defined using `chain`, e.g.:
|
34
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
35
|
+
# # => "be bigger than 2 and smaller than 4"
|
36
|
+
# ...rather than:
|
37
|
+
# # => "be bigger than 2"
|
38
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
42
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
43
|
+
config.mock_with :rspec do |mocks|
|
44
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
45
|
+
# a real object. This is generally recommended, and will default to
|
46
|
+
# `true` in RSpec 4.
|
47
|
+
mocks.verify_partial_doubles = true
|
48
|
+
end
|
49
|
+
|
50
|
+
# The settings below are suggested to provide a good initial experience
|
51
|
+
# with RSpec, but feel free to customize to your heart's content.
|
52
|
+
=begin
|
53
|
+
# These two settings work together to allow you to limit a spec run
|
54
|
+
# to individual examples or groups you care about by tagging them with
|
55
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
56
|
+
# get run.
|
57
|
+
config.filter_run :focus
|
58
|
+
config.run_all_when_everything_filtered = true
|
59
|
+
|
60
|
+
# Allows RSpec to persist some state between runs in order to support
|
61
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
62
|
+
# you configure your source control system to ignore this file.
|
63
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
64
|
+
|
65
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
66
|
+
# recommended. For more details, see:
|
67
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
68
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
69
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
70
|
+
config.disable_monkey_patching!
|
71
|
+
|
72
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
73
|
+
# be too noisy due to issues in dependencies.
|
74
|
+
config.warnings = true
|
75
|
+
|
76
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
77
|
+
# file, and it's useful to allow more verbose output when running an
|
78
|
+
# individual spec file.
|
79
|
+
if config.files_to_run.one?
|
80
|
+
# Use the documentation formatter for detailed output,
|
81
|
+
# unless a formatter has already been configured
|
82
|
+
# (e.g. via a command-line flag).
|
83
|
+
config.default_formatter = 'doc'
|
84
|
+
end
|
85
|
+
|
86
|
+
# Print the 10 slowest examples and example groups at the
|
87
|
+
# end of the spec run, to help surface which specs are running
|
88
|
+
# particularly slow.
|
89
|
+
config.profile_examples = 10
|
90
|
+
|
91
|
+
# Run specs in random order to surface order dependencies. If you find an
|
92
|
+
# order dependency and want to debug it, you can fix the order by providing
|
93
|
+
# the seed, which is printed after each run.
|
94
|
+
# --seed 1234
|
95
|
+
config.order = :random
|
96
|
+
|
97
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
98
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
99
|
+
# test failures related to randomization by passing the same `--seed` value
|
100
|
+
# as the one that triggered the failure.
|
101
|
+
Kernel.srand config.seed
|
102
|
+
=end
|
103
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mind_meister_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mailo Svetel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.3.0
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- development@rooland.cz
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- Gemfile
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- lib/mind_meister_client.rb
|
69
|
+
- lib/mind_meister_client/api_call_required_error.rb
|
70
|
+
- lib/mind_meister_client/request_error.rb
|
71
|
+
- lib/mind_meister_client/version.rb
|
72
|
+
- mind_meister_client.gemspec
|
73
|
+
- spec/mind_meister_client/requester_spec.rb
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
- spec/support/.gitkeep
|
76
|
+
homepage: https://github.com/roolo/mind_meister_client
|
77
|
+
licenses:
|
78
|
+
- MIT
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
requirements: []
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 2.4.6
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
99
|
+
summary: Client for API of web based mind mapping app -- MindMeister
|
100
|
+
test_files:
|
101
|
+
- spec/mind_meister_client/requester_spec.rb
|
102
|
+
- spec/spec_helper.rb
|
103
|
+
- spec/support/.gitkeep
|