wuparty 1.2.7 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/wuparty.rb +0 -66
- data/test/wuparty_test.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '09a964df85dabf867074ea0b08ab6513a04d878c6e9dd6c1e8d0f35b40a0dd93'
|
4
|
+
data.tar.gz: ab0a9f3fbc5c15d6a0bc8303be4e6c9f995d72f253d8dc8e5bf400b590dd8645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6943a1829998b90acfe6c3f8b6de7f64942adc05b164f8ef82d6a251604d326c9b98f41883917f5feaf051253a892c68a2f0e67cbed1dacce9dc2566c1ef5921
|
7
|
+
data.tar.gz: 5e13f8e94e47ae54dddc8e3e3c35e081d47c2be2bbc093bf7b6e9166d29e7556f33fe561bc488f197972299e1269b6f77bcf9ca9f41c2a04528689aa96561b09
|
data/lib/wuparty.rb
CHANGED
@@ -4,72 +4,6 @@ require 'net/http/post/multipart'
|
|
4
4
|
gem 'mime-types'
|
5
5
|
require 'mime/types'
|
6
6
|
|
7
|
-
# multipart POST support from David Balater's fork of HTTParty:
|
8
|
-
# http://github.com/dbalatero/httparty
|
9
|
-
# :stopdoc:
|
10
|
-
module HTTParty
|
11
|
-
module ClassMethods
|
12
|
-
def post(path, options={})
|
13
|
-
klass = options[:multipart] ? Net::HTTP::Post::Multipart : Net::HTTP::Post
|
14
|
-
perform_request klass, path, options
|
15
|
-
end
|
16
|
-
end
|
17
|
-
class Request
|
18
|
-
SupportedHTTPMethods << Net::HTTP::Post::Multipart
|
19
|
-
private
|
20
|
-
def setup_raw_request
|
21
|
-
if multipart?
|
22
|
-
@file_handles = []
|
23
|
-
io_objects = {}
|
24
|
-
|
25
|
-
options[:multipart].each do |field_name, info|
|
26
|
-
fp = File.open(info[:path])
|
27
|
-
@file_handles << fp
|
28
|
-
|
29
|
-
io_objects[field_name] = UploadIO.new(fp,
|
30
|
-
info[:type],
|
31
|
-
info[:path])
|
32
|
-
end
|
33
|
-
|
34
|
-
if options[:body]
|
35
|
-
options[:body].each do |field_name, value|
|
36
|
-
io_objects[field_name] = value
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
@raw_request = http_method.new(uri.request_uri,
|
41
|
-
io_objects)
|
42
|
-
|
43
|
-
# We have to duplicate and merge the headers set by the
|
44
|
-
# multipart object to make sure that Net::HTTP
|
45
|
-
# doesn't override them down the line when it calls
|
46
|
-
# initialize_http_header.
|
47
|
-
#
|
48
|
-
# Otherwise important headers like Content-Length,
|
49
|
-
# Accept, and Content-Type will be deleted.
|
50
|
-
original_headers = {}
|
51
|
-
@raw_request.each do |key, value|
|
52
|
-
original_headers[key] = value
|
53
|
-
end
|
54
|
-
|
55
|
-
options[:headers] ||= {}
|
56
|
-
original_headers.merge!(options[:headers])
|
57
|
-
options[:headers] = original_headers
|
58
|
-
else
|
59
|
-
@raw_request = http_method.new(uri.request_uri)
|
60
|
-
@raw_request.body = body if body
|
61
|
-
end
|
62
|
-
|
63
|
-
@raw_request.initialize_http_header options[:headers]
|
64
|
-
@raw_request.basic_auth(username, password) if options[:basic_auth]
|
65
|
-
end
|
66
|
-
def multipart?
|
67
|
-
Net::HTTP::Post::Multipart == http_method
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
# :startdoc:
|
72
|
-
|
73
7
|
class WuParty
|
74
8
|
include HTTParty
|
75
9
|
format :json
|
data/test/wuparty_test.rb
CHANGED
@@ -59,7 +59,7 @@ class WuPartyTest < Test::Unit::TestCase
|
|
59
59
|
def test_form_fields
|
60
60
|
form = @wufoo.form(@form_id)
|
61
61
|
field_names = form.fields.map { |f| f['Title'] }
|
62
|
-
assert field_names.
|
62
|
+
assert field_names.grep(/^Name/).any?, 'Name field not found in #fields'
|
63
63
|
assert field_names.include?('Address'), 'Address field not found in #fields'
|
64
64
|
end
|
65
65
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wuparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.16.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
|
-
version: 0.
|
26
|
+
version: 0.16.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multipart-post
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.
|
83
|
+
rubygems_version: 2.7.6
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Ruby wrapper for Wufoo's REST API v3.
|