asterank-ruby 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +88 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +20 -0
- data/README.md +64 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/asterank-ruby.gemspec +81 -0
- data/lib/asterank-ruby.rb +12 -0
- data/lib/asterank-ruby/api/asterank.rb +9 -0
- data/lib/asterank-ruby/api/kepler.rb +9 -0
- data/lib/asterank-ruby/api/mpc.rb +9 -0
- data/lib/asterank-ruby/api/skymorph.rb +67 -0
- data/lib/asterank-ruby/client.rb +20 -0
- data/lib/asterank-ruby/mongo_party.rb +19 -0
- data/lib/asterank-ruby/version.rb +3 -0
- data/test/helper.rb +34 -0
- data/test/test_asterank.rb +7 -0
- metadata +177 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: ff4bc8701c10ebc1c80a85b6fd451a9a8eeeb04e
|
|
4
|
+
data.tar.gz: 607f9ceefb04cc3c29f218d3da16ab3a3305c85f
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 549670c2620b8110af8860f2fac6fe8b21a34b28ad106f60b484b7cd1f2b25d7ab4cba9e6dd23258777e9a527d5bc7c01a6b7d745d780bfb45e3f159b476e4cb
|
|
7
|
+
data.tar.gz: a462b2ef66ae2ddbb92db8fb896f08b9c5ac5e5b9deaedc52734042f5455f8cf0ebb603e2f20ab12aa6c76a5f5133c847fa2f4bab0e67e0959b05d2216ba1c2c
|
data/.document
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
source "http://rubygems.org"
|
|
2
|
+
# Add dependencies required to use your gem here.
|
|
3
|
+
# Example:
|
|
4
|
+
gem 'httparty', '~> 0.13.0'
|
|
5
|
+
gem 'origin', '~> 2.1.0'
|
|
6
|
+
gem 'activesupport', '~> 4.0.4'
|
|
7
|
+
# Add dependencies to develop your gem here.
|
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
|
9
|
+
group :development do
|
|
10
|
+
gem "shoulda", ">= 0"
|
|
11
|
+
gem "rdoc", "~> 3.12"
|
|
12
|
+
gem "bundler", "~> 1.0"
|
|
13
|
+
gem "jeweler", "~> 2.0.1"
|
|
14
|
+
gem "simplecov", ">= 0"
|
|
15
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
GEM
|
|
2
|
+
remote: http://rubygems.org/
|
|
3
|
+
specs:
|
|
4
|
+
activesupport (4.0.4)
|
|
5
|
+
i18n (~> 0.6, >= 0.6.9)
|
|
6
|
+
minitest (~> 4.2)
|
|
7
|
+
multi_json (~> 1.3)
|
|
8
|
+
thread_safe (~> 0.1)
|
|
9
|
+
tzinfo (~> 0.3.37)
|
|
10
|
+
addressable (2.3.5)
|
|
11
|
+
atomic (1.1.16)
|
|
12
|
+
builder (3.2.2)
|
|
13
|
+
descendants_tracker (0.0.3)
|
|
14
|
+
docile (1.1.3)
|
|
15
|
+
faraday (0.9.0)
|
|
16
|
+
multipart-post (>= 1.2, < 3)
|
|
17
|
+
git (1.2.6)
|
|
18
|
+
github_api (0.11.3)
|
|
19
|
+
addressable (~> 2.3)
|
|
20
|
+
descendants_tracker (~> 0.0.1)
|
|
21
|
+
faraday (~> 0.8, < 0.10)
|
|
22
|
+
hashie (>= 1.2)
|
|
23
|
+
multi_json (>= 1.7.5, < 2.0)
|
|
24
|
+
nokogiri (~> 1.6.0)
|
|
25
|
+
oauth2
|
|
26
|
+
hashie (2.0.5)
|
|
27
|
+
highline (1.6.21)
|
|
28
|
+
httparty (0.13.0)
|
|
29
|
+
json (~> 1.8)
|
|
30
|
+
multi_xml (>= 0.5.2)
|
|
31
|
+
i18n (0.6.9)
|
|
32
|
+
jeweler (2.0.1)
|
|
33
|
+
builder
|
|
34
|
+
bundler (>= 1.0)
|
|
35
|
+
git (>= 1.2.5)
|
|
36
|
+
github_api
|
|
37
|
+
highline (>= 1.6.15)
|
|
38
|
+
nokogiri (>= 1.5.10)
|
|
39
|
+
rake
|
|
40
|
+
rdoc
|
|
41
|
+
json (1.8.1)
|
|
42
|
+
jwt (0.1.11)
|
|
43
|
+
multi_json (>= 1.5)
|
|
44
|
+
mini_portile (0.5.2)
|
|
45
|
+
minitest (4.7.5)
|
|
46
|
+
multi_json (1.9.2)
|
|
47
|
+
multi_xml (0.5.5)
|
|
48
|
+
multipart-post (2.0.0)
|
|
49
|
+
nokogiri (1.6.1)
|
|
50
|
+
mini_portile (~> 0.5.0)
|
|
51
|
+
oauth2 (0.9.3)
|
|
52
|
+
faraday (>= 0.8, < 0.10)
|
|
53
|
+
jwt (~> 0.1.8)
|
|
54
|
+
multi_json (~> 1.3)
|
|
55
|
+
multi_xml (~> 0.5)
|
|
56
|
+
rack (~> 1.2)
|
|
57
|
+
origin (2.1.0)
|
|
58
|
+
rack (1.5.2)
|
|
59
|
+
rake (10.1.1)
|
|
60
|
+
rdoc (3.12.2)
|
|
61
|
+
json (~> 1.4)
|
|
62
|
+
shoulda (3.5.0)
|
|
63
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
|
64
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
|
65
|
+
shoulda-context (1.1.6)
|
|
66
|
+
shoulda-matchers (2.5.0)
|
|
67
|
+
activesupport (>= 3.0.0)
|
|
68
|
+
simplecov (0.8.2)
|
|
69
|
+
docile (~> 1.1.0)
|
|
70
|
+
multi_json
|
|
71
|
+
simplecov-html (~> 0.8.0)
|
|
72
|
+
simplecov-html (0.8.0)
|
|
73
|
+
thread_safe (0.3.1)
|
|
74
|
+
atomic (>= 1.1.7, < 2)
|
|
75
|
+
tzinfo (0.3.39)
|
|
76
|
+
|
|
77
|
+
PLATFORMS
|
|
78
|
+
ruby
|
|
79
|
+
|
|
80
|
+
DEPENDENCIES
|
|
81
|
+
activesupport (~> 4.0.4)
|
|
82
|
+
bundler (~> 1.0)
|
|
83
|
+
httparty (~> 0.13.0)
|
|
84
|
+
jeweler (~> 2.0.1)
|
|
85
|
+
origin (~> 2.1.0)
|
|
86
|
+
rdoc (~> 3.12)
|
|
87
|
+
shoulda
|
|
88
|
+
simplecov
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 SpaceAppsPR
|
|
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 all
|
|
13
|
+
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 THE
|
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2014 Jose Irizarry
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# asterank-ruby
|
|
2
|
+
|
|
3
|
+
A module for using the Asterank APIs. Sponsored by [Space Apps PR](http://spaceappspr.com).
|
|
4
|
+
|
|
5
|
+
The Asterank, MPC and Kepler APIs accepts queries that adhere to mongo's json format for a 'find' operation. This gem leverages mongoid's origin gem to construct these queries.
|
|
6
|
+
|
|
7
|
+
[Asterank API](http://www.asterank.com/api "Asterank - API") | [MPC API](http://www.asterank.com/mpc "MPC - API") | [Kepler API](http://www.asterank.com/kepler "Kepler - API") | [Skymorph API](http://www.asterank.com/skymorph "Skymorph - API").
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
Via rubygems.org:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gem install asterank-ruby
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
### Setup Work
|
|
20
|
+
|
|
21
|
+
``` ruby
|
|
22
|
+
|
|
23
|
+
require 'asterank-ruby'
|
|
24
|
+
|
|
25
|
+
# set up a client to talk to the Asterank APIs
|
|
26
|
+
@client = Asterank::Client.new
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Query Asterank API
|
|
30
|
+
|
|
31
|
+
``` ruby
|
|
32
|
+
results = @client.asterank.lt(e: 0.1, i: 4, a: 4).limit(10).execute
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Query MPC API
|
|
36
|
+
|
|
37
|
+
``` ruby
|
|
38
|
+
results = @client.mpc.lt(e: 0.1, i: 4, a: 4).limit(10).execute
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Query Kepler API
|
|
42
|
+
|
|
43
|
+
``` ruby
|
|
44
|
+
results = @client.kepler.lt(TPLANET:320).gt(TPLANET:290).limit(10).execute
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Query Skymorph API
|
|
48
|
+
|
|
49
|
+
``` ruby
|
|
50
|
+
target = "J99TS7A"
|
|
51
|
+
query = @client.skymorph.search(target)
|
|
52
|
+
|
|
53
|
+
result = query["results"].first
|
|
54
|
+
# Write Image to Disk
|
|
55
|
+
key = result["key"]
|
|
56
|
+
@client.skymorph.image(key, "filename.jpg", false) # fast image false
|
|
57
|
+
|
|
58
|
+
File.open('filename.jpg')
|
|
59
|
+
$ #<File:filename.jpg>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## More Information
|
|
63
|
+
|
|
64
|
+
These gems borrows heavily from the twilio-ruby gem in documentation and code design.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'rubygems'
|
|
4
|
+
require 'bundler'
|
|
5
|
+
begin
|
|
6
|
+
Bundler.setup(:default, :development)
|
|
7
|
+
rescue Bundler::BundlerError => e
|
|
8
|
+
$stderr.puts e.message
|
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
10
|
+
exit e.status_code
|
|
11
|
+
end
|
|
12
|
+
require 'rake'
|
|
13
|
+
|
|
14
|
+
require 'jeweler'
|
|
15
|
+
Jeweler::Tasks.new do |gem|
|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
|
17
|
+
gem.name = "asterank-ruby"
|
|
18
|
+
gem.homepage = "http://github.com/SpaceAppsPR/asterank-ruby-client"
|
|
19
|
+
gem.license = "MIT"
|
|
20
|
+
gem.summary = "Asterank Ruby Client"
|
|
21
|
+
gem.description = "Ruby Client to connect to Asterank APIs"
|
|
22
|
+
gem.email = "jose@spaceappspr.com"
|
|
23
|
+
gem.authors = ["Jose Irizarry"]
|
|
24
|
+
# dependencies defined in Gemfile
|
|
25
|
+
end
|
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
|
27
|
+
|
|
28
|
+
require 'rake/testtask'
|
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
|
30
|
+
test.libs << 'lib' << 'test'
|
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
|
32
|
+
test.verbose = true
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
desc "Code coverage detail"
|
|
36
|
+
task :simplecov do
|
|
37
|
+
ENV['COVERAGE'] = "true"
|
|
38
|
+
Rake::Task['test'].execute
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
task :default => :test
|
|
42
|
+
|
|
43
|
+
require 'rdoc/task'
|
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
|
46
|
+
|
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
48
|
+
rdoc.title = "asterank-ruby #{version}"
|
|
49
|
+
rdoc.rdoc_files.include('README*')
|
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
51
|
+
end
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.1
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
# stub: asterank-ruby 0.1.1 ruby lib
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = "asterank-ruby"
|
|
9
|
+
s.version = "0.1.1"
|
|
10
|
+
|
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
|
+
s.require_paths = ["lib"]
|
|
13
|
+
s.authors = ["Jose Irizarry"]
|
|
14
|
+
s.date = "2014-03-23"
|
|
15
|
+
s.description = "Ruby Client to connect to Asterank APIs"
|
|
16
|
+
s.email = "jose@spaceappspr.com"
|
|
17
|
+
s.extra_rdoc_files = [
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"LICENSE.txt",
|
|
20
|
+
"README.md"
|
|
21
|
+
]
|
|
22
|
+
s.files = [
|
|
23
|
+
".document",
|
|
24
|
+
"Gemfile",
|
|
25
|
+
"Gemfile.lock",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"LICENSE.txt",
|
|
28
|
+
"README.md",
|
|
29
|
+
"Rakefile",
|
|
30
|
+
"VERSION",
|
|
31
|
+
"asterank-ruby.gemspec",
|
|
32
|
+
"lib/asterank-ruby.rb",
|
|
33
|
+
"lib/asterank-ruby/api/asterank.rb",
|
|
34
|
+
"lib/asterank-ruby/api/kepler.rb",
|
|
35
|
+
"lib/asterank-ruby/api/mpc.rb",
|
|
36
|
+
"lib/asterank-ruby/api/skymorph.rb",
|
|
37
|
+
"lib/asterank-ruby/client.rb",
|
|
38
|
+
"lib/asterank-ruby/mongo_party.rb",
|
|
39
|
+
"lib/asterank-ruby/version.rb",
|
|
40
|
+
"test/helper.rb",
|
|
41
|
+
"test/test_asterank.rb"
|
|
42
|
+
]
|
|
43
|
+
s.homepage = "http://github.com/SpaceAppsPR/asterank-ruby-client"
|
|
44
|
+
s.licenses = ["MIT"]
|
|
45
|
+
s.rubygems_version = "2.2.0"
|
|
46
|
+
s.summary = "Asterank Ruby Client"
|
|
47
|
+
|
|
48
|
+
if s.respond_to? :specification_version then
|
|
49
|
+
s.specification_version = 4
|
|
50
|
+
|
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
52
|
+
s.add_runtime_dependency(%q<httparty>, ["~> 0.13.0"])
|
|
53
|
+
s.add_runtime_dependency(%q<origin>, ["~> 2.1.0"])
|
|
54
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 4.0.4"])
|
|
55
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
|
56
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
|
57
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
|
58
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
59
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
|
60
|
+
else
|
|
61
|
+
s.add_dependency(%q<httparty>, ["~> 0.13.0"])
|
|
62
|
+
s.add_dependency(%q<origin>, ["~> 2.1.0"])
|
|
63
|
+
s.add_dependency(%q<activesupport>, ["~> 4.0.4"])
|
|
64
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
65
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
66
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
|
67
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
68
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
69
|
+
end
|
|
70
|
+
else
|
|
71
|
+
s.add_dependency(%q<httparty>, ["~> 0.13.0"])
|
|
72
|
+
s.add_dependency(%q<origin>, ["~> 2.1.0"])
|
|
73
|
+
s.add_dependency(%q<activesupport>, ["~> 4.0.4"])
|
|
74
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
75
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
|
76
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
|
77
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
|
78
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
require 'origin'
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'active_support'
|
|
5
|
+
|
|
6
|
+
require 'asterank-ruby/version' unless defined?(Asterank::VERSION)
|
|
7
|
+
require 'asterank-ruby/mongo_party'
|
|
8
|
+
require 'asterank-ruby/client'
|
|
9
|
+
require 'asterank-ruby/api/kepler'
|
|
10
|
+
require 'asterank-ruby/api/mpc'
|
|
11
|
+
require 'asterank-ruby/api/asterank'
|
|
12
|
+
require 'asterank-ruby/api/skymorph'
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
module Asterank
|
|
2
|
+
module API
|
|
3
|
+
class Skymorph
|
|
4
|
+
include HTTParty
|
|
5
|
+
base_uri 'http://asterank.com/api/skymorph'
|
|
6
|
+
attr_reader :results
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@results = nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def results
|
|
13
|
+
@results
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def search(target)
|
|
17
|
+
@results = self.class.get('/search', query: {target: target})
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def search_orbit(params)
|
|
21
|
+
@results = self.class.get('/search_orbit', query: cleanup_orbit_params(params))
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def search_position
|
|
25
|
+
@results = self.class.get('/search_orbit', query: cleanup_position_params(params))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def image(key, filename, fast = true)
|
|
29
|
+
if fast
|
|
30
|
+
endpoint = '/fast_image'
|
|
31
|
+
else
|
|
32
|
+
endpoint = '/image'
|
|
33
|
+
end
|
|
34
|
+
@results = self.class.get(endpoint, query: {key: key})
|
|
35
|
+
File.open(filename, 'wb') {|f| f.write @results.parsed_response }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
def cleanup_orbit_params(params)
|
|
40
|
+
params.slice(
|
|
41
|
+
:ecc,
|
|
42
|
+
:epoch,
|
|
43
|
+
:per,
|
|
44
|
+
:per_date,
|
|
45
|
+
:om,
|
|
46
|
+
:w,
|
|
47
|
+
:i,
|
|
48
|
+
:H
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def cleanup_position_params(params)
|
|
53
|
+
params.slice(
|
|
54
|
+
:ra,
|
|
55
|
+
:Dec,
|
|
56
|
+
:time,
|
|
57
|
+
:per_date,
|
|
58
|
+
:om,
|
|
59
|
+
:w,
|
|
60
|
+
:i,
|
|
61
|
+
:H
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Asterank
|
|
2
|
+
class Client
|
|
3
|
+
|
|
4
|
+
def mpc
|
|
5
|
+
Asterank::API::MPC.new
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def kepler
|
|
9
|
+
Asterank::API::Kepler.new
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def asterank
|
|
13
|
+
Asterank::API::Asterank.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def skymorph
|
|
17
|
+
Asterank::API::Skymorph.new
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class MongoParty
|
|
2
|
+
|
|
3
|
+
attr_reader :results
|
|
4
|
+
|
|
5
|
+
def initialize
|
|
6
|
+
@results = nil
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def results
|
|
10
|
+
@results
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def execute
|
|
14
|
+
limit = options[:limit] || 10
|
|
15
|
+
query = {query: selector.to_json, limit: limit}
|
|
16
|
+
@results = self.class.get('', query: query)
|
|
17
|
+
return @results
|
|
18
|
+
end
|
|
19
|
+
end
|
data/test/helper.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'simplecov'
|
|
2
|
+
|
|
3
|
+
module SimpleCov::Configuration
|
|
4
|
+
def clean_filters
|
|
5
|
+
@filters = []
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
SimpleCov.configure do
|
|
10
|
+
clean_filters
|
|
11
|
+
load_adapter 'test_frameworks'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
|
15
|
+
add_filter "/.rvm/"
|
|
16
|
+
end
|
|
17
|
+
require 'rubygems'
|
|
18
|
+
require 'bundler'
|
|
19
|
+
begin
|
|
20
|
+
Bundler.setup(:default, :development)
|
|
21
|
+
rescue Bundler::BundlerError => e
|
|
22
|
+
$stderr.puts e.message
|
|
23
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
|
24
|
+
exit e.status_code
|
|
25
|
+
end
|
|
26
|
+
require 'test/unit'
|
|
27
|
+
require 'shoulda'
|
|
28
|
+
|
|
29
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
30
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
31
|
+
require 'asterank-ruby'
|
|
32
|
+
|
|
33
|
+
class Test::Unit::TestCase
|
|
34
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: asterank-ruby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Jose Irizarry
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-03-23 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: httparty
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.13.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.13.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: origin
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 2.1.0
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 2.1.0
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: activesupport
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 4.0.4
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 4.0.4
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: shoulda
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: rdoc
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '3.12'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '3.12'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: bundler
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1.0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '1.0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: jeweler
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: 2.0.1
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: 2.0.1
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: simplecov
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
description: Ruby Client to connect to Asterank APIs
|
|
126
|
+
email: jose@spaceappspr.com
|
|
127
|
+
executables: []
|
|
128
|
+
extensions: []
|
|
129
|
+
extra_rdoc_files:
|
|
130
|
+
- LICENSE
|
|
131
|
+
- LICENSE.txt
|
|
132
|
+
- README.md
|
|
133
|
+
files:
|
|
134
|
+
- ".document"
|
|
135
|
+
- Gemfile
|
|
136
|
+
- Gemfile.lock
|
|
137
|
+
- LICENSE
|
|
138
|
+
- LICENSE.txt
|
|
139
|
+
- README.md
|
|
140
|
+
- Rakefile
|
|
141
|
+
- VERSION
|
|
142
|
+
- asterank-ruby.gemspec
|
|
143
|
+
- lib/asterank-ruby.rb
|
|
144
|
+
- lib/asterank-ruby/api/asterank.rb
|
|
145
|
+
- lib/asterank-ruby/api/kepler.rb
|
|
146
|
+
- lib/asterank-ruby/api/mpc.rb
|
|
147
|
+
- lib/asterank-ruby/api/skymorph.rb
|
|
148
|
+
- lib/asterank-ruby/client.rb
|
|
149
|
+
- lib/asterank-ruby/mongo_party.rb
|
|
150
|
+
- lib/asterank-ruby/version.rb
|
|
151
|
+
- test/helper.rb
|
|
152
|
+
- test/test_asterank.rb
|
|
153
|
+
homepage: http://github.com/SpaceAppsPR/asterank-ruby-client
|
|
154
|
+
licenses:
|
|
155
|
+
- MIT
|
|
156
|
+
metadata: {}
|
|
157
|
+
post_install_message:
|
|
158
|
+
rdoc_options: []
|
|
159
|
+
require_paths:
|
|
160
|
+
- lib
|
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: '0'
|
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
|
+
requirements:
|
|
168
|
+
- - ">="
|
|
169
|
+
- !ruby/object:Gem::Version
|
|
170
|
+
version: '0'
|
|
171
|
+
requirements: []
|
|
172
|
+
rubyforge_project:
|
|
173
|
+
rubygems_version: 2.2.0
|
|
174
|
+
signing_key:
|
|
175
|
+
specification_version: 4
|
|
176
|
+
summary: Asterank Ruby Client
|
|
177
|
+
test_files: []
|