active_rest_client 1.1.9 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd42ad7d428093e385b492a421a17154204040a3
4
- data.tar.gz: e5b6ee744601dac89141d2bf306d8414cb590060
3
+ metadata.gz: 766e4e62410954391fd9831d0094365c87a13fc8
4
+ data.tar.gz: fd72f55e816449ce6e09b530259f01b345ae99c7
5
5
  SHA512:
6
- metadata.gz: 390b20696614bd583b7f981011ccce7c2ea979c6a4bb963d6d42e6d25ca2e15bfe41e8892120c46de35cad7a2a9e99fd6aee79ffd5c45793bd9ae379c18b818c
7
- data.tar.gz: 82ef457e99179083edd05b2043efdf297f1bbe9fcdef6f19aae3a4c0407058aa03d14f5982da5462a9ec6813e3880b7177d8c9be51066f65d98a04e487072e9d
6
+ metadata.gz: b770984b2b632d6b5bedf7169def7153c8208f416d6725da64386bcdcd74b485fbb89c97d070c9b208b5ebadc38af3d124ffd878176d9ab2392e531e943b5cdd
7
+ data.tar.gz: d71c3d0c69bdce2431e82323450d52bd18fcf6a22765bdfebc3b48208f9ef8640f2a2390250069c479a390257f498bc4ca268787c851674bd5a20ebdbab95de0
data/README.md CHANGED
@@ -760,6 +760,61 @@ class Article < ActiveRestClient::Base
760
760
  end
761
761
  ```
762
762
 
763
+ ## Beta Features
764
+
765
+ ### XML Responses
766
+
767
+ ActiveRestClient uses Crack to allow parsing of XML responses. For example, given an XML response of (with a content type of `application/xml` or `text/xml`):
768
+
769
+ ```xml
770
+ <?xml version="1.0" encoding="utf-8"?>
771
+ <feed xmlns="http://www.w3.org/2005/Atom">
772
+
773
+ <title>Example Feed</title>
774
+ <link href="http://example.org/"/>
775
+ <updated>2003-12-13T18:30:02Z</updated>
776
+ <author>
777
+ <name>John Doe</name>
778
+ </author>
779
+ <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
780
+
781
+ <entry>
782
+ <title>Atom-Powered Robots Run Amok</title>
783
+ <link href="http://example.org/2003/12/13/atom03"/>
784
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
785
+ <updated>2003-12-13T18:30:02Z</updated>
786
+ <summary>Some text.</summary>
787
+ </entry>
788
+
789
+ <entry>
790
+ <title>Something else cool happened</title>
791
+ <link href="http://example.org/2015/08/11/andyjeffries"/>
792
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6b</id>
793
+ <updated>2015-08-11T18:30:02Z</updated>
794
+ <summary>Some other text.</summary>
795
+ </entry>
796
+
797
+ </feed>
798
+ ```
799
+
800
+ You can use:
801
+
802
+ ```ruby
803
+ class Feed < ActiveRestClient::Base
804
+ base_url "http://www.example.com/v1/"
805
+ get :atom, "/atom"
806
+ end
807
+
808
+ @atom = Feed.atom
809
+
810
+ puts @atom.feed.title
811
+ puts @atom.feed.link.href
812
+ @atom.feed.entry.each do |entry|
813
+ puts "#{entry.title} -> #{entry.link.href}"
814
+ end
815
+ ```
816
+
817
+ For testing purposes, if you are using a `fake` content response when defining your endpoint, you should also provide `fake_content_type: "application/xml"` so that the parser knows to use XML parsing.
763
818
 
764
819
  ## Contributing
765
820
 
@@ -1,3 +1,3 @@
1
1
  module ActiveRestClient
2
- VERSION = "1.1.9"
2
+ VERSION = "1.1.10"
3
3
  end
@@ -45,6 +45,11 @@ describe XmlResponseExample do
45
45
  expect(@atom.feed.title).to eq("Example Feed")
46
46
  end
47
47
 
48
+ it "provides the link's href" do
49
+ @atom = XmlResponseExample.atom
50
+ expect(@atom.feed.link.href).to eq("http://example.org/")
51
+ end
52
+
48
53
  it "each entry item has a title" do
49
54
  @atom = XmlResponseExample.atom
50
55
  expect(@atom.feed.entry.class).to eq(ActiveRestClient::ResultIterator)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_rest_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
4
+ version: 1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Which Ltd
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-08-11 00:00:00.000000000 Z
12
+ date: 2015-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler