mashery 0.0.11 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +18 -0
- data/README.textile +5 -0
- data/VERSION +1 -1
- data/lib/mashery.rb +3 -0
- data/lib/mashery/client.rb +4 -2
- data/mashery.gemspec +5 -4
- data/tasks/mashery.thor +2 -1
- metadata +5 -9
data/Gemfile.lock
ADDED
data/README.textile
CHANGED
@@ -26,6 +26,11 @@ bc. $ export MASHERY_SITE_ID=666
|
|
26
26
|
$ export MASHERY_API_KEY=cafebebedeadbeefcafebebedeadbeef
|
27
27
|
$ export MASHERY_SHARED_SECRET=blahblahblah
|
28
28
|
|
29
|
+
By default, the thor tasks call methods in the Mashery sandbox. If you want them to access the production environment
|
30
|
+
instead, set the {{MASHERY_PRODUCTION_MODE}} environment variable to any value:
|
31
|
+
|
32
|
+
bc. $ export MASHERY_PRODUCTION_MODE=hi
|
33
|
+
|
29
34
|
h3. Querying objects
|
30
35
|
|
31
36
|
The Mashery API supports querying the following types of objects: "members":http://support.mashery.com/docs/mashery_api/member/, "applications":http://support.mashery.com/docs/mashery_api/application/, "keys":http://support.mashery.com/docs/mashery_api/key/, "services":http://support.mashery.com/docs/mashery_api/service/, and "roles":http://support.mashery.com/docs/mashery_api/role/.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/mashery.rb
CHANGED
data/lib/mashery/client.rb
CHANGED
@@ -6,7 +6,7 @@ require 'md5'
|
|
6
6
|
module Mashery
|
7
7
|
class Client
|
8
8
|
TEST_HOST = 'api.sandbox.mashery.com'
|
9
|
-
PRODUCTION_HOST= 'api.mashery.com'
|
9
|
+
PRODUCTION_HOST = 'api.mashery.com'
|
10
10
|
|
11
11
|
def initialize(site_id, key, secret)
|
12
12
|
host = Mashery.test_mode ? TEST_HOST : PRODUCTION_HOST
|
@@ -21,7 +21,9 @@ module Mashery
|
|
21
21
|
|
22
22
|
def call_remote(method, *params)
|
23
23
|
# all calls are synchronous, so id in request and response will always be 1
|
24
|
-
|
24
|
+
if Mashery.logger
|
25
|
+
Mashery.logger.debug("Calling method #{method} with params #{params.inspect} on URI #{signed_uri}")
|
26
|
+
end
|
25
27
|
req = ::JSON[{:version => '1.1', :method => method, :params => params, :id => 1}]
|
26
28
|
response = HTTParty.post(signed_uri, :body => req)
|
27
29
|
res = ::JSON[response.body]
|
data/mashery.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{mashery}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Brian Moseley"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-10}
|
13
13
|
s.email = %q{brian@outside.in}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.files = [
|
19
19
|
".gitignore",
|
20
20
|
"Gemfile",
|
21
|
+
"Gemfile.lock",
|
21
22
|
"LICENSE.txt",
|
22
23
|
"README.textile",
|
23
24
|
"Rakefile",
|
@@ -36,14 +37,14 @@ Gem::Specification.new do |s|
|
|
36
37
|
s.homepage = %q{http://github.com/outsidein/mashery-rb}
|
37
38
|
s.rdoc_options = ["--charset=UTF-8"]
|
38
39
|
s.require_paths = ["lib"]
|
39
|
-
s.rubygems_version = %q{1.3.
|
40
|
+
s.rubygems_version = %q{1.3.6}
|
40
41
|
s.summary = %q{A Ruby library for the Mashery API}
|
41
42
|
|
42
43
|
if s.respond_to? :specification_version then
|
43
44
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
45
|
s.specification_version = 3
|
45
46
|
|
46
|
-
if Gem::Version.new(Gem::
|
47
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
48
|
else
|
48
49
|
end
|
49
50
|
else
|
data/tasks/mashery.thor
CHANGED
@@ -24,8 +24,9 @@ module Mashery
|
|
24
24
|
raise Exception, "Please set the MASHERY_API_KEY environment variable."
|
25
25
|
secret = ENV['MASHERY_SHARED_SECRET'] or
|
26
26
|
raise Exception, "Please set the MASHERY_SHARED_SECRET environment variable."
|
27
|
-
::Mashery.
|
27
|
+
::Mashery.test_mode = ENV['MASHERY_PRODUCTION_MODE'].blank?
|
28
28
|
::Mashery.logger.level = Logger::DEBUG
|
29
|
+
::Mashery.client = ::Mashery::Client.new(site_id, key, secret)
|
29
30
|
begin
|
30
31
|
yield
|
31
32
|
rescue ::Mashery::JsonRpcException => e
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mashery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 9
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 0
|
7
|
+
- 1
|
8
8
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.11
|
9
|
+
version: 0.1.0
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Brian Moseley
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-09-10 00:00:00 -04:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -31,6 +30,7 @@ extra_rdoc_files:
|
|
31
30
|
files:
|
32
31
|
- .gitignore
|
33
32
|
- Gemfile
|
33
|
+
- Gemfile.lock
|
34
34
|
- LICENSE.txt
|
35
35
|
- README.textile
|
36
36
|
- Rakefile
|
@@ -55,27 +55,23 @@ rdoc_options:
|
|
55
55
|
require_paths:
|
56
56
|
- lib
|
57
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
58
|
requirements:
|
60
59
|
- - ">="
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
hash: 3
|
63
61
|
segments:
|
64
62
|
- 0
|
65
63
|
version: "0"
|
66
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
65
|
requirements:
|
69
66
|
- - ">="
|
70
67
|
- !ruby/object:Gem::Version
|
71
|
-
hash: 3
|
72
68
|
segments:
|
73
69
|
- 0
|
74
70
|
version: "0"
|
75
71
|
requirements: []
|
76
72
|
|
77
73
|
rubyforge_project:
|
78
|
-
rubygems_version: 1.3.
|
74
|
+
rubygems_version: 1.3.6
|
79
75
|
signing_key:
|
80
76
|
specification_version: 3
|
81
77
|
summary: A Ruby library for the Mashery API
|