heroics 0.0.9 → 0.0.10
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 +4 -4
- data/lib/heroics/schema.rb +0 -1
- data/lib/heroics/version.rb +1 -1
- data/lib/heroics/views/client.erb +11 -10
- 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: 2734bdfc3a71cf8a17dda56a62a0d3cc654144b3
|
4
|
+
data.tar.gz: e2f742945f8a266894b00bc72c718c64451608bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5005fa03e9b90eac6ac3f697739b2863ad61672b64987975fe77a2bd8762342166bd387367ada7d3730332ec628bb37e17fd86d5424dec082f5060c937f44ace
|
7
|
+
data.tar.gz: 51917065d5f6efa822bff0b735dc629a7bad970ff9c7e870089b484b2bfb4e96d28fcc4baac694035890797877ef18dcd7742a7aaeef06c9de35a427fdd72460
|
data/lib/heroics/schema.rb
CHANGED
@@ -246,7 +246,6 @@ module Heroics
|
|
246
246
|
# that represent parameters to be injected into the link URL.
|
247
247
|
def resolve_parameter_details(parameters)
|
248
248
|
properties = @schema['definitions'][@resource_name]['properties']
|
249
|
-
return [] if properties.nil?
|
250
249
|
|
251
250
|
# URI decode parameters and strip the leading '{(' and trailing ')}'.
|
252
251
|
parameters = parameters.map { |parameter| URI.unescape(parameter[2..-3]) }
|
data/lib/heroics/version.rb
CHANGED
@@ -14,13 +14,15 @@ module <%= @module_name %>
|
|
14
14
|
# @param api_key [String] The API key to use when connecting.
|
15
15
|
# @param options [Hash<Symbol,String>] Optionally, custom settings
|
16
16
|
# to use with the client. Allowed options are `default_headers`,
|
17
|
-
# `cache` and `
|
17
|
+
# `cache` and `url`.
|
18
18
|
# @return [Client] A client configured to use the API with HTTP Basic
|
19
19
|
# authentication.
|
20
20
|
def self.connect(api_key, options=nil)
|
21
21
|
options = custom_options(options)
|
22
|
-
|
23
|
-
|
22
|
+
uri = URI.parse(options[:url])
|
23
|
+
uri.user = 'user'
|
24
|
+
uri.password = api_key
|
25
|
+
client = Heroics.client_from_schema(SCHEMA, uri.to_s, options)
|
24
26
|
Client.new(client)
|
25
27
|
end
|
26
28
|
|
@@ -29,12 +31,12 @@ module <%= @module_name %>
|
|
29
31
|
# @param oauth_token [String] The OAuth token to use with the API.
|
30
32
|
# @param options [Hash<Symbol,String>] Optionally, custom settings
|
31
33
|
# to use with the client. Allowed options are `default_headers`,
|
32
|
-
# `cache` and `
|
34
|
+
# `cache` and `url`.
|
33
35
|
# @return [Client] A client configured to use the API with OAuth
|
34
36
|
# authentication.
|
35
37
|
def self.connect_oauth(oauth_token, options=nil)
|
36
38
|
options = custom_options(options)
|
37
|
-
url =
|
39
|
+
url = options[:url]
|
38
40
|
client = Heroics.oauth_client_from_schema(oauth_token, SCHEMA, url, options)
|
39
41
|
Client.new(client)
|
40
42
|
end
|
@@ -44,12 +46,12 @@ module <%= @module_name %>
|
|
44
46
|
# @param token [String] The token to use with the API.
|
45
47
|
# @param options [Hash<Symbol,String>] Optionally, custom settings
|
46
48
|
# to use with the client. Allowed options are `default_headers`,
|
47
|
-
# `cache` and `
|
49
|
+
# `cache` and `url`.
|
48
50
|
# @return [Client] A client configured to use the API with OAuth
|
49
51
|
# authentication.
|
50
52
|
def self.connect_token(token, options=nil)
|
51
53
|
options = custom_options(options)
|
52
|
-
url =
|
54
|
+
url = options[:url]
|
53
55
|
client = Heroics.token_client_from_schema(token, SCHEMA, url, options)
|
54
56
|
Client.new(client)
|
55
57
|
end
|
@@ -63,7 +65,7 @@ module <%= @module_name %>
|
|
63
65
|
final_options[:default_headers].merge!(options[:default_headers])
|
64
66
|
end
|
65
67
|
final_options[:cache] = options[:cache] if options[:cache]
|
66
|
-
final_options[:
|
68
|
+
final_options[:url] = options[:url] if options[:url]
|
67
69
|
final_options
|
68
70
|
end
|
69
71
|
|
@@ -71,11 +73,10 @@ module <%= @module_name %>
|
|
71
73
|
def self.default_options
|
72
74
|
default_headers = <%= @default_headers %>
|
73
75
|
cache = <%= @cache %>
|
74
|
-
uri = URI.parse("<%= @url %>")
|
75
76
|
{
|
76
77
|
default_headers: default_headers,
|
77
78
|
cache: cache,
|
78
|
-
|
79
|
+
url: "<%= @url %>"
|
79
80
|
}
|
80
81
|
end
|
81
82
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geemus
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|