rest_uri 1.0.0 → 1.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a19b7df93211dc0bb4fdd43bab6748c6a7c2ad5
4
- data.tar.gz: cf8df8c962fd7f4b3a6d7ea56d3e83c39661381f
3
+ metadata.gz: 828358b680f601e05ce0c047dcbd5decbb46d0ea
4
+ data.tar.gz: 7d5373018ad4cbd47a83cdefb9b615a429dc3fb4
5
5
  SHA512:
6
- metadata.gz: 804caf8124f65d100e1dad6d02efac8e88b0d1dd439d2a2cbb1328974411f87491b316ecf050068034525222cc994012919d9bb260a6a3009d799594b9353c08
7
- data.tar.gz: e012d8066f26706ebe4640bb7a0cc7b1b62a5b9dd4d54014a75d12e3c7cdaeb585a4a25dd3b0950e609a2981a15a27339b32db311bd9d2cd42a70764875cef05
6
+ metadata.gz: 04145d2dd38291353521bd1fc668b650bc753f8e7ed511a52471d7afe078b6dfb3a6da5ab4d2238aa18280e90e55eb8ced014d88fe6f0f5998ed7ea1ae99ce5e
7
+ data.tar.gz: 7649686b7a434cd2f5267269c8776f11d802523319da6b10face801b3cf1dfe4d412e55bab9e8e1c0012bb21d6358962233ed4d1bad98b2eb7849ef397d25c48
@@ -11,6 +11,11 @@ module RestUri
11
11
  class Base
12
12
  include Resource
13
13
  attr_accessor :uri, :parser, :identifier
14
+
15
+ # @param uri [String, URI]
16
+ # @param parser [Object] :parser URI parser such as Addressable::URI
17
+ # @param identifier [Symbol] :identifier Suffix of method name to specify resource
18
+ # @raise ArgumentError if `identifier` is empty
14
19
  def initialize(uri, parser: DEFAULT_PARSER, identifier: DEFAULT_IDENTIFIER)
15
20
  raise ArgumentError, 'Empty identifier' if not identifier.respond_to? :empty? or identifier.empty?
16
21
  @uri = uri
@@ -20,10 +25,7 @@ module RestUri
20
25
  end
21
26
 
22
27
  # Parse REST URI
23
- # @param uri [String, URI]
24
- # @param
25
- # @option options [Object] :parser URI parser such as Addressable::URI
26
- # @option options [Symbol] :identifier Suffix of method name to specify resource
28
+ # @see RestUri::Base#initialize
27
29
  # @example
28
30
  # require 'addressable/uri'
29
31
  # require 'rest_uri'
@@ -4,10 +4,11 @@ module RestUri
4
4
  module Resource
5
5
  # Take a URI string or URI object and return its ID
6
6
  # @example
7
- # resource_id = RestUri::Resource.resource_id('https://twitter.com/sferik/resource/540897316908331009/')
8
- # resource_id #=> 540897316908331009
7
+ # RestUri::Resource.resource_id('status', https://twitter.com/sferik/status/540897316908331009/')
8
+ # #=> 540897316908331009
9
9
  # @param name [String] Resource name
10
10
  # @param object [Integer, String, URI] An ID, URI, or object.
11
+ # @param
11
12
  # @option parser [Integer, String, URI] An ID, URI, or object.
12
13
  # @return [Integer, NilClass]
13
14
  def self.resource_id(name, object, parser: DEFAULT_PARSER)
@@ -12,7 +12,7 @@ module RestUri
12
12
  target.nil? ? target : target.to_i
13
13
  end
14
14
 
15
- # To support old style URL like http://twitter.com/#!/status/759813164686938117
15
+ # To support hashbang style URL like http://twitter.com/#!/status/759813164686938117
16
16
  # @param object [URI]
17
17
  # @return [String]
18
18
  def self.hashbang_path_or_path(object)
@@ -1,3 +1,3 @@
1
1
  module RestUri
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_uri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Yamamoto