Class: URL::Service::Endpoint
- Inherits:
-
Object
- Object
- URL::Service::Endpoint
- Includes:
- AcceptsEndpoint
- Defined in:
- lib/url/endpoint.rb
Defined Under Namespace
Classes: EndpointNotResponding, RequiredParameter
Constant Summary collapse
- BUILT_IN_MAP =
Define the built in methods and their fetcher aliases
{ :get => %w{find}, :post => %w{create}, :put => %w{update}, :delete => %w{destroy} }.each do |method,aliases| class_eval " def \#{method} params = {}, opts = {}\n u = @url.dup\n u.params.merge! params\n\n u.\#{method} opts\n end\n RUBY\n aliases.each do |al|\n class_eval <<-RUBY, __FILE__, __LINE__\n def \#{al} params={}, opts={}\n transform_response \#{method}(params, opts)\n end\n RUBY\n end\nend.freeze\n", __FILE__, __LINE__
- BUILT_IN_METHODS =
BUILT_IN_MAP.collect do |k,v| v.collect{|vv| vv.to_sym}+[k.to_sym] end.flatten.freeze
Instance Attribute Summary collapse
-
#inflate_into ⇒ Object
Returns the value of attribute inflate_into.
Instance Method Summary collapse
-
#class_eval(*args, &blk) ⇒ Object
Expose class eval externally.
- #eigenclass ⇒ Object
-
#initialize(url) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #inspect ⇒ Object
-
#method_inflate_into ⇒ Object
Storage for what each endpoint should inflate into.
Methods included from AcceptsEndpoint
Constructor Details
#initialize(url) ⇒ Endpoint
40 41 42 |
# File 'lib/url/endpoint.rb', line 40 def initialize url @base_url = @url = url end |
Instance Attribute Details
#inflate_into ⇒ Object
Returns the value of attribute inflate_into.
4 5 6 |
# File 'lib/url/endpoint.rb', line 4 def inflate_into @inflate_into end |
Instance Method Details
#class_eval(*args, &blk) ⇒ Object
Expose class eval externally
45 46 47 |
# File 'lib/url/endpoint.rb', line 45 def class_eval *args,&blk eigenclass.class_eval *args,&blk end |
#eigenclass ⇒ Object
49 50 51 |
# File 'lib/url/endpoint.rb', line 49 def eigenclass class << self; self; end end |
#inspect ⇒ Object
53 54 55 |
# File 'lib/url/endpoint.rb', line 53 def inspect %Q{#<#{self.class} #{@url.to_s}>} end |
#method_inflate_into ⇒ Object
Storage for what each endpoint should inflate into
8 9 10 |
# File 'lib/url/endpoint.rb', line 8 def method_inflate_into @method_inflate_into ||= {} end |