GitXplorerGitXplorer
A

faraday-encode_xml

public
1 stars
1 forks
1 issues

Commits

List of commits on branch main.
Unverified
dddd6676b946116716646eeede3724188145995c

Update rubocop to version 1.61.0

ddepfu[bot] committed a year ago
Verified
984fe6f4af057677c77c3f5f4f35eb2c1afd9a5f

Remake `VERSION` spec

AAlexWayfer committed a year ago
Verified
c8ab74d585f373a2ac35c25a4cd7bb055cbe7326

Lock RuboCop plugins versions more strict

AAlexWayfer committed a year ago
Verified
e63aac1534cecb7e709a0a7201996b82d0cf3699

Resolve new RuboCop offense

AAlexWayfer committed a year ago
Verified
507910126908b2bf47c75bb076150825937574e8

Remove JSON CI artifacts

AAlexWayfer committed a year ago
Unverified
cd0978be8aeea1524f00e63c477d3883fab8f5a1

Update rubocop to version 1.60.0

ddepfu[bot] committed a year ago

README

The README file for this repository.

Faraday Encode XML

Cirrus CI - Base Branch Build Status Codecov branch Code Climate Depfu Gem License

This repo is a Faraday middleware for encoding requests as XML. Faraday is an HTTP client library that provides a common interface for making requests.

Installation

Add this line to your application's Gemfile:

gem 'faraday-encode_xml'

And then execute:

bundle install

Or install it yourself as:

gem install faraday-encode_xml

Usage

require 'faraday/encode_xml'

connection = Faraday.new do |faraday|
  ## This gem only encodes requests
  faraday.request :xml

  ## For responses deconding use `faraday_middleware` gem and such code:
  # require 'faraday_middleware'
  # faraday.response :xml

  ## For example `httpbingo` responses as JSON, so let's enable it:
  require 'faraday_middleware'
  faraday.response :json
end

response = connection.post('https://httpbingo.org/post', { a: 1, b: 'foo', c: true })

puts response.body['data'] ## => <a>1</a><b>foo</b><c>true</c>

Gyoku options

The middleware uses gyoku gem for XML encoding.

You can pass options for it:

connection = Faraday.new do |faraday|
  ## https://www.rubydoc.info/gems/gyoku/#array-values
  faraday.request :xml, gyoku_options: { unwrap: true }
end

Development

After checking out the repo, run bundle install to install dependencies.

Then, run bundle exec rspec to run the tests.

To install this gem onto your local machine, run toys gem install.

To release a new version, run toys gem release %version%. See how it works here.

Contributing

Bug reports and pull requests are welcome on GitHub.

License

The gem is available as open source under the terms of the MIT License.