mercadopago-custom-checkout 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +5 -5
  2. data/.gs/bin/rake +12 -8
  3. data/.gs/specifications/rake-10.5.0.gemspec +24 -28
  4. data/.tool-versions +1 -0
  5. data/lib/mercadopago/custom_checkout/version.rb +1 -1
  6. data/mercadopago-custom-checkout.gemspec +3 -3
  7. metadata +14 -125
  8. data/.gs/cache/faraday-0.9.2.gem +0 -0
  9. data/.gs/cache/minitest-5.9.0.gem +0 -0
  10. data/.gs/cache/multi_json-1.12.1.gem +0 -0
  11. data/.gs/cache/multipart-post-2.0.0.gem +0 -0
  12. data/.gs/gems/faraday-0.9.2/LICENSE.md +0 -20
  13. data/.gs/gems/faraday-0.9.2/README.md +0 -245
  14. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http.rb +0 -237
  15. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_http_ssl_patch.rb +0 -56
  16. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony/parallel_manager.rb +0 -66
  17. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/em_synchrony.rb +0 -100
  18. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/excon.rb +0 -81
  19. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/httpclient.rb +0 -117
  20. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http.rb +0 -130
  21. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/net_http_persistent.rb +0 -49
  22. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/patron.rb +0 -78
  23. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/rack.rb +0 -58
  24. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/test.rb +0 -162
  25. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter/typhoeus.rb +0 -123
  26. data/.gs/gems/faraday-0.9.2/lib/faraday/adapter.rb +0 -46
  27. data/.gs/gems/faraday-0.9.2/lib/faraday/autoload.rb +0 -84
  28. data/.gs/gems/faraday-0.9.2/lib/faraday/connection.rb +0 -437
  29. data/.gs/gems/faraday-0.9.2/lib/faraday/error.rb +0 -53
  30. data/.gs/gems/faraday-0.9.2/lib/faraday/middleware.rb +0 -37
  31. data/.gs/gems/faraday-0.9.2/lib/faraday/options.rb +0 -359
  32. data/.gs/gems/faraday-0.9.2/lib/faraday/parameters.rb +0 -197
  33. data/.gs/gems/faraday-0.9.2/lib/faraday/rack_builder.rb +0 -213
  34. data/.gs/gems/faraday-0.9.2/lib/faraday/request/authorization.rb +0 -42
  35. data/.gs/gems/faraday-0.9.2/lib/faraday/request/basic_authentication.rb +0 -13
  36. data/.gs/gems/faraday-0.9.2/lib/faraday/request/instrumentation.rb +0 -36
  37. data/.gs/gems/faraday-0.9.2/lib/faraday/request/multipart.rb +0 -63
  38. data/.gs/gems/faraday-0.9.2/lib/faraday/request/retry.rb +0 -154
  39. data/.gs/gems/faraday-0.9.2/lib/faraday/request/token_authentication.rb +0 -15
  40. data/.gs/gems/faraday-0.9.2/lib/faraday/request/url_encoded.rb +0 -36
  41. data/.gs/gems/faraday-0.9.2/lib/faraday/request.rb +0 -92
  42. data/.gs/gems/faraday-0.9.2/lib/faraday/response/logger.rb +0 -59
  43. data/.gs/gems/faraday-0.9.2/lib/faraday/response/raise_error.rb +0 -21
  44. data/.gs/gems/faraday-0.9.2/lib/faraday/response.rb +0 -93
  45. data/.gs/gems/faraday-0.9.2/lib/faraday/upload_io.rb +0 -67
  46. data/.gs/gems/faraday-0.9.2/lib/faraday/utils.rb +0 -309
  47. data/.gs/gems/faraday-0.9.2/lib/faraday.rb +0 -268
  48. data/.gs/gems/minitest-5.9.0/.autotest +0 -34
  49. data/.gs/gems/minitest-5.9.0/History.rdoc +0 -1176
  50. data/.gs/gems/minitest-5.9.0/Manifest.txt +0 -26
  51. data/.gs/gems/minitest-5.9.0/README.rdoc +0 -656
  52. data/.gs/gems/minitest-5.9.0/Rakefile +0 -72
  53. data/.gs/gems/minitest-5.9.0/design_rationale.rb +0 -52
  54. data/.gs/gems/minitest-5.9.0/lib/hoe/minitest.rb +0 -26
  55. data/.gs/gems/minitest-5.9.0/lib/minitest/assertions.rb +0 -674
  56. data/.gs/gems/minitest-5.9.0/lib/minitest/autorun.rb +0 -13
  57. data/.gs/gems/minitest-5.9.0/lib/minitest/benchmark.rb +0 -424
  58. data/.gs/gems/minitest-5.9.0/lib/minitest/expectations.rb +0 -284
  59. data/.gs/gems/minitest-5.9.0/lib/minitest/hell.rb +0 -17
  60. data/.gs/gems/minitest-5.9.0/lib/minitest/mock.rb +0 -232
  61. data/.gs/gems/minitest-5.9.0/lib/minitest/parallel.rb +0 -69
  62. data/.gs/gems/minitest-5.9.0/lib/minitest/pride.rb +0 -4
  63. data/.gs/gems/minitest-5.9.0/lib/minitest/pride_plugin.rb +0 -142
  64. data/.gs/gems/minitest-5.9.0/lib/minitest/spec.rb +0 -331
  65. data/.gs/gems/minitest-5.9.0/lib/minitest/test.rb +0 -284
  66. data/.gs/gems/minitest-5.9.0/lib/minitest/unit.rb +0 -45
  67. data/.gs/gems/minitest-5.9.0/lib/minitest.rb +0 -815
  68. data/.gs/gems/minitest-5.9.0/test/minitest/metametameta.rb +0 -90
  69. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_benchmark.rb +0 -137
  70. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_mock.rb +0 -512
  71. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_reporter.rb +0 -281
  72. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_spec.rb +0 -967
  73. data/.gs/gems/minitest-5.9.0/test/minitest/test_minitest_test.rb +0 -1983
  74. data/.gs/gems/multi_json-1.12.1/CHANGELOG.md +0 -245
  75. data/.gs/gems/multi_json-1.12.1/CONTRIBUTING.md +0 -46
  76. data/.gs/gems/multi_json-1.12.1/LICENSE.md +0 -20
  77. data/.gs/gems/multi_json-1.12.1/README.md +0 -121
  78. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter.rb +0 -49
  79. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapter_error.rb +0 -15
  80. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/gson.rb +0 -20
  81. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/jr_jackson.rb +0 -25
  82. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_common.rb +0 -23
  83. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_gem.rb +0 -11
  84. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/json_pure.rb +0 -11
  85. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/nsjsonserialization.rb +0 -32
  86. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/oj.rb +0 -25
  87. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/ok_json.rb +0 -23
  88. data/.gs/gems/multi_json-1.12.1/lib/multi_json/adapters/yajl.rb +0 -19
  89. data/.gs/gems/multi_json-1.12.1/lib/multi_json/convertible_hash_keys.rb +0 -43
  90. data/.gs/gems/multi_json-1.12.1/lib/multi_json/options.rb +0 -39
  91. data/.gs/gems/multi_json-1.12.1/lib/multi_json/options_cache.rb +0 -29
  92. data/.gs/gems/multi_json-1.12.1/lib/multi_json/parse_error.rb +0 -17
  93. data/.gs/gems/multi_json-1.12.1/lib/multi_json/vendor/okjson.rb +0 -606
  94. data/.gs/gems/multi_json-1.12.1/lib/multi_json/version.rb +0 -17
  95. data/.gs/gems/multi_json-1.12.1/lib/multi_json.rb +0 -161
  96. data/.gs/gems/multi_json-1.12.1/multi_json.gemspec +0 -20
  97. data/.gs/gems/multipart-post-2.0.0/.gitignore +0 -6
  98. data/.gs/gems/multipart-post-2.0.0/.travis.yml +0 -7
  99. data/.gs/gems/multipart-post-2.0.0/Gemfile +0 -14
  100. data/.gs/gems/multipart-post-2.0.0/History.txt +0 -60
  101. data/.gs/gems/multipart-post-2.0.0/Manifest.txt +0 -9
  102. data/.gs/gems/multipart-post-2.0.0/README.md +0 -77
  103. data/.gs/gems/multipart-post-2.0.0/Rakefile +0 -9
  104. data/.gs/gems/multipart-post-2.0.0/lib/composite_io.rb +0 -108
  105. data/.gs/gems/multipart-post-2.0.0/lib/multipart_post.rb +0 -9
  106. data/.gs/gems/multipart-post-2.0.0/lib/multipartable.rb +0 -29
  107. data/.gs/gems/multipart-post-2.0.0/lib/net/http/post/multipart.rb +0 -27
  108. data/.gs/gems/multipart-post-2.0.0/lib/parts.rb +0 -96
  109. data/.gs/gems/multipart-post-2.0.0/multipart-post.gemspec +0 -22
  110. data/.gs/gems/multipart-post-2.0.0/test/multibyte.txt +0 -1
  111. data/.gs/gems/multipart-post-2.0.0/test/net/http/post/test_multipart.rb +0 -110
  112. data/.gs/gems/multipart-post-2.0.0/test/test_composite_io.rb +0 -115
  113. data/.gs/gems/multipart-post-2.0.0/test/test_parts.rb +0 -86
  114. data/.gs/specifications/faraday-0.9.2.gemspec +0 -31
  115. data/.gs/specifications/minitest-5.9.0.gemspec +0 -39
  116. data/.gs/specifications/multi_json-1.12.1.gemspec +0 -33
  117. data/.gs/specifications/multipart-post-2.0.0.gemspec +0 -22
  118. data/.ruby-version +0 -1
