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
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ldp/client.rb', line 11 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.
9 10 11 |
# File 'lib/ldp/client.rb', line 9 def end |
Instance Method Details
#find_or_initialize(subject, options = {}) ⇒ Object
Find or initialize a new LDP resource by URI
28 29 30 31 32 |
# File 'lib/ldp/client.rb', line 28 def find_or_initialize(subject, = {}) data = get(subject, ) Ldp::Resource.for(self, subject, data) end |
#logger ⇒ Object
34 35 36 |
# File 'lib/ldp/client.rb', line 34 def logger Ldp.logger end |