api_hammer 0.0.1 → 0.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00317bcabfb56b81ee77f410ce7526af594a229f
4
- data.tar.gz: 1defdb0648ee78e474e14490c233995156868254
3
+ metadata.gz: d45ffaa15ffd8ab1a5de56bfb6dbae6db3e91889
4
+ data.tar.gz: 1e8305cd7ce714d558c7968680c25ab0bde0e450
5
5
  SHA512:
6
- metadata.gz: 31451099bc9e3ec9ed17f73d16089598c9d1c1bf63f882c2baa80b375ae8714f4da936b60a489a13b08ae8487840bdbe904e6cb4ff867daba92e66766161bfbe
7
- data.tar.gz: cf0e2d1a2a81d49465d15d9cce424ec2566d49a5710e3672a957e1e22a7979b964a000604eacac68d0e0c81a62895a0fcdd94d8c3acd1ad1ba52941c6cab017a
6
+ metadata.gz: fc16d15d0b8ca08659f067752fca417d1acaf6495ab4801b689b869661e37620f5d4a65ae4b60760af02fddcae171d5a7ad1a34342ecad7cc4c51ed0b4bb6e3a
7
+ data.tar.gz: f39a2705188c3ad4cd8ae5a77339e248e207b42470f19266c290eed55fbf7f326e5a72657dbe91d179fdfb3845a5bbd90acb384d1ec799207ae68c8d9c48399d
data/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # 0.0.2
2
+
3
+ - Weblink#to_s
4
+
5
+ # 0.0.1
6
+
7
+ - rake gem:available_updates
8
+ - Rails#halt
9
+ - Rails#check_required_params
10
+ - Weblink
11
+ - RequestLogger
12
+ - ShowTextExceptions
13
+ - TrailingNewline
@@ -1,3 +1,3 @@
1
1
  module ApiHammer
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -101,6 +101,11 @@ module ApiHammer
101
101
  rel && other_rel && rel.downcase == other_rel.downcase
102
102
  end
103
103
 
104
+ # a string of this weblink, appropriate for adding to a Link header
105
+ def to_s
106
+ "<#{target_uri}>" + attributes.map { |k,v| %Q(; #{k}="#{v}") }.join('')
107
+ end
108
+
104
109
  private
105
110
  # if uri is nil, returns nil; otherwise, tries to return a Addressable::URI
106
111
  def to_addressable_uri(uri)
data/test/weblink_test.rb CHANGED
@@ -66,5 +66,18 @@ describe ApiHammer::Weblink do
66
66
  assert_raises(ApiHammer::Weblink::ParseError) { ApiHammer::Weblink.parse_link_value(example) }
67
67
  end
68
68
  end
69
+
70
+ describe '#to_s' do
71
+ it 'makes a string' do
72
+ link = ApiHammer::Weblink.new('http://example.com', :rel => 'foo', :title => 'example', 'title*' => 'an example')
73
+ assert_equal(%q(<http://example.com>; rel="foo"; title="example"; title*="an example"), link.to_s)
74
+ end
75
+ it 'parses the string to the same values' do
76
+ link = ApiHammer::Weblink.new('http://example.com', 'rel' => 'foo', 'title' => 'example', 'title*' => 'an example')
77
+ parsed_link = ApiHammer::Weblink.parse_link_value(link.to_s).first
78
+ assert_equal(link.target_uri, parsed_link.target_uri)
79
+ assert_equal(link.attributes, parsed_link.attributes)
80
+ end
81
+ end
69
82
  end
70
83
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_hammer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-29 00:00:00.000000000 Z
11
+ date: 2014-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -145,6 +145,7 @@ extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
147
  - ".simplecov"
148
+ - CHANGELOG.md
148
149
  - LICENSE.txt
149
150
  - README.md
150
151
  - Rakefile.rb