@@ -1,161 +0,0 @@
1
- require 'multi_json/options'
2
- require 'multi_json/version'
3
- require 'multi_json/adapter_error'
4
- require 'multi_json/parse_error'
5
- require 'multi_json/options_cache'
6
-
7
- module MultiJson
8
- include Options
9
- extend self
10
-
11
- def default_options=(value)
12
- Kernel.warn "MultiJson.default_options setter is deprecated\n" \
13
- 'Use MultiJson.load_options and MultiJson.dump_options instead'
14
-
15
- self.load_options = self.dump_options = value
16
- end
17
-
18
- def default_options
19
- Kernel.warn "MultiJson.default_options is deprecated\n" \
20
- 'Use MultiJson.load_options or MultiJson.dump_options instead'
21
-
22
- load_options
23
- end
24
-
25
- %w(cached_options reset_cached_options!).each do |method_name|
26
- define_method method_name do |*|
27
- Kernel.warn "MultiJson.#{method_name} method is deprecated and no longer used."
28
- end
29
- end
30
-
31
- ALIASES = {'jrjackson' => 'jr_jackson'}
32
-
33
- REQUIREMENT_MAP = [
34
- [:oj, 'oj'],
35
- [:yajl, 'yajl'],
36
- [:jr_jackson, 'jrjackson'],
37
- [:json_gem, 'json/ext'],
38
- [:gson, 'gson'],
39
- [:json_pure, 'json/pure'],
40
- ]
41
-
42
- # The default adapter based on what you currently
43
- # have loaded and installed. First checks to see
44
- # if any adapters are already loaded, then checks
45
- # to see which are installed if none are loaded.
46
- def default_adapter
47
- return :oj if defined?(::Oj)
48
- return :yajl if defined?(::Yajl)
49
- return :jr_jackson if defined?(::JrJackson)
50
- return :json_gem if defined?(::JSON::JSON_LOADED)
51
- return :gson if defined?(::Gson)
52
-
53
- REQUIREMENT_MAP.each do |adapter, library|
54
- begin
55
- require library
56
- return adapter
57
- rescue ::LoadError
58
- next
59
- end
60
- end
61
-
62
- Kernel.warn '[WARNING] MultiJson is using the default adapter (ok_json). ' \
63
- 'We recommend loading a different JSON library to improve performance.'
64
-
65
- :ok_json
66
- end
67
- alias_method :default_engine, :default_adapter
68
-
69
- # Get the current adapter class.
70
- def adapter
71
- return @adapter if defined?(@adapter) && @adapter
72
-
73
- use nil # load default adapter
74
-
75
- @adapter
76
- end
77
- alias_method :engine, :adapter
78
-
79
- # Set the JSON parser utilizing a symbol, string, or class.
80
- # Supported by default are:
81
- #
82
- # * <tt>:oj</tt>
83
- # * <tt>:json_gem</tt>
84
- # * <tt>:json_pure</tt>
85
- # * <tt>:ok_json</tt>
86
- # * <tt>:yajl</tt>
87
- # * <tt>:nsjsonserialization</tt> (MacRuby only)
88
- # * <tt>:gson</tt> (JRuby only)
89
- # * <tt>:jr_jackson</tt> (JRuby only)
90
- def use(new_adapter)
91
- @adapter = load_adapter(new_adapter)
92
- ensure
93
- OptionsCache.reset
94
- end
95
- alias_method :adapter=, :use
96
- alias_method :engine=, :use
97
-
98
- def load_adapter(new_adapter)
99
- case new_adapter
100
- when String, Symbol
101
- load_adapter_from_string_name new_adapter.to_s
102
- when NilClass, FalseClass
103
- load_adapter default_adapter
104
- when Class, Module
105
- new_adapter
106
- else
107
- fail ::LoadError, new_adapter
108
- end
109
- rescue ::LoadError => exception
110
- raise AdapterError.build(exception)
111
- end
112
-
113
- # Decode a JSON string into Ruby.
114
- #
115
- # <b>Options</b>
116
- #
117
- # <tt>:symbolize_keys</tt> :: If true, will use symbols instead of strings for the keys.
118
- # <tt>:adapter</tt> :: If set, the selected adapter will be used for this call.
119
- def load(string, options = {})
120
- adapter = current_adapter(options)
121
- begin
122
- adapter.load(string, options)
123
- rescue adapter::ParseError => exception
124
- raise ParseError.build(exception, string)
125
- end
126
- end
127
- alias_method :decode, :load
128
-
129
- def current_adapter(options = {})
130
- if (new_adapter = options[:adapter])
131
- load_adapter(new_adapter)
132
- else
133
- adapter
134
- end
135
- end
136
-
137
- # Encodes a Ruby object as JSON.
138
- def dump(object, options = {})
139
- current_adapter(options).dump(object, options)
140
- end
141
- alias_method :encode, :dump
142
-
143
- # Executes passed block using specified adapter.
144
- def with_adapter(new_adapter)
145
- old_adapter = adapter
146
- self.adapter = new_adapter
147
- yield
148
- ensure
149
- self.adapter = old_adapter
150
- end
151
- alias_method :with_engine, :with_adapter
152
-
153
- private
154
-
155
- def load_adapter_from_string_name(name)
156
- name = ALIASES.fetch(name, name)
157
- require "multi_json/adapters/#{name.downcase}"
158
- klass_name = name.to_s.split('_').map(&:capitalize) * ''
159
- MultiJson::Adapters.const_get(klass_name)
160
- end
161
- end
@@ -1,20 +0,0 @@
1
- # coding: utf-8
2
- require File.expand_path('../lib/multi_json/version.rb', __FILE__)
3
-
4
- Gem::Specification.new do |spec|
5
- spec.authors = ['Michael Bleigh', 'Josh Kalderimis', 'Erik Michaels-Ober', 'Pavel Pravosud']
6
- spec.cert_chain = %w(certs/rwz.pem)
7
- spec.summary = 'A common interface to multiple JSON libraries.'
8
- spec.description = 'A common interface to multiple JSON libraries, including Oj, Yajl, the JSON gem (with C-extensions), the pure-Ruby JSON gem, NSJSONSerialization, gson.rb, JrJackson, and OkJson.'
9
- spec.email = %w(michael@intridea.com josh.kalderimis@gmail.com sferik@gmail.com pavel@pravosud.com)
10
- spec.files = Dir['CHANGELOG.md', 'CONTRIBUTING.md', 'LICENSE.md', 'README.md', 'multi_json.gemspec', 'lib/**/*']
11
- spec.homepage = 'http://github.com/intridea/multi_json'
12
- spec.license = 'MIT'
13
- spec.name = 'multi_json'
14
- spec.require_path = 'lib'
15
- spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
16
- spec.version = MultiJson::Version
17
-
18
- spec.required_rubygems_version = '>= 1.3.5'
19
- spec.add_development_dependency 'bundler', '~> 1.0'
20
- end
@@ -1,6 +0,0 @@
1
- doc
2
- pkg
3
- *~
4
- *.swo
5
- *.swp
6
- /Gemfile.lock
@@ -1,7 +0,0 @@
1
- rvm:
2
- - 1.9.3
3
- - 2.0.0
4
- - jruby
5
- branches:
6
- only:
7
- - master
@@ -1,14 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- platforms :mri_19 do
5
- gem 'ruby-debug19'
6
- end
7
-
8
- platforms :mri_18 do
9
- gem 'ruby-debug'
10
- end
11
-
12
- group :development, :test do
13
- gem 'rake'
14
- end
@@ -1,60 +0,0 @@
1
- === 2.0.0 / 2013-12-21
2
-
3
- - Drop Ruby 1.8 compatibility
4
- - GH #21: Fix FilePart length calculation for Ruby 1.9 when filename contains
5
- multibyte characters (hexfet)
6
- - GH #20: Ensure upload responds to both #content_type and #original_filename
7
- (Steven Davidovitz)
8
- - GH #31: Support setting headers on any part of the request (Socrates Vicente)
9
- - GH #30: Support array values for params (Gustav Ernberg)
10
- - GH #32: Fix respond_to? signature (Leo Cassarani)
11
- - GH #33: Update README to markdown (Jagtesh Chadha)
12
- - GH #35: Improved handling of array-type parameters (Steffen Grunwald)
13
-
14
- === 1.2.0 / 2013-02-25
15
-
16
- - #25: Ruby 2 compatibility (thanks mislav)
17
-
18
- === 1.1.5 / 2012-02-12
19
-
20
- - Fix length/bytesize of parts in 1.9 (#7, #14) (Jason Moore)
21
- - Allow CompositeIO objects to be re-read by rewinding, like other IO
22
- objects. (Luke Redpath)
23
-
24
- === 1.1.4 / 2011-11-23
25
-
26
- - Non-functional changes in release (switch to Bundler gem tasks)
27
-
28
- === 1.1.3 / 2011-07-25
29
-
30
- - More configurable header specification for parts (Gerrit Riessen)
31
-
32
- === 1.1.2 / 2011-05-24
33
-
34
- - Fix CRLF file part miscalculation (Johannes Wagener)
35
- - Fix Epilogue CRLF issue (suggestion by Neil Spring)
36
-
37
- === 1.1.1 / 2011-05-13
38
-
39
- - GH# 9: Fixed Ruby 1.9.2 StringIO bug (thanks Alex Koppel)
40
-
41
- === 1.1.0 / 2011-01-11
42
-
43
- - API CHANGE: UploadIO.convert! removed in favor of UploadIO.new
44
- (Jeff Hodges)
45
-
46
- === 1.0.1 / 2010-04-27
47
-
48
- - Doc updates, make gemspec based on more modern Rubygems
49
-
50
- === 1.0 / 2009-02-12
51
-
52
- - Many fixes from mlooney, seems to work now. Putting the 0.9 seal of
53
- approval on it.
54
-
55
- === 0.1 / 2008-08-12
56
-
57
- * 1 major enhancement
58
-
59
- * Birthday!
60
-
@@ -1,9 +0,0 @@
1
- lib/composite_io.rb
2
- lib/multipartable.rb
3
- lib/parts.rb
4
- lib/net/http/post/multipart.rb
5
- Manifest.txt
6
- Rakefile
7
- README.txt
8
- test/test_composite_io.rb
9
- test/net/http/post/test_multipart.rb
@@ -1,77 +0,0 @@
1
- ## multipart-post
2
-
3
- * http://github.com/nicksieger/multipart-post
4
-
5
- ![build status](https://travis-ci.org/nicksieger/multipart-post.png)
6
-
7
- #### DESCRIPTION:
8
-
9
- Adds a streamy multipart form post capability to Net::HTTP. Also
10
- supports other methods besides POST.
11
-
12
- #### FEATURES/PROBLEMS:
13
-
14
- * Appears to actually work. A good feature to have.
15
- * Encapsulates posting of file/binary parts and name/value parameter parts, similar to
16
- most browsers' file upload forms.
17
- * Provides an UploadIO helper class to prepare IO objects for inclusion in the params
18
- hash of the multipart post object.
19
-
20
- #### SYNOPSIS:
21
-
22
- require 'net/http/post/multipart'
23
-
24
- url = URI.parse('http://www.example.com/upload')
25
- File.open("./image.jpg") do |jpg|
26
- req = Net::HTTP::Post::Multipart.new url.path,
27
- "file" => UploadIO.new(jpg, "image/jpeg", "image.jpg")
28
- res = Net::HTTP.start(url.host, url.port) do |http|
29
- http.request(req)
30
- end
31
- end
32
-
33
- To post multiple files or attachments, simply include multiple parameters with
34
- UploadIO values:
35
-
36
- require 'net/http/post/multipart'
37
-
38
- url = URI.parse('http://www.example.com/upload')
39
- req = Net::HTTP::Post::Multipart.new url.path,
40
- "file1" => UploadIO.new(File.new("./image.jpg"), "image/jpeg", "image.jpg"),
41
- "file2" => UploadIO.new(File.new("./image2.jpg"), "image/jpeg", "image2.jpg")
42
- res = Net::HTTP.start(url.host, url.port) do |http|
43
- http.request(req)
44
- end
45
-
46
- #### REQUIREMENTS:
47
-
48
- None
49
-
50
- #### INSTALL:
51
-
52
- gem install multipart-post
53
-
54
- #### LICENSE:
55
-
56
- (The MIT License)
57
-
58
- Copyright (c) 2007-2013 Nick Sieger <nick@nicksieger.com>
59
-
60
- Permission is hereby granted, free of charge, to any person obtaining
61
- a copy of this software and associated documentation files (the
62
- 'Software'), to deal in the Software without restriction, including
63
- without limitation the rights to use, copy, modify, merge, publish,
64
- distribute, sublicense, and/or sell copies of the Software, and to
65
- permit persons to whom the Software is furnished to do so, subject to
66
- the following conditions:
67
-
68
- The above copyright notice and this permission notice shall be
69
- included in all copies or substantial portions of the Software.
70
-
71
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
72
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
74
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
75
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
76
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
77
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,9 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- task :default => :test
4
-
5
- require 'rake/testtask'
6
- Rake::TestTask.new do |t|
7
- t.libs << "test"
8
- t.test_files = FileList['test/**/test*.rb']
9
- end
@@ -1,108 +0,0 @@
1
- #--
2
- # Copyright (c) 2007-2012 Nick Sieger.
3
- # See the file README.txt included with the distribution for
4
- # software license details.
5
- #++
6
-
7
- # Concatenate together multiple IO objects into a single, composite IO object
8
- # for purposes of reading as a single stream.
9
- #
10
- # Usage:
11
- #
12
- # crio = CompositeReadIO.new(StringIO.new('one'), StringIO.new('two'), StringIO.new('three'))
13
- # puts crio.read # => "onetwothree"
14
- #
15
- class CompositeReadIO
16
- # Create a new composite-read IO from the arguments, all of which should
17
- # respond to #read in a manner consistent with IO.
18
- def initialize(*ios)
19
- @ios = ios.flatten
20
- @index = 0
21
- end
22
-
23
- # Read from IOs in order until `length` bytes have been received.
24
- def read(length = nil, outbuf = nil)
25
- got_result = false
26
- outbuf = outbuf ? outbuf.replace("") : ""
27
-
28
- while io = current_io
29
- if result = io.read(length)
30
- got_result ||= !result.nil?
31
- result.force_encoding("BINARY") if result.respond_to?(:force_encoding)
32
- outbuf << result
33
- length -= result.length if length
34
- break if length == 0
35
- end
36
- advance_io
37
- end
38
- (!got_result && length) ? nil : outbuf
39
- end
40
-
41
- def rewind
42
- @ios.each { |io| io.rewind }
43
- @index = 0
44
- end
45
-
46
- private
47
-
48
- def current_io
49
- @ios[@index]
50
- end
51
-
52
- def advance_io
53
- @index += 1
54
- end
55
- end
56
-
57
- # Convenience methods for dealing with files and IO that are to be uploaded.
58
- class UploadIO
59
- # Create an upload IO suitable for including in the params hash of a
60
- # Net::HTTP::Post::Multipart.
61
- #
62
- # Can take two forms. The first accepts a filename and content type, and
63
- # opens the file for reading (to be closed by finalizer).
64
- #
65
- # The second accepts an already-open IO, but also requires a third argument,
66
- # the filename from which it was opened (particularly useful/recommended if
67
- # uploading directly from a form in a framework, which often save the file to
68
- # an arbitrarily named RackMultipart file in /tmp).
69
- #
70
- # Usage:
71
- #
72
- # UploadIO.new("file.txt", "text/plain")
73
- # UploadIO.new(file_io, "text/plain", "file.txt")
74
- #
75
- attr_reader :content_type, :original_filename, :local_path, :io, :opts
76
-
77
- def initialize(filename_or_io, content_type, filename = nil, opts = {})
78
- io = filename_or_io
79
- local_path = ""
80
- if io.respond_to? :read
81
- # in Ruby 1.9.2, StringIOs no longer respond to path
82
- # (since they respond to :length, so we don't need their local path, see parts.rb:41)
83
- local_path = filename_or_io.respond_to?(:path) ? filename_or_io.path : "local.path"
84
- else
85
- io = File.open(filename_or_io)
86
- local_path = filename_or_io
87
- end
88
- filename ||= local_path
89
-
90
- @content_type = content_type
91
- @original_filename = File.basename(filename)
92
- @local_path = local_path
93
- @io = io
94
- @opts = opts
95
- end
96
-
97
- def self.convert!(io, content_type, original_filename, local_path)
98
- raise ArgumentError, "convert! has been removed. You must now wrap IOs using:\nUploadIO.new(filename_or_io, content_type, filename=nil)\nPlease update your code."
99
- end
100
-
101
- def method_missing(*args)
102
- @io.send(*args)
103
- end
104
-
105
- def respond_to?(meth, include_all = false)
106
- @io.respond_to?(meth, include_all) || super(meth, include_all)
107
- end
108
- end
@@ -1,9 +0,0 @@
1
- #--
2
- # Copyright (c) 2007-2013 Nick Sieger.
3
- # See the file README.txt included with the distribution for
4
- # software license details.
5
- #++
6
-
7
- module MultipartPost
8
- VERSION = "2.0.0"
9
- end
@@ -1,29 +0,0 @@
1
- #--
2
- # Copyright (c) 2007-2013 Nick Sieger.
3
- # See the file README.txt included with the distribution for
4
- # software license details.
5
- #++
6
-
7
- require 'parts'
8
- module Multipartable
9
- DEFAULT_BOUNDARY = "-----------RubyMultipartPost"
10
- def initialize(path, params, headers={}, boundary = DEFAULT_BOUNDARY)
11
- headers = headers.clone # don't want to modify the original variable
12
- parts_headers = headers.delete(:parts) || {}
13
- super(path, headers)
14
- parts = params.map do |k,v|
15
- case v
16
- when Array
17
- v.map {|item| Parts::Part.new(boundary, k, item, parts_headers[k]) }
18
- else
19
- Parts::Part.new(boundary, k, v, parts_headers[k])
20
- end
21
- end.flatten
22
- parts << Parts::EpiloguePart.new(boundary)
23
- ios = parts.map {|p| p.to_io }
24
- self.set_content_type(headers["Content-Type"] || "multipart/form-data",
25
- { "boundary" => boundary })
26
- self.content_length = parts.inject(0) {|sum,i| sum + i.length }
27
- self.body_stream = CompositeReadIO.new(*ios)
28
- end
29
- end
@@ -1,27 +0,0 @@
1
- #--
2
- # Copyright (c) 2007-2012 Nick Sieger.
3
- # See the file README.txt included with the distribution for
4
- # software license details.
5
- #++
6
-
7
- require 'net/http'
8
- require 'stringio'
9
- require 'cgi'
10
- require 'composite_io'
11
- require 'multipartable'
12
- require 'parts'
13
-
14
- module Net #:nodoc:
15
- class HTTP #:nodoc:
16
- class Put
17
- class Multipart < Put
18
- include Multipartable
19
- end
20
- end
21
- class Post #:nodoc:
22
- class Multipart < Post
23
- include Multipartable
24
- end
25
- end
26
- end
27
- end
@@ -1,96 +0,0 @@
1
- #--
2
- # Copyright (c) 2007-2013 Nick Sieger.
3
- # See the file README.txt included with the distribution for
4
- # software license details.
5
- #++
6
-
7
- module Parts
8
- module Part #:nodoc:
9
- def self.new(boundary, name, value, headers = {})
10
- headers ||= {} # avoid nil values
11
- if file?(value)
12
- FilePart.new(boundary, name, value, headers)
13
- else
14
- ParamPart.new(boundary, name, value, headers)
15
- end
16
- end
17
-
18
- def self.file?(value)
19
- value.respond_to?(:content_type) && value.respond_to?(:original_filename)
20
- end
21
-
22
- def length
23
- @part.length
24
- end
25
-
26
- def to_io
27
- @io
28
- end
29
- end
30
-
31
- class ParamPart
32
- include Part
33
- def initialize(boundary, name, value, headers = {})
34
- @part = build_part(boundary, name, value, headers)
35
- @io = StringIO.new(@part)
36
- end
37
-
38
- def length
39
- @part.bytesize
40
- end
41
-
42
- def build_part(boundary, name, value, headers = {})
43
- part = ''
44
- part << "--#{boundary}\r\n"
45
- part << "Content-Disposition: form-data; name=\"#{name.to_s}\"\r\n"
46
- part << "Content-Type: #{headers["Content-Type"]}\r\n" if headers["Content-Type"]
47
- part << "\r\n"
48
- part << "#{value}\r\n"
49
- end
50
- end
51
-
52
- # Represents a part to be filled from file IO.
53
- class FilePart
54
- include Part
55
- attr_reader :length
56
- def initialize(boundary, name, io, headers = {})
57
- file_length = io.respond_to?(:length) ? io.length : File.size(io.local_path)
58
- @head = build_head(boundary, name, io.original_filename, io.content_type, file_length,
59
- io.respond_to?(:opts) ? io.opts.merge(headers) : headers)
60
- @foot = "\r\n"
61
- @length = @head.bytesize + file_length + @foot.length
62
- @io = CompositeReadIO.new(StringIO.new(@head), io, StringIO.new(@foot))
63
- end
64
-
65
- def build_head(boundary, name, filename, type, content_len, opts = {}, headers = {})
66
- trans_encoding = opts["Content-Transfer-Encoding"] || "binary"
67
- content_disposition = opts["Content-Disposition"] || "form-data"
68
-
69
- part = ''
70
- part << "--#{boundary}\r\n"
71
- part << "Content-Disposition: #{content_disposition}; name=\"#{name.to_s}\"; filename=\"#{filename}\"\r\n"
72
- part << "Content-Length: #{content_len}\r\n"
73
- if content_id = opts["Content-ID"]
74
- part << "Content-ID: #{content_id}\r\n"
75
- end
76
-
77
- if headers["Content-Type"] != nil
78
- part << "Content-Type: " + headers["Content-Type"] + "\r\n"
79
- else
80
- part << "Content-Type: #{type}\r\n"
81
- end
82
-
83
- part << "Content-Transfer-Encoding: #{trans_encoding}\r\n"
84
- part << "\r\n"
85
- end
86
- end
87
-
88
- # Represents the epilogue or closing boundary.
89
- class EpiloguePart
90
- include Part
91
- def initialize(boundary)
92
- @part = "--#{boundary}--\r\n\r\n"
93
- @io = StringIO.new(@part)
94
- end
95
- end
96
- end
@@ -1,22 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "multipart_post"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "multipart-post"
7
- s.version = MultipartPost::VERSION
8
- s.authors = ["Nick Sieger"]
9
- s.email = ["nick@nicksieger.com"]
10
- s.homepage = "https://github.com/nicksieger/multipart-post"
11
- s.summary = %q{A multipart form post accessory for Net::HTTP.}
12
- s.license = "MIT"
13
- s.description = %q{Use with Net::HTTP to do multipart form posts. IO values that have #content_type, #original_filename, and #local_path will be posted as a binary file.}
14
-
15
- s.rubyforge_project = "caldersphere"
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.rdoc_options = ["--main", "README.md", "-SHN", "-f", "darkfish"]
21
- s.require_paths = ["lib"]
22
- end
@@ -1 +0,0 @@
1
- ファイル