mortar-api-ruby 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mortar/api.rb +0 -1
- data/lib/mortar/api/version.rb +1 -1
- data/mortar-api-ruby.gemspec +2 -1
- metadata +7 -25
- data/lib/mortar/api/fixtures.rb +0 -56
- data/spec/mortar/api/fixtures_spec.rb +0 -79
data/lib/mortar/api.rb
CHANGED
data/lib/mortar/api/version.rb
CHANGED
data/mortar-api-ruby.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.add_development_dependency 'gem-release'
|
25
25
|
gem.add_development_dependency 'rake'
|
26
26
|
gem.add_development_dependency "rr"
|
27
|
-
|
27
|
+
# Use latest 2.x for rspec. 3.x breaks test configuration and various assertions
|
28
|
+
gem.add_development_dependency "rspec", '~>2.0'
|
28
29
|
|
29
30
|
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.8.
|
4
|
+
version: 0.8.4
|
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: 2014-
|
12
|
+
date: 2014-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -80,17 +80,17 @@ dependencies:
|
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
81
81
|
none: false
|
82
82
|
requirements:
|
83
|
-
- -
|
83
|
+
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
85
|
+
version: '2.0'
|
86
86
|
type: :development
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
89
|
none: false
|
90
90
|
requirements:
|
91
|
-
- -
|
91
|
+
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
93
|
+
version: '2.0'
|
94
94
|
description: Client for Mortar API.
|
95
95
|
email: support@mortardata.com
|
96
96
|
executables: []
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- lib/mortar/api/config.rb
|
113
113
|
- lib/mortar/api/describe.rb
|
114
114
|
- lib/mortar/api/errors.rb
|
115
|
-
- lib/mortar/api/fixtures.rb
|
116
115
|
- lib/mortar/api/illustrate.rb
|
117
116
|
- lib/mortar/api/jobs.rb
|
118
117
|
- lib/mortar/api/login.rb
|
@@ -128,7 +127,6 @@ files:
|
|
128
127
|
- spec/mortar/api/config_spec.rb
|
129
128
|
- spec/mortar/api/describe_spec.rb
|
130
129
|
- spec/mortar/api/errors_spec.rb
|
131
|
-
- spec/mortar/api/fixtures_spec.rb
|
132
130
|
- spec/mortar/api/illustrate_spec.rb
|
133
131
|
- spec/mortar/api/jobs_spec.rb
|
134
132
|
- spec/mortar/api/login_spec.rb
|
@@ -163,20 +161,4 @@ rubygems_version: 1.8.24
|
|
163
161
|
signing_key:
|
164
162
|
specification_version: 3
|
165
163
|
summary: Client for Mortar API
|
166
|
-
test_files:
|
167
|
-
- spec/mortar/api/basicauth_spec.rb
|
168
|
-
- spec/mortar/api/clusters_spec.rb
|
169
|
-
- spec/mortar/api/config_spec.rb
|
170
|
-
- spec/mortar/api/describe_spec.rb
|
171
|
-
- spec/mortar/api/errors_spec.rb
|
172
|
-
- spec/mortar/api/fixtures_spec.rb
|
173
|
-
- spec/mortar/api/illustrate_spec.rb
|
174
|
-
- spec/mortar/api/jobs_spec.rb
|
175
|
-
- spec/mortar/api/login_spec.rb
|
176
|
-
- spec/mortar/api/projects_spec.rb
|
177
|
-
- spec/mortar/api/tasks_spec.rb
|
178
|
-
- spec/mortar/api/user_spec.rb
|
179
|
-
- spec/mortar/api/validate_spec.rb
|
180
|
-
- spec/mortar/api_spec.rb
|
181
|
-
- spec/spec.opts
|
182
|
-
- spec/spec_helper.rb
|
164
|
+
test_files: []
|
data/lib/mortar/api/fixtures.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2012 Mortar Data Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require 'set'
|
18
|
-
|
19
|
-
module Mortar
|
20
|
-
class API
|
21
|
-
module Fixtures
|
22
|
-
STATUS_GATEWAY_STARTING = 'GATEWAY_STARTING'
|
23
|
-
STATUS_PENDING = 'PENDING'
|
24
|
-
STATUS_CREATING = 'CREATING'
|
25
|
-
STATUS_SAVING = 'SAVING'
|
26
|
-
STATUS_CREATED = 'CREATED'
|
27
|
-
STATUS_FAILED = 'FAILED'
|
28
|
-
|
29
|
-
STATUSES_COMPLETE = Set.new([STATUS_CREATED,
|
30
|
-
STATUS_FAILED])
|
31
|
-
end
|
32
|
-
|
33
|
-
# GET /vX/fixtures/:fixture
|
34
|
-
def get_fixture(fixture_id)
|
35
|
-
request(
|
36
|
-
:expects => 200,
|
37
|
-
:idempotent => true,
|
38
|
-
:method => :get,
|
39
|
-
:path => versioned_path("/fixtures/#{fixture_id}")
|
40
|
-
)
|
41
|
-
end
|
42
|
-
|
43
|
-
# POST /vX/fixtures
|
44
|
-
def post_fixture_limit(project_name, fixture_name, input_url, num_rows)
|
45
|
-
request(
|
46
|
-
:expects => 200,
|
47
|
-
:method => :post,
|
48
|
-
:path => versioned_path("/fixtures"),
|
49
|
-
:body => json_encode({"fixture_name" => fixture_name,
|
50
|
-
"project_name" => project_name,
|
51
|
-
"s3_url" => input_url,
|
52
|
-
"num_rows" => num_rows})
|
53
|
-
)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright 2012 Mortar Data Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require "base64"
|
18
|
-
require "spec_helper"
|
19
|
-
require "mortar/api"
|
20
|
-
|
21
|
-
|
22
|
-
describe Mortar::API do
|
23
|
-
|
24
|
-
before(:each) do
|
25
|
-
@api = Mortar::API.new
|
26
|
-
end
|
27
|
-
|
28
|
-
after(:each) do
|
29
|
-
Excon.stubs.clear
|
30
|
-
end
|
31
|
-
|
32
|
-
context "fixtures" do
|
33
|
-
|
34
|
-
it "gets a fixture" do
|
35
|
-
account_id = "123456780aaaaaa123456780aaaaaabb"
|
36
|
-
project_name = "MyProject"
|
37
|
-
project_id = "aaaaasssss"
|
38
|
-
fixture_id = "12345123412abcd12345123412abcdef"
|
39
|
-
fixture = {'name' => "Some fixture",
|
40
|
-
'fixture_id' => fixture_id,
|
41
|
-
'account_id' => account_id,
|
42
|
-
'project_id' => project_id,
|
43
|
-
'status_code' => Mortar::API::Fixtures::STATUS_CREATED,
|
44
|
-
'status_description' => "Some Status Description",
|
45
|
-
'sample_s3_urls' => [ {'url' => "https://some_url_1",
|
46
|
-
'name' => "url1"},
|
47
|
-
{'url' => "https://some_url_2",
|
48
|
-
'name' => "url2"}]
|
49
|
-
}
|
50
|
-
Excon.stub({:method => :get, :path => "/v2/fixtures/#{fixture_id}"}) do |params|
|
51
|
-
{:body => Mortar::API::OkJson.encode(fixture),
|
52
|
-
:status => 200}
|
53
|
-
end
|
54
|
-
response = @api.get_fixture(fixture_id)
|
55
|
-
response.body['name'].should == fixture['name']
|
56
|
-
response.body['status'].should == fixture['status']
|
57
|
-
response.body['sample_s3_urls'].count.should == 2
|
58
|
-
end
|
59
|
-
|
60
|
-
it "posts a limit fixture" do
|
61
|
-
fixture_name = "some_fixture"
|
62
|
-
s3_url = "some_s3_url"
|
63
|
-
num_rows = 100
|
64
|
-
project_name = "ProjectName"
|
65
|
-
fixture_id = "12345123412abcd12345123412abcdef"
|
66
|
-
|
67
|
-
body = Mortar::API::OkJson.encode({"fixture_name" => fixture_name,
|
68
|
-
"project_name" => project_name,
|
69
|
-
"s3_url" => s3_url,
|
70
|
-
"num_rows" => num_rows})
|
71
|
-
Excon.stub({:method => :post, :path => "/v2/fixtures", :body => body}) do |params|
|
72
|
-
{:body => Mortar::API::OkJson.encode({"fixture_id" => fixture_id}), :status => 200}
|
73
|
-
end
|
74
|
-
response = @api.post_fixture_limit(project_name, fixture_name, s3_url, num_rows)
|
75
|
-
response.body['fixture_id'].should == fixture_id
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
79
|
-
end
|