scientific_protocols 0.0.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/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +64 -0
- data/Rakefile +2 -0
- data/lib/scientificprotocols.rb +22 -0
- data/lib/scientificprotocols/client.rb +61 -0
- data/lib/scientificprotocols/dsl.rb +18 -0
- data/lib/scientificprotocols/dsl/protocols.rb +22 -0
- data/lib/scientificprotocols/errors.rb +10 -0
- data/lib/scientificprotocols/errors/client_error.rb +9 -0
- data/lib/scientificprotocols/errors/resource_not_found_error.rb +8 -0
- data/lib/scientificprotocols/resources.rb +10 -0
- data/lib/scientificprotocols/resources/object.rb +29 -0
- data/lib/scientificprotocols/resources/object/attributes.rb +71 -0
- data/lib/scientificprotocols/resources/object/serializers.rb +102 -0
- data/lib/scientificprotocols/resources/protocol.rb +9 -0
- data/lib/scientificprotocols/utils.rb +8 -0
- data/lib/scientificprotocols/utils/url_helper.rb +17 -0
- data/lib/scientificprotocols/version.rb +3 -0
- data/scientificprotocols.gemspec +29 -0
- data/spec/scientificprotocols/client_spec.rb +5 -0
- data/spec/scientificprotocols/dsl/protocols_spec.rb +23 -0
- data/spec/spec_helper.rb +9 -0
- metadata +184 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 36895a603483e2e281fc321b49f389e54e457a54
|
4
|
+
data.tar.gz: a1004217252c2cab20a837495d5c4d3274e67332
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 065e0ba01ef90d1bbd4e7b2b7d7bd204b1f47d3e315cbd21de3074922c0c38c2d282c4a32d725462209cb89b73196c7c4cdfa6bd144c2d30d84bba0bea634270
|
7
|
+
data.tar.gz: 471331794f74f6950cacf7651c9658c6c6d8e94f921f6f078db78317be15887d058630ecb881fbfc66f9aa5e17ec2b5436c868b4812d32917f38c52525f349e7
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 David Iorns
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Scientific Protocols Ruby Client
|
2
|
+
|
3
|
+
A Ruby wrapper for the Scientific Protocols API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'scientific_protocols'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install scientific_protocols
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Get protocols.
|
24
|
+
```
|
25
|
+
protocols = ScientificProtocols.client.get_protocols
|
26
|
+
|
27
|
+
protocols.each do |protocol|
|
28
|
+
puts protocol
|
29
|
+
end
|
30
|
+
```
|
31
|
+
|
32
|
+
Get a protocol.
|
33
|
+
```
|
34
|
+
protocol = ScientificProtocols.client.get_protocol(id: 'beta-glactasidase-stain')
|
35
|
+
|
36
|
+
puts protocol
|
37
|
+
|
38
|
+
{
|
39
|
+
"id":"beta-glactasidase-stain",
|
40
|
+
"url":"https://www.scientificprotocols.org/api/v1/protocols/beta-glactasidase-stain",
|
41
|
+
"title":"Beta-Glactasidase Stain",
|
42
|
+
"description":"\r\n\r\n### Solutions\r\n\r\n1. Solution A\r\n...",
|
43
|
+
"gist_id":"315e630a1fe9fe6e9bab",
|
44
|
+
"html_url":"https://www.scientificprotocols.org/protocols/beta-glactasidase-stain",
|
45
|
+
"discussion_html_url":"https://www.scientificprotocols.org/protocols/beta-glactasidase-stain/discussion",
|
46
|
+
"tags":[
|
47
|
+
"Histology"
|
48
|
+
],
|
49
|
+
"author":{
|
50
|
+
"username":"scientificprotocols",
|
51
|
+
"html_url":"https://www.scientificprotocols.org/users/scientificprotocols"
|
52
|
+
},
|
53
|
+
"created_at":"2014-07-09T18:59:17.254Z",
|
54
|
+
"updated_at":"2014-07-09T18:59:17.254Z"
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
## Contributing
|
59
|
+
|
60
|
+
1. Fork it ( https://github.com/[my-github-username]/scientificprotocols-ruby-client/fork )
|
61
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
62
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
63
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
64
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'scientificprotocols/version'
|
2
|
+
|
3
|
+
module ScientificProtocols
|
4
|
+
autoload :Client, 'scientificprotocols/client'
|
5
|
+
autoload :DSL, 'scientificprotocols/dsl'
|
6
|
+
autoload :Resources, 'scientificprotocols/resources'
|
7
|
+
autoload :Errors, 'scientificprotocols/errors'
|
8
|
+
autoload :Utils, 'scientificprotocols/utils'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
# @return [String]
|
12
|
+
attr_accessor :api_key
|
13
|
+
attr_accessor :logger
|
14
|
+
end
|
15
|
+
|
16
|
+
module_function
|
17
|
+
|
18
|
+
# @return [ScientificProtocols::Client]
|
19
|
+
def client
|
20
|
+
@client ||= Client.new()
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'json'
|
3
|
+
require 'openssl'
|
4
|
+
require 'active_support/all'
|
5
|
+
require 'scientificprotocols/dsl'
|
6
|
+
require 'scientificprotocols/errors'
|
7
|
+
require 'scientificprotocols/utils'
|
8
|
+
|
9
|
+
module ScientificProtocols
|
10
|
+
class Client
|
11
|
+
include DSL
|
12
|
+
include Errors
|
13
|
+
include Utils
|
14
|
+
|
15
|
+
URL = 'https://www.scientificprotocols.org/api/v1/'
|
16
|
+
REQUESTS = [:get, :post, :put, :delete]
|
17
|
+
HEADERS = {'Accept' => 'application/json', 'Content-Type' => 'application/json'}
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
# Setup HTTP request connection to Zenodo.
|
21
|
+
@connection ||= Faraday.new do |builder|
|
22
|
+
builder.request :multipart
|
23
|
+
builder.request :url_encoded
|
24
|
+
builder.response :logger
|
25
|
+
builder.adapter Faraday.default_adapter
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# @param [:get, :post, :put, :delete] method.
|
30
|
+
# @param [String] path.
|
31
|
+
# @param [Hash] query (optional).
|
32
|
+
# @param [Hash] headers request headers (optional).
|
33
|
+
# @raise [ArgumentError] If the response is blank.
|
34
|
+
# @raise [ResourceNotFoundError] If the response code is 404.
|
35
|
+
# @raise [ClientError] If the response code is not in the success range.
|
36
|
+
# @return [Faraday::Response] server response.
|
37
|
+
def request(method, path, query = {}, headers = HEADERS)
|
38
|
+
raise ArgumentError, "Unsupported method #{method.inspect}. Only :get, :post, :put, :delete are allowed" unless REQUESTS.include?(method)
|
39
|
+
|
40
|
+
payload = nil
|
41
|
+
if query.present?
|
42
|
+
accept = headers.present? ? headers['Accept'] : nil
|
43
|
+
if accept.present? && accept == 'application/json'
|
44
|
+
payload = JSON.generate(query)
|
45
|
+
else
|
46
|
+
payload = query
|
47
|
+
end
|
48
|
+
end
|
49
|
+
response = @connection.run_request(method, "#{URL}#{path}", payload, headers)
|
50
|
+
|
51
|
+
case response.status.to_i
|
52
|
+
when 200..299
|
53
|
+
return response
|
54
|
+
when 404
|
55
|
+
raise ResourceNotFoundError.new(response: response)
|
56
|
+
else
|
57
|
+
raise ClientError.new(response: response)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'scientificprotocols'
|
2
|
+
|
3
|
+
module ScientificProtocols
|
4
|
+
module DSL
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'scientificprotocols/dsl/protocols'
|
9
|
+
require 'scientificprotocols/utils'
|
10
|
+
require 'mime-types'
|
11
|
+
|
12
|
+
module ScientificProtocols
|
13
|
+
module DSL
|
14
|
+
include Protocols
|
15
|
+
include Utils
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'scientificprotocols/dsl'
|
2
|
+
|
3
|
+
module ScientificProtocols
|
4
|
+
module DSL::Protocols
|
5
|
+
# GET /Protocols
|
6
|
+
# Get protocols.
|
7
|
+
# @return [Array, nil].
|
8
|
+
def get_protocols
|
9
|
+
Resources::Protocol.parse(request(:get, 'protocols/', nil, nil))
|
10
|
+
end
|
11
|
+
|
12
|
+
# GET /Protocol/{id}
|
13
|
+
# Get a protocol.
|
14
|
+
# @param [String] id A protocol's ID.
|
15
|
+
# @raise [ArgumentError] If the method arguments are blank.
|
16
|
+
# @return [ScientificProtocols::Resources::protocol, nil].
|
17
|
+
def get_protocol(id:)
|
18
|
+
raise ArgumentError, 'ID cannot be blank' if id.blank?
|
19
|
+
Resources::Protocol.parse(request(:get, "protocols/#{id}"))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
require 'json'
|
3
|
+
require 'time'
|
4
|
+
|
5
|
+
module ScientificProtocols
|
6
|
+
module Resources
|
7
|
+
class Object < SimpleDelegator
|
8
|
+
require 'scientificprotocols/resources/object/serializers'
|
9
|
+
require 'scientificprotocols/resources/object/attributes'
|
10
|
+
|
11
|
+
include Serializers
|
12
|
+
include Attributes
|
13
|
+
|
14
|
+
# Define common attributes, applicable to different resources
|
15
|
+
attribute :date_created_utc, Time
|
16
|
+
attribute :date_updated_utc, Time
|
17
|
+
|
18
|
+
def inspect
|
19
|
+
"#<#{self.class.name}:#{'0x00%x' % (object_id << 1)} #{inspect_attributes}>"
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def inspect_attributes
|
25
|
+
attributes.map { |key, value| "@#{key}=#{value.inspect}" }.join(' ')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module ScientificProtocols::Resources::Object::Attributes
|
2
|
+
module ClassMethods
|
3
|
+
def attributes
|
4
|
+
@attributes ||=
|
5
|
+
begin
|
6
|
+
if superclass.respond_to?(:attributes)
|
7
|
+
superclass.attributes.dup
|
8
|
+
else
|
9
|
+
Hash.new { |hash, key| hash[key] = ::Object }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# @return [Module] module holding all attribute accessors
|
15
|
+
def attributes_module
|
16
|
+
@attributes_module ||= const_set(:AttributeMethods, Module.new)
|
17
|
+
end
|
18
|
+
|
19
|
+
def define_attribute_accessor(name, type = nil)
|
20
|
+
type ||= attributes[name.to_sym] || Object
|
21
|
+
attributes_module.send(:define_method, name) do
|
22
|
+
deserialize_attribute(name, type)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def attribute(name, type = String)
|
27
|
+
attributes[name] = type
|
28
|
+
|
29
|
+
define_attribute_accessor(name, type)
|
30
|
+
end
|
31
|
+
|
32
|
+
alias_method :has_many, :attribute
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.included(base)
|
36
|
+
base.extend(ClassMethods)
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
def attributes
|
41
|
+
{}.tap do |result|
|
42
|
+
__getobj__.keys.each do |key|
|
43
|
+
attribute = key.to_s.downcase
|
44
|
+
result[attribute] = public_send(attribute)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def method_missing(name, *args, &block)
|
50
|
+
attribute = name.to_s.upcase
|
51
|
+
if __getobj__.key?(attribute)
|
52
|
+
self.class.define_attribute_accessor(name)
|
53
|
+
deserialize_attribute(name, self.class.attributes[name.to_sym])
|
54
|
+
else
|
55
|
+
super
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def respond_to_missing?(name, include_all = false)
|
62
|
+
__getobj__.key?(name.to_s.upcase) || super(name, include_all)
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param [String, Symbol] name
|
66
|
+
# @param [Class, #to_s] type
|
67
|
+
def deserialize_attribute(name, type)
|
68
|
+
raw = __getobj__[name.to_s.upcase]
|
69
|
+
self.class.serializer_for(type).deserialize(raw)
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'logger'
|
2
|
+
module ScientificProtocols
|
3
|
+
module Resources
|
4
|
+
class Object
|
5
|
+
module Serializers
|
6
|
+
module Object
|
7
|
+
def self.serialize(value)
|
8
|
+
value.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.deserialize(value)
|
12
|
+
case value
|
13
|
+
when Array
|
14
|
+
value.map { |v| v.deep_transform_keys{ |key| key.downcase } }
|
15
|
+
when Hash
|
16
|
+
value.deep_transform_keys{ |key| key.downcase }
|
17
|
+
else
|
18
|
+
value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module Time
|
24
|
+
def self.serialize(value)
|
25
|
+
value.utc.xmlschema
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.deserialize(value)
|
29
|
+
::Time.parse(value)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module ClassMethods
|
34
|
+
# @return [Hash] corresponding serializers for different attributes
|
35
|
+
def serializers
|
36
|
+
@serializers ||= {}
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [String, Symbol] type type of attribute to be serialized or deserialized
|
40
|
+
# @return [#serialize, #deserialize] serializer for provided type
|
41
|
+
def serializer_for(type)
|
42
|
+
serializers[type] ||=
|
43
|
+
begin
|
44
|
+
class_symbol = type.to_s.to_sym
|
45
|
+
if type.respond_to?(:deserialize) && type.respond_to?(:serialize)
|
46
|
+
type
|
47
|
+
elsif Serializers.constants.include?(class_symbol)
|
48
|
+
Serializers.const_get(class_symbol)
|
49
|
+
elsif Resources.constants.include?(class_symbol)
|
50
|
+
Resources.const_get(class_symbol)
|
51
|
+
else
|
52
|
+
Serializers::Object
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Deserialize a Faraday response.
|
58
|
+
# @param [Faraday::Response] response.
|
59
|
+
# @raise [ArgumentError] If the response is blank.
|
60
|
+
# @return [Object, nil].
|
61
|
+
def deserialize(response)
|
62
|
+
raise ArgumentError, "Response cannot be blank" if response.blank?
|
63
|
+
|
64
|
+
attributes = response.body
|
65
|
+
begin
|
66
|
+
attributes = JSON.parse(response.body)
|
67
|
+
case attributes
|
68
|
+
when Array
|
69
|
+
return attributes.map { |object| new(object) }
|
70
|
+
when Hash
|
71
|
+
return new(attributes)
|
72
|
+
end
|
73
|
+
rescue JSON::ParserError
|
74
|
+
logger = Logger.new(STDOUT)
|
75
|
+
logger.error("Could not parse: #{response.body}")
|
76
|
+
end
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
|
80
|
+
alias_method :parse, :deserialize
|
81
|
+
|
82
|
+
def serialize(object)
|
83
|
+
object.serialize
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.included(base)
|
88
|
+
super
|
89
|
+
base.extend ClassMethods
|
90
|
+
end
|
91
|
+
|
92
|
+
def serialize
|
93
|
+
{}.tap do |result|
|
94
|
+
attributes.each do |name, value|
|
95
|
+
result[name.upcase] = self.class.serializer_for(name).serialize(value)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module ScientificProtocols
|
2
|
+
module Utils
|
3
|
+
class UrlHelper
|
4
|
+
# Build a URL with a querystring containing optional params if supplied.
|
5
|
+
# @param [UrlHelper] path The name of the resource path as per the URL e.g. contacts.
|
6
|
+
# @param [Hash] params A hash of params we're turning into a querystring.
|
7
|
+
# @return [UrlHelper] The URL of the resource with required params.
|
8
|
+
def self.build_url(path:, params:)
|
9
|
+
params.delete_if {|k,v| v.blank?}
|
10
|
+
params = params.to_query
|
11
|
+
query = path
|
12
|
+
query << ('?' + params) unless params.blank?
|
13
|
+
query
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'scientificprotocols/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'scientific_protocols'
|
8
|
+
spec.version = ScientificProtocols::VERSION
|
9
|
+
spec.authors = ['David Iorns']
|
10
|
+
spec.email = ['david.iorns@gmail.com']
|
11
|
+
spec.summary = %q{A Ruby wrapper for the Scientific Protocols API.}
|
12
|
+
spec.homepage = 'https://www.scientificprotocols.org'
|
13
|
+
spec.license = 'MIT'
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'faraday'
|
21
|
+
spec.add_dependency 'activesupport'
|
22
|
+
spec.add_dependency 'mime-types'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0.0'
|
27
|
+
spec.add_development_dependency 'webmock', '~> 1.18.0'
|
28
|
+
spec.add_development_dependency 'vcr'
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ScientificProtocols::DSL::Protocols do
|
4
|
+
# GET /protocols
|
5
|
+
describe '#get_protocols' do
|
6
|
+
it 'returns an array of protocols' do
|
7
|
+
VCR.use_cassette('get_protocols') do
|
8
|
+
protocols = ScientificProtocols.client.get_protocols
|
9
|
+
expect(protocols).to be_a(Array)
|
10
|
+
expect(protocols.first).to be_a(Protocol)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# GET /protocols/{id}
|
16
|
+
describe '#get_protocol' do
|
17
|
+
it 'returns a protocol' do
|
18
|
+
VCR.use_cassette('get_protocol') do
|
19
|
+
expect(ScientificProtocols.client.get_protocol(id: 'beta-glactasidase-stain')).to be_a(Protocol)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scientific_protocols
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Iorns
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mime-types
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.18.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.18.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: vcr
|
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:
|
126
|
+
email:
|
127
|
+
- david.iorns@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".gitignore"
|
133
|
+
- Gemfile
|
134
|
+
- LICENSE.txt
|
135
|
+
- README.md
|
136
|
+
- Rakefile
|
137
|
+
- lib/scientificprotocols.rb
|
138
|
+
- lib/scientificprotocols/client.rb
|
139
|
+
- lib/scientificprotocols/dsl.rb
|
140
|
+
- lib/scientificprotocols/dsl/protocols.rb
|
141
|
+
- lib/scientificprotocols/errors.rb
|
142
|
+
- lib/scientificprotocols/errors/client_error.rb
|
143
|
+
- lib/scientificprotocols/errors/resource_not_found_error.rb
|
144
|
+
- lib/scientificprotocols/resources.rb
|
145
|
+
- lib/scientificprotocols/resources/object.rb
|
146
|
+
- lib/scientificprotocols/resources/object/attributes.rb
|
147
|
+
- lib/scientificprotocols/resources/object/serializers.rb
|
148
|
+
- lib/scientificprotocols/resources/protocol.rb
|
149
|
+
- lib/scientificprotocols/utils.rb
|
150
|
+
- lib/scientificprotocols/utils/url_helper.rb
|
151
|
+
- lib/scientificprotocols/version.rb
|
152
|
+
- scientificprotocols.gemspec
|
153
|
+
- spec/scientificprotocols/client_spec.rb
|
154
|
+
- spec/scientificprotocols/dsl/protocols_spec.rb
|
155
|
+
- spec/spec_helper.rb
|
156
|
+
homepage: https://www.scientificprotocols.org
|
157
|
+
licenses:
|
158
|
+
- MIT
|
159
|
+
metadata: {}
|
160
|
+
post_install_message:
|
161
|
+
rdoc_options: []
|
162
|
+
require_paths:
|
163
|
+
- lib
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
requirements: []
|
175
|
+
rubyforge_project:
|
176
|
+
rubygems_version: 2.4.4
|
177
|
+
signing_key:
|
178
|
+
specification_version: 4
|
179
|
+
summary: A Ruby wrapper for the Scientific Protocols API.
|
180
|
+
test_files:
|
181
|
+
- spec/scientificprotocols/client_spec.rb
|
182
|
+
- spec/scientificprotocols/dsl/protocols_spec.rb
|
183
|
+
- spec/spec_helper.rb
|
184
|
+
has_rdoc:
|