Module: Roar::Client

Includes:
HttpVerbs
Defined in:
lib/roar/client.rb

Overview

Mix in HttpVerbs.

Instance Attribute Summary

Attributes included from HttpVerbs

#transport_engine

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HttpVerbs

#delete, #get, included, #patch, #post, #put

Class Method Details

.extended(base) ⇒ Object

Add accessors for properties and collections to modules.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/roar/client.rb', line 10

def self.extended(base)
  base.instance_eval do
    representable_attrs.each do |attr|
      name = attr.name
      next if name == "links" # ignore hyperlinks.

      # TODO: could anyone please make this better?
      instance_eval %Q{
        def #{name}=(v)
          @#{name} = v
        end

        def #{name}
          @#{name}
        end
      }
    end
  end
end

Instance Method Details

#to_hash(options = {}) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/roar/client.rb', line 30

def to_hash(options={})
  # options[:links] ||= false
  options[:user_options] ||= {}
  options[:user_options][:links] ||= false

  super(options)
end

#to_xml(options = {}) ⇒ Object

sorry, but i’m not even sure if anyone uses this module.



38
39
40
41
42
43
# File 'lib/roar/client.rb', line 38

def to_xml(options={}) # sorry, but i'm not even sure if anyone uses this module.
  options[:user_options] ||= {}
  options[:user_options][:links] ||= false

  super(options)
end