keepcon 0.1.1 → 0.1.2

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: a7a0fa69cc80ff684b2fa24dad62197c43797c5f
4
- data.tar.gz: ce37f8ea76108fda5ef7f2f4f41094d50523330e
3
+ metadata.gz: f093d11f5dc02d932d469116465fd8ee808a61be
4
+ data.tar.gz: 7c3b90f9ccda09f5b27e27346b972c1f3df86e3f
5
5
  SHA512:
6
- metadata.gz: 33da2e6573ffbe5a42816e663a356f8bdd244f11006c6d1e5391ff6c315d9f1fc13d3cbf1f538c5888473b7cc371d9392bdaeab7d3f7cb7d6302c08e6cfe52d5
7
- data.tar.gz: c9337e9353beb7ca87c8b8c91ca65c16bc3f39f3ef9a8aa716034cbba3bdefe38fda7fa68ab292e00667d468a3040cad945762bdc40389006b778d4ac2316870
6
+ metadata.gz: efe51e9cbe85a6e07b5eb769c2bde7052bc84e79048b871cccd830cf6c80453d80ec58f31e07dd3bd801d6ffbf82760f09566f4b2219c10f7832d49842c5d954
7
+ data.tar.gz: ee225c3e49b905b0902cfa7797ec196b294e84dbe9ca0e068d2ee04599ffc3fc49a7813752d5ff2e781ade9f7e088a9deed0f5611a5c50641d0016bea0ec4bd7
@@ -7,6 +7,10 @@ module Keepcon
7
7
  self.body = http_response.body
8
8
  self.status = http_response.status
9
9
  end
10
+
11
+ def data
12
+ @data ||= Hash.from_xml(body).first[1]
13
+ end
10
14
  end
11
15
  end
12
16
  end
@@ -50,8 +50,8 @@ module Keepcon
50
50
  def translate_to_xml_hash
51
51
  translation = translate.map do |k, v|
52
52
  case
53
- when k == :datetime then [k, { content!: (v.to_f * 1_000).to_i }]
54
53
  when k == :author then [k, { :@type => :author, :content! => v }]
54
+ when v.acts_like?(:time) then [k, { content!: (v.to_f * 1_000).to_i }]
55
55
  when v.is_a?(Fixnum) then [k, { content!: v }]
56
56
  else ["#{k}!", { content!: cdata_section(v) }]
57
57
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Keepcon
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
data/lib/keepcon.rb CHANGED
@@ -2,6 +2,7 @@ require 'yaml'
2
2
  require 'faraday'
3
3
  require 'active_support'
4
4
  require 'active_support/core_ext/object'
5
+ require 'active_support/core_ext/time'
5
6
 
6
7
  require 'keepcon/client'
7
8
  require 'keepcon/context'
@@ -1,12 +1,33 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Keepcon::Entity::Response do
4
+ let(:http_response) { Faraday::Response.new.finish(status: 200, body: body) }
5
+ let(:response) { described_class.new(http_response) }
6
+
4
7
  describe '.new' do
5
- subject { described_class.new(response) }
8
+ subject { response }
6
9
 
7
- let(:response) { Faraday::Response.new.finish(status: 200, body: 'ok') }
10
+ let(:body) { 'ok' }
8
11
 
9
12
  it { expect(subject.status).to eq(200) }
10
13
  it { expect(subject.body).to eq('ok') }
11
14
  end
15
+
16
+ describe '#data' do
17
+ subject { response.data }
18
+
19
+ let(:set_id) { '1d523f7e-f430-46dd-b126-980e385130ca' }
20
+ let(:body) do
21
+ <<-XML
22
+ <?xml version="1.0" encoding="UTF-8"?>
23
+ <response>
24
+ <status>OK</status>
25
+ <setId>#{set_id}</setId>
26
+ </response>
27
+ XML
28
+ end
29
+
30
+ it { is_expected.to include('status' => 'OK') }
31
+ it { is_expected.to include('setId' => set_id) }
32
+ end
12
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keepcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane O'Grady
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-21 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: retryable-rb