viaduct-api 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d3739b3fda3d7b2fcae7ffb0adbecbe25d0ec0b8
4
+ data.tar.gz: 0acad048905cdcc6c9e468aa59a75c974305e851
5
+ SHA512:
6
+ metadata.gz: d71507992a713edbe2f1001226928e3c4bfeaad9c8a83ba99fa75d549cfa05ef5e48d171ed64491fcb566afc4f87575f89df467a04488e3fd90fda21bc7eafd1
7
+ data.tar.gz: 346d880f0e2b27a6259434b559ef0cdadcce36ddbc8cc5a94db6add66a918568490063ca4987eab343481c54833a7a270cced5666f5dbe562fa417be0ebc550e
@@ -0,0 +1,38 @@
1
+ require 'moonrope_client'
2
+
3
+ module Viaduct
4
+ module API
5
+ class Client
6
+
7
+ def initialize(token = nil, secret = nil)
8
+ @token, @secret = token, secret
9
+ end
10
+
11
+ def request(*args)
12
+ moonrope.request(*args)
13
+ end
14
+
15
+ def controller(*args)
16
+ moonrope.controller(*args)
17
+ end
18
+
19
+ def method_missing(name, value = nil)
20
+ value.nil? ? controller(name) : super
21
+ end
22
+
23
+ private
24
+
25
+ def moonrope
26
+ @moonrope ||= begin
27
+ headers = {'X-Auth-App' => Viaduct::API.application_token}
28
+ if @token && @secret
29
+ headers['X-Auth-Token'] = @token
30
+ headers['X-Auth-Secret'] = @secret
31
+ end
32
+ MoonropeClient::Connection.new(Viaduct::API.host, :headers => headers, :ssl => Viaduct::API.ssl == false ? false : true)
33
+ end
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,5 @@
1
+ module Viaduct
2
+ module API
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,18 @@
1
+ require 'viaduct/api/version'
2
+ require 'viaduct/api/client'
3
+
4
+ module Viaduct
5
+ module API
6
+ class << self
7
+
8
+ attr_accessor :application_token
9
+ attr_accessor :host
10
+ attr_accessor :ssl
11
+
12
+ def host
13
+ @host || 'api.viaduct.io'
14
+ end
15
+
16
+ end
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: viaduct-api
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Adam Cooke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: moonrope-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ description: A full client library allows requests to made to the Viaduct API.
28
+ email:
29
+ - adam@viaduct.io
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/viaduct/api.rb
35
+ - lib/viaduct/api/client.rb
36
+ - lib/viaduct/api/version.rb
37
+ homepage: http://viaduct.io
38
+ licenses:
39
+ - MIT
40
+ metadata: {}
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 2.2.2
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: A client library for the Viaduct API.
61
+ test_files: []
62
+ has_rdoc: