fb-support 1.0.0.alpha1 → 1.0.0.alpha2
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/fb/http_request.rb +5 -1
- data/lib/fb/support/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96bce939c6f65e90509c7275e96fec631cab6169
|
4
|
+
data.tar.gz: 7c7fad5a51b5f95ad7751e3d0fe54f986912e015
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c34d8ed2651994001e0f94d927b6df389dbce12032bea559d19a785db5247b99a5c6c805988a42c7407f3f00298eee4c369098b075963d953310e7548a2c142f
|
7
|
+
data.tar.gz: a1f2757fcdc3f372480af5414ca435ab76fea65a540c8219368a4f60519ba5f16b893601cb79530876f535de599852030c55dcaa4934c5f45abbb87abf056b36
|
data/lib/fb/http_request.rb
CHANGED
@@ -15,6 +15,7 @@ module Fb
|
|
15
15
|
class HTTPRequest
|
16
16
|
# Initializes a Request object.
|
17
17
|
# @param [Hash] options the options for the request.
|
18
|
+
# @option options [Symbol] :method (:get) The HTTP method to use.
|
18
19
|
# @option options [Class] :expected_response (Net::HTTPSuccess) The class
|
19
20
|
# of response that the request should obtain when run.
|
20
21
|
# @option options [String] :host The host of the request URI.
|
@@ -26,6 +27,7 @@ module Fb
|
|
26
27
|
# @option options [Proc] :error_message The block that will be invoked
|
27
28
|
# when a request fails.
|
28
29
|
def initialize(options = {})
|
30
|
+
@method = options.fetch :method, :get
|
29
31
|
@expected_response = options.fetch :expected_response, Net::HTTPSuccess
|
30
32
|
@host = options.fetch :host, 'graph.facebook.com'
|
31
33
|
@path = options[:path]
|
@@ -63,11 +65,13 @@ module Fb
|
|
63
65
|
|
64
66
|
# @return [Net::HTTPRequest] the full HTTP request object.
|
65
67
|
def http_request
|
66
|
-
|
68
|
+
net_http_class = Object.const_get "Net::HTTP::#{@method.capitalize}"
|
69
|
+
@http_request ||= net_http_class.new uri.request_uri
|
67
70
|
end
|
68
71
|
|
69
72
|
def as_curl
|
70
73
|
'curl'.tap do |curl|
|
74
|
+
curl << " -X #{http_request.method}"
|
71
75
|
http_request.each_header{|k, v| curl << %Q{ -H "#{k}: #{v}"}}
|
72
76
|
curl << %Q{ "#{url}"}
|
73
77
|
end
|
data/lib/fb/support/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fb-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.alpha2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claudio Baccigalupo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: 1.3.1
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.6.
|
143
|
+
rubygems_version: 2.6.13
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: Support utilities for Fb gems
|