mashery_rails 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +6 -0
- data/.travis.yml +12 -0
- data/.yardoc/checksums +17 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +21 -0
- data/Gemfile.devtools +55 -0
- data/Gemfile.lock +215 -0
- data/LICENSE.txt +21 -0
- data/README.md +63 -0
- data/Rakefile +9 -0
- data/VERSION +1 -0
- data/config/devtools.yml +2 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/mutant.yml +3 -0
- data/config/reek.yml +103 -0
- data/config/rubocop.yml +58 -0
- data/config/yardstick.yml +2 -0
- data/lib/mashery.rb +55 -0
- data/lib/mashery/config.rb +71 -0
- data/lib/mashery/exceptions.rb +46 -0
- data/lib/mashery/key.rb +7 -0
- data/lib/mashery/local.rb +3 -0
- data/lib/mashery/member.rb +8 -0
- data/lib/mashery/query_builder.rb +173 -0
- data/lib/mashery/rails.rb +19 -0
- data/lib/mashery/rest_client.rb +31 -0
- data/lib/mashery/rest_client/query.rb +77 -0
- data/lib/mashery/rpc_client.rb +58 -0
- data/lib/mashery/rpc_client/base.rb +51 -0
- data/lib/mashery/rpc_client/response.rb +79 -0
- data/lib/mashery/service.rb +9 -0
- data/masheri.gemspec +26 -0
- data/mashery_rails.gemspec +25 -0
- data/spec/fixtures/config.no_host.yml +4 -0
- data/spec/fixtures/config.no_key.yml +4 -0
- data/spec/fixtures/config.no_secret.yml +4 -0
- data/spec/fixtures/config.no_site_id.yml +4 -0
- data/spec/fixtures/config.yml +5 -0
- data/spec/fixtures/services.json +3 -0
- data/spec/mashery/config_spec.rb +38 -0
- data/spec/mashery/member_spec.rb +47 -0
- data/spec/mashery/query_builder_spec.rb +13 -0
- data/spec/mashery/rest_client_spec.rb +47 -0
- data/spec/mashery/rpc_client_spec.rb +28 -0
- data/spec/mashery/service_spec.rb +101 -0
- data/spec/mashery_spec.rb +5 -0
- data/spec/spec_helper.rb +50 -0
- data/tasks/mashery.thor +200 -0
- metadata +147 -0
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/.yardoc/checksums
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
lib/masheri.rb 9d465b90042fec37de2f0e7fa77a7042b389dd86
|
2
|
+
lib/masheri/key.rb fc87e10a825d99aef831f1f6f46e920890eff9f1
|
3
|
+
lib/masheri/role.rb 00f8d2a9ccbc999e5fed4f348775db2ffcc21f86
|
4
|
+
lib/masheri/init.rb b290e7ef24575e16938a46131a8437682667b07c
|
5
|
+
lib/masheri/local.rb 7c338ed2840d2bf55f9f5e4eed04f66c80840eb3
|
6
|
+
lib/masheri/query.rb f3e440a8f96d205a4e297e908c8802926c8aa847
|
7
|
+
lib/masheri/rails.rb 0712d16924b1836ff67370a2de96ce5d867bf08e
|
8
|
+
lib/masheri/config.rb 9a8c734107ec07fffc34bce2d3e0120c90b2fe98
|
9
|
+
lib/masheri/member.rb 3bc2a05700c50eb3a9d6f7057c8e349e99705bd2
|
10
|
+
lib/masheri/service.rb cc4efec266b925af196679a84e50594fdef76c00
|
11
|
+
lib/masheri/rpc_client.rb 77d1517657290a861a428531500bf1a823f9bbd7
|
12
|
+
lib/masheri/exceptions.rb e443e5ee911d77ac23f03805313fbc5b37b60c23
|
13
|
+
lib/masheri/rest_client.rb 3a00255f78dad200ac1dcee5b6b3dde4bf517b05
|
14
|
+
lib/masheri/query_builder.rb 0d283e7212fa919c933ea798b20896d69798e7cd
|
15
|
+
lib/masheri/query_methods.rb c6936596234ad97a8789dc50a116c268ff4b235e
|
16
|
+
lib/masheri/api_object_base.rb c7ecc375eb05cf129a4052f5a56a48df5b92ca7a
|
17
|
+
lib/masheri/rest_client/query.rb 8d28df65a16f5812f9add58c92a2eb886bb35ca5
|
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'activesupport', ">= 3.1.0"
|
4
|
+
gem 'rest-client'
|
5
|
+
gem 'json'
|
6
|
+
|
7
|
+
group :test do
|
8
|
+
gem 'timecop'
|
9
|
+
gem 'pry'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem 'redcarpet'
|
14
|
+
end
|
15
|
+
|
16
|
+
group :development, :test do
|
17
|
+
gem 'devtools', git: 'https://github.com/rom-rb/devtools.git'
|
18
|
+
end
|
19
|
+
|
20
|
+
# Added by devtools
|
21
|
+
eval_gemfile 'Gemfile.devtools'
|
data/Gemfile.devtools
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
gem 'rake', '~> 10.1.0'
|
5
|
+
gem 'rspec', '~> 2.14.1'
|
6
|
+
gem 'yard', '~> 0.8.7'
|
7
|
+
end
|
8
|
+
|
9
|
+
group :yard do
|
10
|
+
gem 'kramdown', '~> 1.2.0'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :guard do
|
14
|
+
gem 'guard', '~> 1.8.1'
|
15
|
+
gem 'guard-bundler', '~> 1.0.0'
|
16
|
+
gem 'guard-rspec', '~> 3.0.2'
|
17
|
+
gem 'guard-rubocop', '~> 0.2.0'
|
18
|
+
gem 'guard-mutant', '~> 0.0.1'
|
19
|
+
|
20
|
+
# file system change event handling
|
21
|
+
gem 'listen', '~> 1.3.0'
|
22
|
+
gem 'rb-fchange', '~> 0.0.6', require: false
|
23
|
+
gem 'rb-fsevent', '~> 0.9.3', require: false
|
24
|
+
gem 'rb-inotify', '~> 0.9.0', require: false
|
25
|
+
|
26
|
+
# notification handling
|
27
|
+
gem 'libnotify', '~> 0.8.0', require: false
|
28
|
+
gem 'rb-notifu', '~> 0.0.4', require: false
|
29
|
+
gem 'terminal-notifier-guard', '~> 1.5.3', require: false
|
30
|
+
end
|
31
|
+
|
32
|
+
group :metrics do
|
33
|
+
gem 'coveralls', '~> 0.6.7'
|
34
|
+
gem 'flay', '~> 2.4.0'
|
35
|
+
gem 'flog', '~> 4.1.1'
|
36
|
+
gem 'reek', '~> 1.3.2'
|
37
|
+
gem 'rubocop', '~> 0.13.0'
|
38
|
+
gem 'simplecov', '~> 0.7.1'
|
39
|
+
gem 'yardstick', '~> 0.9.7', git: 'https://github.com/dkubb/yardstick.git'
|
40
|
+
|
41
|
+
platforms :ruby_19, :ruby_20 do
|
42
|
+
gem 'mutant', git: 'https://github.com/mbj/mutant.git'
|
43
|
+
gem 'yard-spellcheck', '~> 0.1.5'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
group :benchmarks do
|
48
|
+
gem 'rbench', '~> 0.2.3'
|
49
|
+
end
|
50
|
+
|
51
|
+
platform :jruby do
|
52
|
+
group :jruby do
|
53
|
+
gem 'jruby-openssl', '~> 0.8.5'
|
54
|
+
end
|
55
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,215 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/dkubb/yardstick.git
|
3
|
+
revision: 3c962c99cba0dd7d2d07685354f2bce013c6fb2f
|
4
|
+
specs:
|
5
|
+
yardstick (0.9.7)
|
6
|
+
yard (~> 0.8, >= 0.8.7)
|
7
|
+
|
8
|
+
GIT
|
9
|
+
remote: https://github.com/mbj/mutant.git
|
10
|
+
revision: c121e8b400fbbb74684c9bb17a9695152c8ed76f
|
11
|
+
specs:
|
12
|
+
mutant (0.3.0.rc2)
|
13
|
+
adamantium (~> 0.1.0)
|
14
|
+
anima (~> 0.1.1)
|
15
|
+
concord (~> 0.1.4)
|
16
|
+
descendants_tracker (~> 0.0.1)
|
17
|
+
equalizer (~> 0.0.7)
|
18
|
+
ice_nine (~> 0.8)
|
19
|
+
inflecto (~> 0.0.2)
|
20
|
+
parser (~> 2.0.0.pre7)
|
21
|
+
rspec (~> 2.14.1)
|
22
|
+
unparser (~> 0.1.1)
|
23
|
+
|
24
|
+
GIT
|
25
|
+
remote: https://github.com/rom-rb/devtools.git
|
26
|
+
revision: 6d076af50d8134d77e90119bba8c416a1164d886
|
27
|
+
specs:
|
28
|
+
devtools (0.0.2)
|
29
|
+
|
30
|
+
GEM
|
31
|
+
remote: http://rubygems.org/
|
32
|
+
specs:
|
33
|
+
abstract_type (0.0.6)
|
34
|
+
activesupport (4.0.0)
|
35
|
+
i18n (~> 0.6, >= 0.6.4)
|
36
|
+
minitest (~> 4.2)
|
37
|
+
multi_json (~> 1.3)
|
38
|
+
thread_safe (~> 0.1)
|
39
|
+
tzinfo (~> 0.3.37)
|
40
|
+
adamantium (0.1.0)
|
41
|
+
ice_nine (~> 0.9)
|
42
|
+
thread_safe (~> 0.1.2)
|
43
|
+
anima (0.1.1)
|
44
|
+
abstract_type (~> 0.0.6)
|
45
|
+
adamantium (~> 0.1.0)
|
46
|
+
equalizer (~> 0.0.7)
|
47
|
+
ast (1.1.0)
|
48
|
+
atomic (1.1.13)
|
49
|
+
backports (3.3.3)
|
50
|
+
coderay (1.0.9)
|
51
|
+
concord (0.1.4)
|
52
|
+
adamantium (~> 0.1)
|
53
|
+
equalizer (~> 0.0.7)
|
54
|
+
coveralls (0.6.9)
|
55
|
+
multi_json (~> 1.3)
|
56
|
+
rest-client
|
57
|
+
simplecov (>= 0.7)
|
58
|
+
term-ansicolor
|
59
|
+
thor
|
60
|
+
descendants_tracker (0.0.1)
|
61
|
+
diff-lcs (1.2.4)
|
62
|
+
equalizer (0.0.7)
|
63
|
+
ffi (1.9.0)
|
64
|
+
ffi-hunspell (0.3.0)
|
65
|
+
ffi (~> 1.0)
|
66
|
+
flay (2.4.0)
|
67
|
+
ruby_parser (~> 3.0)
|
68
|
+
sexp_processor (~> 4.0)
|
69
|
+
flog (4.1.2)
|
70
|
+
ruby_parser (~> 3.1, > 3.1.0)
|
71
|
+
sexp_processor (~> 4.0)
|
72
|
+
formatador (0.2.4)
|
73
|
+
guard (1.8.2)
|
74
|
+
formatador (>= 0.2.4)
|
75
|
+
listen (>= 1.0.0)
|
76
|
+
lumberjack (>= 1.0.2)
|
77
|
+
pry (>= 0.9.10)
|
78
|
+
thor (>= 0.14.6)
|
79
|
+
guard-bundler (1.0.0)
|
80
|
+
bundler (~> 1.0)
|
81
|
+
guard (~> 1.1)
|
82
|
+
guard-mutant (0.0.1)
|
83
|
+
guard (~> 1.8)
|
84
|
+
inflecto (~> 0.0.2)
|
85
|
+
mutant (~> 0.3.0.beta15)
|
86
|
+
guard-rspec (3.0.3)
|
87
|
+
guard (>= 1.8)
|
88
|
+
rspec (~> 2.13)
|
89
|
+
guard-rubocop (0.2.2)
|
90
|
+
guard (~> 1.8)
|
91
|
+
rubocop (~> 0.10)
|
92
|
+
i18n (0.6.5)
|
93
|
+
ice_nine (0.9.0)
|
94
|
+
inflecto (0.0.2)
|
95
|
+
json (1.8.0)
|
96
|
+
kramdown (1.2.0)
|
97
|
+
libnotify (0.8.2)
|
98
|
+
ffi (>= 1.0.11)
|
99
|
+
listen (1.3.1)
|
100
|
+
rb-fsevent (>= 0.9.3)
|
101
|
+
rb-inotify (>= 0.9)
|
102
|
+
rb-kqueue (>= 0.2)
|
103
|
+
lumberjack (1.0.4)
|
104
|
+
method_source (0.8.2)
|
105
|
+
mime-types (1.25)
|
106
|
+
minitest (4.7.5)
|
107
|
+
multi_json (1.7.9)
|
108
|
+
parser (2.0.0.pre7)
|
109
|
+
ast (~> 1.1)
|
110
|
+
slop (~> 3.4, >= 3.4.5)
|
111
|
+
powerpack (0.0.8)
|
112
|
+
pry (0.9.12.2)
|
113
|
+
coderay (~> 1.0.5)
|
114
|
+
method_source (~> 0.8)
|
115
|
+
slop (~> 3.4)
|
116
|
+
rainbow (1.1.4)
|
117
|
+
rake (10.1.0)
|
118
|
+
rb-fchange (0.0.6)
|
119
|
+
ffi
|
120
|
+
rb-fsevent (0.9.3)
|
121
|
+
rb-inotify (0.9.2)
|
122
|
+
ffi (>= 0.5.0)
|
123
|
+
rb-kqueue (0.2.0)
|
124
|
+
ffi (>= 0.5.0)
|
125
|
+
rb-notifu (0.0.4)
|
126
|
+
rbench (0.2.3)
|
127
|
+
redcarpet (3.0.0)
|
128
|
+
reek (1.3.3)
|
129
|
+
ruby2ruby (~> 2.0.2)
|
130
|
+
ruby_parser (~> 3.1, >= 3.1.1)
|
131
|
+
sexp_processor
|
132
|
+
rest-client (1.6.7)
|
133
|
+
mime-types (>= 1.16)
|
134
|
+
rspec (2.14.1)
|
135
|
+
rspec-core (~> 2.14.0)
|
136
|
+
rspec-expectations (~> 2.14.0)
|
137
|
+
rspec-mocks (~> 2.14.0)
|
138
|
+
rspec-core (2.14.5)
|
139
|
+
rspec-expectations (2.14.2)
|
140
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
141
|
+
rspec-mocks (2.14.3)
|
142
|
+
rubocop (0.13.0)
|
143
|
+
backports (~> 3.3.3)
|
144
|
+
parser (~> 2.0.0.pre6)
|
145
|
+
powerpack (~> 0.0.6)
|
146
|
+
rainbow (>= 1.1.4)
|
147
|
+
ruby2ruby (2.0.6)
|
148
|
+
ruby_parser (~> 3.1)
|
149
|
+
sexp_processor (~> 4.0)
|
150
|
+
ruby_parser (3.2.2)
|
151
|
+
sexp_processor (~> 4.1)
|
152
|
+
sexp_processor (4.3.0)
|
153
|
+
simplecov (0.7.1)
|
154
|
+
multi_json (~> 1.0)
|
155
|
+
simplecov-html (~> 0.7.1)
|
156
|
+
simplecov-html (0.7.1)
|
157
|
+
slop (3.4.6)
|
158
|
+
term-ansicolor (1.2.2)
|
159
|
+
tins (~> 0.8)
|
160
|
+
terminal-notifier-guard (1.5.3)
|
161
|
+
thor (0.18.1)
|
162
|
+
thread_safe (0.1.2)
|
163
|
+
atomic
|
164
|
+
timecop (0.6.3)
|
165
|
+
tins (0.9.0)
|
166
|
+
tzinfo (0.3.37)
|
167
|
+
unparser (0.1.2)
|
168
|
+
abstract_type (~> 0.0.6)
|
169
|
+
adamantium (~> 0.1.0)
|
170
|
+
concord (~> 0.1.1)
|
171
|
+
equalizer (~> 0.0.7)
|
172
|
+
parser (~> 2.0.0.pre6)
|
173
|
+
yard (0.8.7.1)
|
174
|
+
yard-spellcheck (0.1.5)
|
175
|
+
ffi-hunspell (~> 0.2)
|
176
|
+
yard (~> 0.6)
|
177
|
+
|
178
|
+
PLATFORMS
|
179
|
+
ruby
|
180
|
+
|
181
|
+
DEPENDENCIES
|
182
|
+
activesupport (>= 3.1.0)
|
183
|
+
coveralls (~> 0.6.7)
|
184
|
+
devtools!
|
185
|
+
flay (~> 2.4.0)
|
186
|
+
flog (~> 4.1.1)
|
187
|
+
guard (~> 1.8.1)
|
188
|
+
guard-bundler (~> 1.0.0)
|
189
|
+
guard-mutant (~> 0.0.1)
|
190
|
+
guard-rspec (~> 3.0.2)
|
191
|
+
guard-rubocop (~> 0.2.0)
|
192
|
+
jruby-openssl (~> 0.8.5)
|
193
|
+
json
|
194
|
+
kramdown (~> 1.2.0)
|
195
|
+
libnotify (~> 0.8.0)
|
196
|
+
listen (~> 1.3.0)
|
197
|
+
mutant!
|
198
|
+
pry
|
199
|
+
rake (~> 10.1.0)
|
200
|
+
rb-fchange (~> 0.0.6)
|
201
|
+
rb-fsevent (~> 0.9.3)
|
202
|
+
rb-inotify (~> 0.9.0)
|
203
|
+
rb-notifu (~> 0.0.4)
|
204
|
+
rbench (~> 0.2.3)
|
205
|
+
redcarpet
|
206
|
+
reek (~> 1.3.2)
|
207
|
+
rest-client
|
208
|
+
rspec (~> 2.14.1)
|
209
|
+
rubocop (~> 0.13.0)
|
210
|
+
simplecov (~> 0.7.1)
|
211
|
+
terminal-notifier-guard (~> 1.5.3)
|
212
|
+
timecop
|
213
|
+
yard (~> 0.8.7)
|
214
|
+
yard-spellcheck (~> 0.1.5)
|
215
|
+
yardstick (~> 0.9.7)!
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Farley Knight
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# mashery_rails
|
2
|
+
|
3
|
+
[![Coverage Status](https://coveralls.io/repos/farleyknight/masheri/badge.png)](https://coveralls.io/r/farleyknight/masheri)
|
4
|
+
|
5
|
+
[![Build Status](https://travis-ci.org/farleyknight/mashery_rails.png?branch=master)](https://travis-ci.org/farleyknight/mashery_rails)
|
6
|
+
|
7
|
+
|
8
|
+
A Rails library for the [Mashery API](http://support.mashery.com/docs/mashery_api).
|
9
|
+
|
10
|
+
Includes:
|
11
|
+
|
12
|
+
* `config/mashery.yml` config file
|
13
|
+
* A simple Query generator for the RPC API, and it's SQL-esque syntax
|
14
|
+
* Good test coverage
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Add the following to your `Gemfile`
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem "mashery_rails", require: "mashery"
|
22
|
+
```
|
23
|
+
|
24
|
+
Then run the installer to create `config/mashery.yml`
|
25
|
+
|
26
|
+
```bash
|
27
|
+
$ rails g mashery:install
|
28
|
+
```
|
29
|
+
|
30
|
+
## Configuration
|
31
|
+
|
32
|
+
Edit `config/mashery.yml` with your `site_key`, `key` and `secret` options.
|
33
|
+
|
34
|
+
```yaml
|
35
|
+
---
|
36
|
+
site_id: '123'
|
37
|
+
key: "abc"
|
38
|
+
secret: "xyz"
|
39
|
+
host: "api.mashery.com"
|
40
|
+
```
|
41
|
+
|
42
|
+
Note this doesn't distinguish between development, testing, production, etc. If you really need that functionality, open a new issue.
|
43
|
+
|
44
|
+
## Usage
|
45
|
+
|
46
|
+
The central data objects are all listed on the [RPC API documentation page](http://support.mashery.com/docs/read/mashery_api/20/API_Objects), and should be supported. However, [fetching objects](http://support.mashery.com/docs/read/mashery_api/20/Fetching_Objects) are the main & typically only supported method for each of these objects. If you feel you want to support more methods, feel free to create a pull request.
|
47
|
+
|
48
|
+
|
49
|
+
### `all`
|
50
|
+
|
51
|
+
Fetch all objects of a particular type.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
Mashery::Member.all #=>
|
55
|
+
```
|
56
|
+
|
57
|
+
### `first`
|
58
|
+
|
59
|
+
Fetch the first object of a particular type.
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
Mashery::Member.first #=>
|
63
|
+
```
|
data/Rakefile
ADDED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.6.2
|
data/config/devtools.yml
ADDED