Skip to content

Commit

Permalink
Issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
wvk committed Oct 5, 2017
1 parent fc265cd commit 8caa8c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/refinery/api/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ def initialize
def connection
@_connection ||= ::Faraday.new(url: api_url,
headers: { "X-Refinery-Token" => api_token }) do |faraday|
faraday.request :multipart
faraday.request :json
faraday.request :url_encoded
faraday.request :multipart
faraday.adapter Faraday.default_adapter
end
end
Expand Down
6 changes: 2 additions & 4 deletions lib/refinery/api/images.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ def show(id:)
end

def create(image:)
config.connection.post images_path, image
config.connection.post(images_path, image)
end

def update(id:, image:)
config.connection.put(images_path(id)) do |req|
req.body = image.to_json
end
config.connection.put(images_path(id), image)
end

def destroy(id:)
Expand Down
10 changes: 3 additions & 7 deletions lib/refinery/api/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ def show(id:)
end

def create(resource:)
config.connection.post(resources_path) do |req|
req.body = resource.to_json
end
config.connection.post(resources_path, resource)
end

def update(id:, resource:)
config.connection.put(resources_path(id)) do |req|
req.body = resource.to_json
end
config.connection.put(resources_path(id), resource)
end

def destroy(id:)
Expand All @@ -37,4 +33,4 @@ def resources_path(id = nil)
end
end
end
end
end

0 comments on commit 8caa8c8

Please sign in to comment.