Class: Ldp::Client
Defined Under Namespace
Modules: Methods
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes included from Methods
Instance Method Summary collapse
-
#find_or_initialize(subject, options = {}) ⇒ Object
Find or initialize a new LDP resource by URI.
-
#initialize(*args) ⇒ Client
constructor
A new instance of Client.
- #logger ⇒ Object
Methods included from Methods
#delete, #get, #head, #initialize_http_client, #patch, #post, #put
Constructor Details
#initialize(*args) ⇒ Client
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ldp/client.rb', line 12 def initialize(*args) http_client, = if args.length == 2 args elsif args.length == 1 && args.first.is_a?(Faraday::Connection) [args.first, {}] elsif args.length == 1 [nil, args.first] else raise ArgumentError end = initialize_http_client(http_client || ) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/ldp/client.rb', line 10 def end |
Instance Method Details
#find_or_initialize(subject, options = {}) ⇒ Object
Find or initialize a new LDP resource by URI
29 30 31 32 33 |
# File 'lib/ldp/client.rb', line 29 def find_or_initialize(subject, = {}) data = get(subject, ) Ldp::Resource.for(self, subject, data) end |
#logger ⇒ Object
35 36 37 |
# File 'lib/ldp/client.rb', line 35 def logger Ldp.logger end |