endow 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c5a6108aefd4932f70dd201724db3810dbd9f07
4
- data.tar.gz: fc6bbe9b83b1b0c0dd8b770a5b2e1c068cb319b5
3
+ metadata.gz: 718bb4d0587749ac59db826e47a1a3878a00db06
4
+ data.tar.gz: e2a781f54fa1edc1dbba0564529d6b4fc0d033cc
5
5
  SHA512:
6
- metadata.gz: aeeed62e6a9297cbdc9a5fe69ea15c492957b4af23989830a69de0081cf20f14704e2105a761284d213340e011186301585257c3ec1f2ec4ffd4bdd816c9a4f4
7
- data.tar.gz: fd1a2f6df5ea8b662a280f870ce0f2eaf9d56126b45ea42e7f7dac5d26fd8cc52f33334be61c5265e5aabd5e5890ed72b9c42542325d3b5a16056451d8e9e6b2
6
+ metadata.gz: 1b28c17418d5562d37eebffca2ec6741d0d983dd9f804ce401510b74211086fb69fa05641dbab948cbe10a639bf760273c9369dea56ca14b88aacfd6fee36831
7
+ data.tar.gz: 8d502732af0bfdaae6a5dc6b1cbf8a8f8baab2baed580fd76f215e4ba4d0fe4243ffe2173fcfbca6db1e337d3728e5c64a0a24352c2b13e34b375687160227fa
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.0.0-p247
1
+ 2.1.0
data/README.md CHANGED
@@ -20,3 +20,25 @@ Or install it yourself as:
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Setting URI Content (URI Parameters)
24
+
25
+ Restful URIs sometimes use templated URI parameters, a la Rails, ie. `/people/:id` or `people/:person_id/things`. To set the content of
26
+ the URI parmeters use the `#set_uri_content` method. You must implement the `#endpoint_template` method as opposed to the `endpoint` method
27
+ when using URI parameters.
28
+
29
+ class SomeEndpoint < Endow::Endpoint
30
+ def initialize( attributes )
31
+ @attributes = attributes
32
+
33
+ set_uri_content( attributes.slice( :person_id ))
34
+ set_content( attributes.slice( :thing ))
35
+ end
36
+
37
+ def endpoint_template
38
+ 'people/:person_id/things'
39
+ end
40
+
41
+ def http_verb
42
+ :post
43
+ end
44
+ end
@@ -78,6 +78,15 @@ module Endow
78
78
  end
79
79
  end
80
80
 
81
+ def set_ssl_client_side_authentication( auth )
82
+ request.auth.ssl.cert_key_file = auth[:ssl_cert_key_file]
83
+ request.auth.ssl.cert_key_password = auth[:ssl_cert_key_password]
84
+ request.auth.ssl.cert_file = auth[:ssl_cert_file]
85
+ request.auth.ssl.ca_cert_file = auth[:ssl_ca_cert_file]
86
+ request.auth.ssl.verify_mode = auth[:ssl_verify_mode]
87
+ request.auth.ssl.ssl_version = auth[:ssl_version]
88
+ end
89
+
81
90
  def request_params
82
91
  {
83
92
  url: url,
@@ -119,6 +128,17 @@ module Endow
119
128
  send( custom_handler_method, response )
120
129
  end
121
130
 
131
+ def set_uri_content( attributes )
132
+ self.class_eval do
133
+ define_method :endpoint do
134
+ endpoint_template.gsub( /(:\w+)/ ) do |match|
135
+ attributes[match[1..-1].to_sym]
136
+ end
137
+ end
138
+ protected :endpoint
139
+ end
140
+ end
141
+
122
142
  def set_content( content )
123
143
  send "set_content_as_#{content_type_name}", content
124
144
  end
@@ -231,7 +251,11 @@ module Endow
231
251
  end
232
252
 
233
253
  def endpoint
234
- raise NotImplementedError
254
+ raise NotImplementedError, "You must implement #{self.class.name}#endpoint"
255
+ end
256
+
257
+ def endpoint_template
258
+ raise NotImplementedError, "You must implement #{self.class.name}#endpoint_template if you call #set_uri_content"
235
259
  end
236
260
 
237
261
  def authentication_token_key
data/lib/endow/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Endow
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: endow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Harrelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-05 00:00:00.000000000 Z
11
+ date: 2014-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: multi_json
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: retryable-rb
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: wisper
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.3'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description: A library to assist in consuming API endpoints.
@@ -115,9 +115,9 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - .gitignore
119
- - .ruby-gemset
120
- - .ruby-version
118
+ - ".gitignore"
119
+ - ".ruby-gemset"
120
+ - ".ruby-version"
121
121
  - Gemfile
122
122
  - LICENSE.txt
123
123
  - README.md
@@ -141,17 +141,17 @@ require_paths:
141
141
  - lib
142
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
143
  requirements:
144
- - - '>='
144
+ - - ">="
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  requirements:
149
- - - '>='
149
+ - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.0.5
154
+ rubygems_version: 2.2.1
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: A library to assist in consuming API endpoints.