runcible 1.0.5 → 1.0.6
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.
- data/lib/runcible/base.rb +17 -9
- data/lib/runcible/extensions/consumer.rb +7 -1
- data/lib/runcible/resources/content.rb +1 -2
- data/lib/runcible/version.rb +1 -1
- metadata +2 -2
data/lib/runcible/base.rb
CHANGED
@@ -82,7 +82,7 @@ module Runcible
|
|
82
82
|
|
83
83
|
args = [method]
|
84
84
|
args << generate_payload(options) if [:post, :put].include?(method)
|
85
|
-
args << headers
|
85
|
+
args << headers
|
86
86
|
|
87
87
|
response = get_response(client, path, *args)
|
88
88
|
process_response(response)
|
@@ -112,17 +112,25 @@ module Runcible
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def generate_payload(options)
|
115
|
-
if options[:payload]
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
if options[:payload].is_a?(String)
|
116
|
+
return options[:payload]
|
117
|
+
elsif options[:payload].is_a?(Hash)
|
118
|
+
format_payload_json(options[:payload])
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def format_payload_json(payload_hash)
|
123
|
+
if payload_hash
|
124
|
+
if payload_hash[:optional]
|
125
|
+
if payload_hash[:required]
|
126
|
+
payload = payload_hash[:required].merge(payload_hash[:optional])
|
119
127
|
else
|
120
|
-
payload =
|
128
|
+
payload = payload_hash[:optional]
|
121
129
|
end
|
122
|
-
elsif
|
123
|
-
payload =
|
130
|
+
elsif payload_hash[:delta]
|
131
|
+
payload = payload_hash
|
124
132
|
else
|
125
|
-
payload =
|
133
|
+
payload = payload_hash[:required]
|
126
134
|
end
|
127
135
|
else
|
128
136
|
payload = {}
|
@@ -137,7 +137,13 @@ module Runcible
|
|
137
137
|
units.each do |unit|
|
138
138
|
content_unit = {}
|
139
139
|
content_unit[:type_id] = type_id
|
140
|
-
|
140
|
+
if unit.is_a?(Hash)
|
141
|
+
#allow user to pass in entire unit
|
142
|
+
content_unit[:unit_key] = unit
|
143
|
+
else
|
144
|
+
content_unit[:unit_key] = { unit_key => unit }
|
145
|
+
end
|
146
|
+
|
141
147
|
content.push(content_unit)
|
142
148
|
end
|
143
149
|
end
|
@@ -50,8 +50,7 @@ module Runcible
|
|
50
50
|
# @param [File] content content of the file being uploaded to the server
|
51
51
|
# @return [RestClient::Response] none
|
52
52
|
def upload_bits(upload_id, offset, content)
|
53
|
-
|
54
|
-
call(:put, path("#{upload_id}/#{offset}/"), :payload => { :required => required })
|
53
|
+
call(:put, path("#{upload_id}/#{offset}/"), :payload => content)
|
55
54
|
end
|
56
55
|
|
57
56
|
# Import into a repository
|
data/lib/runcible/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runcible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|