sawyer 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e6486ef818a2c154d9689334ec7f58ac3c31d7e9
4
+ data.tar.gz: ed05b3d65f572314eab8caf2e18ff37d47942e6a
5
+ SHA512:
6
+ metadata.gz: 20e8d49cf6d7c293273694c50219398a9608afdf6ed1bd29d065224f7bdcf7915492ee3a4f97fe9ddfd3fe9938c3e63fad62887cd2247c7c17fee9083cd94764
7
+ data.tar.gz: 015da8b80b1851daad32fa3e0679ac9e7f9eb80fa5b96518ffa41714524d7459d20837abc63f4f0463746907d23511128e146683bf5080420db44958139d969b
@@ -1,5 +1,5 @@
1
1
  module Sawyer
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
 
4
4
  class Error < StandardError; end
5
5
  end
@@ -140,6 +140,12 @@ module Sawyer
140
140
  def inspect
141
141
  %(<#{self.class} #{@endpoint}>)
142
142
  end
143
+
144
+ # private
145
+ def to_yaml_properties
146
+ [:@endpoint]
147
+ end
148
+
143
149
  end
144
150
  end
145
151
 
@@ -82,13 +82,15 @@ module Sawyer
82
82
  elsif attr_name && @_fields.include?(attr_name.to_sym)
83
83
  value = @attrs[attr_name.to_sym]
84
84
  case suffix
85
- when nil
86
- @_metaclass.send(:attr_accessor, attr_name)
87
- value
88
- when ATTR_PREDICATE then !!value
89
- end
85
+ when nil
86
+ @_metaclass.send(:attr_accessor, attr_name)
87
+ value
88
+ when ATTR_PREDICATE then !!value
89
+ end
90
90
  elsif suffix.nil? && SPECIAL_METHODS.include?(attr_name)
91
91
  instance_variable_get "@_#{attr_name}"
92
+ elsif attr_name && !@_fields.include?(attr_name.to_sym)
93
+ nil
92
94
  else
93
95
  super
94
96
  end
@@ -12,7 +12,5 @@ git commit --allow-empty -a -m "Release $version"
12
12
  git tag "v$version"
13
13
  git push origin
14
14
  git push origin "v$version"
15
- git push legacy
16
- git push legacy "v$version"
17
15
  gem push pkg/*-${version}.gem
18
16
 
@@ -149,6 +149,14 @@ module Sawyer
149
149
 
150
150
  assert_equal "This is plain text", res.data
151
151
  end
152
+
153
+ def test_handle_yaml_dump_and_load
154
+ assert_nothing_raised do
155
+ require 'yaml'
156
+ res = Agent.new 'http://example.com', :a => 1
157
+ YAML.load(YAML.dump(res))
158
+ end
159
+ end
152
160
  end
153
161
  end
154
162
 
@@ -93,6 +93,17 @@ module Sawyer
93
93
  assert res.respond_to?(:a=)
94
94
  end
95
95
 
96
+ def test_nillable_attribute_getters
97
+ res = Resource.new @agent, :a => 1
98
+ assert !res.key?(:b)
99
+ assert !res.respond_to?(:b)
100
+ assert !res.respond_to?(:b=)
101
+ assert_nil res.b
102
+ assert_nothing_raised do
103
+ res.b
104
+ end
105
+ end
106
+
96
107
  def test_dynamic_attribute_methods_from_setter
97
108
  res = Resource.new @agent, :a => 1
98
109
  assert !res.key?(:b)
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sawyer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.4.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Rick Olson
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-08-08 00:00:00.000000000 Z
12
+ date: 2013-09-18 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: faraday
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
@@ -26,7 +24,6 @@ dependencies:
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
28
  - - ~>
32
29
  - !ruby/object:Gem::Version
@@ -37,7 +34,6 @@ dependencies:
37
34
  - !ruby/object:Gem::Dependency
38
35
  name: uri_template
39
36
  requirement: !ruby/object:Gem::Requirement
40
- none: false
41
37
  requirements:
42
38
  - - ~>
43
39
  - !ruby/object:Gem::Version
@@ -45,7 +41,6 @@ dependencies:
45
41
  type: :runtime
46
42
  prerelease: false
47
43
  version_requirements: !ruby/object:Gem::Requirement
48
- none: false
49
44
  requirements:
50
45
  - - ~>
51
46
  - !ruby/object:Gem::Version
@@ -81,25 +76,24 @@ files:
81
76
  homepage: https://github.com/lostisland/sawyer
82
77
  licenses:
83
78
  - MIT
79
+ metadata: {}
84
80
  post_install_message:
85
81
  rdoc_options: []
86
82
  require_paths:
87
83
  - lib
88
84
  required_ruby_version: !ruby/object:Gem::Requirement
89
- none: false
90
85
  requirements:
91
- - - ! '>='
86
+ - - '>='
92
87
  - !ruby/object:Gem::Version
93
88
  version: '0'
94
89
  required_rubygems_version: !ruby/object:Gem::Requirement
95
- none: false
96
90
  requirements:
97
- - - ! '>='
91
+ - - '>='
98
92
  - !ruby/object:Gem::Version
99
93
  version: 1.3.5
100
94
  requirements: []
101
95
  rubyforge_project:
102
- rubygems_version: 1.8.23
96
+ rubygems_version: 2.0.3
103
97
  signing_key:
104
98
  specification_version: 2
105
99
  summary: Secret User Agent of HTTP