twitter 4.6.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,7 @@
1
+ 4.6.1
2
+ -----
3
+ * [Convert nested classes in `Twitter::Base#attrs`](https://github.com/sferik/twitter/commit/e56c34c640189eb8b25a16994676a5e82b783cb3) ([@anno](https://twitter.com/anno))
4
+
1
5
  4.6.0
2
6
  -----
3
7
  * [Make `Twitter::Base#attrs` call methods if they exist](https://github.com/sferik/twitter/commit/ff4f2daccd1acdfddcea7139d4dd6490b55129db)
@@ -94,7 +94,11 @@ module Twitter
94
94
  # @return [Hash]
95
95
  def attrs
96
96
  @attrs.inject({}) do |attrs, (key, value)|
97
- attrs.merge!(key => respond_to?(key) ? send(key) : value)
97
+ if value.respond_to?(:attrs)
98
+ attrs.merge!(key => value.attrs)
99
+ else
100
+ attrs.merge!(key => respond_to?(key) ? send(key) : value)
101
+ end
98
102
  end
99
103
  end
100
104
  alias to_hash attrs
@@ -2,7 +2,7 @@ module Twitter
2
2
  class Version
3
3
  MAJOR = 4 unless defined? Twitter::Version::MAJOR
4
4
  MINOR = 6 unless defined? Twitter::Version::MINOR
5
- PATCH = 0 unless defined? Twitter::Version::PATCH
5
+ PATCH = 1 unless defined? Twitter::Version::PATCH
6
6
  PRE = nil unless defined? Twitter::Version::PRE
7
7
 
8
8
  class << self
@@ -108,4 +108,15 @@ describe Twitter::Base do
108
108
  end
109
109
  end
110
110
 
111
+ describe '#attrs' do
112
+ it 'returns a hash of attributes' do
113
+ expect(Twitter::Base.new(:id => 1).attrs).to eq({:id => 1})
114
+ end
115
+
116
+ it 'converts nested classes' do
117
+ base = Twitter::Base.new(:id => 2, :user => Twitter::User.new(:id => 4))
118
+ expect(base.attrs).to eq({:id => 2, :user => {:id => 4}})
119
+ end
120
+ end
121
+
111
122
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 4.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -40,7 +40,7 @@ cert_chain:
40
40
  U0xxV3ZRUnNCbHlwSGZoczZKSnVMbHlaUEdoVTNSL3YKU2YzbFZLcEJDV2dS
41
41
  cEdUdnk0NVhWcEIrNTl5MzNQSm1FdVExUFRFT1l2UXlhbzlVS01BQWFBTi83
42
42
  cVdRdGpsMApobHc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
43
- date: 2013-03-08 00:00:00.000000000 Z
43
+ date: 2013-03-14 00:00:00.000000000 Z
44
44
  dependencies:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: faraday
metadata.gz.sig CHANGED
Binary file