fb-support 1.0.0.alpha1 → 1.0.0.alpha2

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: d819d45513cce11b91b5c5db67e7832b2852ddf9
4
- data.tar.gz: 4433a1864b16fd8169c663b45ec286ffae5c2a2c
3
+ metadata.gz: 96bce939c6f65e90509c7275e96fec631cab6169
4
+ data.tar.gz: 7c7fad5a51b5f95ad7751e3d0fe54f986912e015
5
5
  SHA512:
6
- metadata.gz: 3d637aa8053ce72633d128f27ae155668987b491c050834c5a26b4048fcc87f084bebe658e19023702fb0b6f578834da9b71db3c32b9993b7599ac2d35650fc3
7
- data.tar.gz: 87faa2cb9d2a25a6d94e374a5dec95bf7396f2c08bb57821d91834a6184f2c424780b74d9c502798cf7c741658e89bd356274d108580dd5014b3e45592870268
6
+ metadata.gz: c34d8ed2651994001e0f94d927b6df389dbce12032bea559d19a785db5247b99a5c6c805988a42c7407f3f00298eee4c369098b075963d953310e7548a2c142f
7
+ data.tar.gz: a1f2757fcdc3f372480af5414ca435ab76fea65a540c8219368a4f60519ba5f16b893601cb79530876f535de599852030c55dcaa4934c5f45abbb87abf056b36
@@ -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
- @http_request ||= Net::HTTP::Get.new uri.request_uri
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
@@ -3,6 +3,6 @@ module Fb
3
3
  module Support
4
4
  # @return [String] the SemVer-compatible gem version.
5
5
  # @see http://semver.org
6
- VERSION = '1.0.0.alpha1'
6
+ VERSION = '1.0.0.alpha2'
7
7
  end
8
8
  end
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.alpha1
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-07-24 00:00:00.000000000 Z
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.11
143
+ rubygems_version: 2.6.13
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Support utilities for Fb gems