mortar-api-ruby 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/lib/mortar/api/projects.rb +6 -2
- data/lib/mortar/api/version.rb +1 -1
- data/spec/mortar/api/projects_spec.rb +14 -2
- metadata +3 -3
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm use 1.
|
1
|
+
rvm use 1.9.3@mortarddaniels20131120 --create
|
data/lib/mortar/api/projects.rb
CHANGED
@@ -50,12 +50,16 @@ module Mortar
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# POST /vX/projects
|
53
|
-
def post_project(project_name)
|
53
|
+
def post_project(project_name, is_private = true)
|
54
|
+
payload = {
|
55
|
+
"project_name" => project_name,
|
56
|
+
"is_private" => is_private
|
57
|
+
}
|
54
58
|
request(
|
55
59
|
:expects => 200,
|
56
60
|
:method => :post,
|
57
61
|
:path => versioned_path("/projects"),
|
58
|
-
:body => json_encode(
|
62
|
+
:body => json_encode(payload)
|
59
63
|
)
|
60
64
|
end
|
61
65
|
|
data/lib/mortar/api/version.rb
CHANGED
@@ -70,7 +70,7 @@ describe Mortar::API do
|
|
70
70
|
it "posts a project" do
|
71
71
|
project_name = "my_new_project"
|
72
72
|
project_id = "7b93e4d3ab034188a0c2be418d3d24ed"
|
73
|
-
body = Mortar::API::OkJson.encode({"project_name" => project_name})
|
73
|
+
body = Mortar::API::OkJson.encode({"project_name" => project_name, "is_private" => true})
|
74
74
|
Excon.stub({:method => :post, :path => "/v2/projects", :body => body}) do |params|
|
75
75
|
{:body => Mortar::API::OkJson.encode({'project_name' => project_name, "project_id" => project_id}), :status => 200}
|
76
76
|
end
|
@@ -78,6 +78,18 @@ describe Mortar::API do
|
|
78
78
|
response.body['project_id'].should == project_id
|
79
79
|
response.body['project_name'].should == project_name
|
80
80
|
end
|
81
|
+
|
82
|
+
it "posts a public project" do
|
83
|
+
project_name = "my_new_project"
|
84
|
+
project_id = "7b93e4d3ab034188a0c2be418d3d24ed"
|
85
|
+
body = Mortar::API::OkJson.encode({"project_name" => project_name, "is_private" => false})
|
86
|
+
Excon.stub({:method => :post, :path => "/v2/projects", :body => body}) do |params|
|
87
|
+
{:body => Mortar::API::OkJson.encode({'project_name' => project_name, "project_id" => project_id}), :status => 200}
|
88
|
+
end
|
89
|
+
response = @api.post_project(project_name, false)
|
90
|
+
response.body['project_id'].should == project_id
|
91
|
+
response.body['project_name'].should == project_name
|
92
|
+
end
|
81
93
|
|
82
94
|
end
|
83
|
-
end
|
95
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mortar-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2014-01-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
|
-
rubygems_version: 1.8.
|
162
|
+
rubygems_version: 1.8.24
|
163
163
|
signing_key:
|
164
164
|
specification_version: 3
|
165
165
|
summary: Client for Mortar API
|