takeout 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -4
- data/circle.yml +6 -0
- data/lib/takeout/client.rb +10 -1
- data/lib/takeout/version.rb +1 -1
- data/spec/client_spec.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2031cb01ff9f1e947b56c0425e139c1844d9c900
|
4
|
+
data.tar.gz: 40cc086b045ed2774bf546636d3bc30afdedef2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac33508401257dedea5dd3c577bd9d94e2c6c87d4341e90a24fb9b6b46ee746ac461d986d1066add3cfe274e63fc6b6a5914d5d66d5ff3bfae35a6203eade998
|
7
|
+
data.tar.gz: 6090c18d3bebfe54cfcc689a881d1814aa12d3a8dd3ead6ef40a6c454697b3def7ebc22c9a29aaa295f8f235fefc3f9415ef3ec4e34cda5eed75bbb5f995bc76
|
data/README.md
CHANGED
@@ -1,11 +1,17 @@
|
|
1
1
|
# Takeout
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/takeout.svg)](http://badge.fury.io/rb/takeout)
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/takeout.svg)](http://badge.fury.io/rb/takeout)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/kylegrantlucas/takeout/badges/gpa.svg)](https://codeclimate.com/github/kylegrantlucas/takeout)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/kylegrantlucas/takeout/badges/coverage.svg)](https://codeclimate.com/github/kylegrantlucas/takeout/coverage)
|
5
|
+
[![Circle CI](https://circleci.com/gh/kylegrantlucas/takeout/tree/master.svg?style=shield)](https://circleci.com/gh/kylegrantlucas/takeout/tree/master)
|
6
|
+
[![Inline docs](http://inch-ci.org/github/kylegrantlucas/takeout.svg?branch=master&style=shields)](http://inch-ci.org/github/kylegrantlucas/takeout)
|
7
|
+
[![Join the chat at https://gitter.im/kylegrantlucas/takeout](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/kylegrantlucas/takeout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
8
|
+
[![Analytics](https://ga-beacon.appspot.com/UA-62799576-1/kylegrantlucas/takeout?pixel)](https://github.com/igrigorik/ga-beacon)
|
3
9
|
|
4
10
|
A powerful little tool for generating on-the-fly API clients.
|
5
11
|
|
6
12
|
## Requirements
|
7
13
|
|
8
|
-
All versions of MRI 1.9.3+ and up are supported, currently
|
14
|
+
All versions of MRI 1.9.3+ and up are supported (and tested via CircleCI), the gem is currently unsupported on JRuby, MRI 1.8-1.9.2, and Rubinus.
|
9
15
|
Support of these platforms is a future goal for the project.
|
10
16
|
|
11
17
|
## Installation
|
@@ -57,7 +63,7 @@ Results are returned as parsed ruby objects:
|
|
57
63
|
#### Extensions
|
58
64
|
|
59
65
|
You have the ability to specify an extension that gets tacked on, if you need it.
|
60
|
-
You may do this in either the call or in
|
66
|
+
You may do this in either the call or in the client instantiation, however the call will always override the clients extension if there is a conflict.
|
61
67
|
|
62
68
|
client = Takeout::Client.new do |client|
|
63
69
|
client.uri = 'testing.com'
|
@@ -91,7 +97,7 @@ As you can see in the above example I use ```{{endpoint}}``` as one of the templ
|
|
91
97
|
|
92
98
|
#### SSL Support
|
93
99
|
|
94
|
-
SSL is also supported, and
|
100
|
+
SSL is also supported, and is very easy to flip on.
|
95
101
|
|
96
102
|
You can either specify ssl when instantiating the object:
|
97
103
|
|
data/circle.yml
CHANGED
data/lib/takeout/client.rb
CHANGED
@@ -30,6 +30,8 @@ module Takeout
|
|
30
30
|
# @return [Hash] the hash containing the endpoints by request type to generate methods for
|
31
31
|
attr_reader :endpoints
|
32
32
|
|
33
|
+
attr_accessor :port
|
34
|
+
|
33
35
|
# A constant specifying the kind of event callbacks to raise errors for
|
34
36
|
FAILURES = [:failure, :missing, :redirect]
|
35
37
|
|
@@ -59,6 +61,12 @@ module Takeout
|
|
59
61
|
return @ssl
|
60
62
|
end
|
61
63
|
|
64
|
+
# Check if a port is specified.
|
65
|
+
# @return [Boolean] Returns true if a port is enabled, false if nil.
|
66
|
+
def port?
|
67
|
+
return !port.nil?
|
68
|
+
end
|
69
|
+
|
62
70
|
# Sets the instance variable and then generates the dynamic methods by calling #generate_enpoint_methods
|
63
71
|
# @param [Hash] value A hash specifying the custom per-endpoint schema templates
|
64
72
|
def endpoints=(value)
|
@@ -200,7 +208,8 @@ module Takeout
|
|
200
208
|
end
|
201
209
|
|
202
210
|
def url(endpoint=nil)
|
203
|
-
|
211
|
+
opts = port? ? {host: @uri, path: endpoint, port: port} : {host: @uri, path: endpoint}
|
212
|
+
ssl? ? URI::HTTPS.build(opts) : URI::HTTP.build(opts)
|
204
213
|
end
|
205
214
|
end
|
206
215
|
end
|
data/lib/takeout/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -10,6 +10,10 @@ describe Takeout::Client do
|
|
10
10
|
:put_posts, :put_fake_failure, :put_fake_missing, :put_fake_redirect,
|
11
11
|
:delete_posts, :delete_fake_failure, :delete_fake_missing, :delete_fake_redirect])
|
12
12
|
end
|
13
|
+
|
14
|
+
it 'yeilds when block is given' do
|
15
|
+
expect { |b| Takeout::Client.new(&b) }.to yield_with_args (Takeout::Client)
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
context 'ssl' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: takeout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Lucas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|