activeresource-response 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in activeresource-response.gemspec
4
+ gemspec
data/README ADDED
@@ -0,0 +1 @@
1
+ Read Me!!
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "activeresource-response/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "activeresource-response"
7
+ s.version = ActiveresourceResponse::VERSION
8
+ s.authors = ["Igor Fedoronchuk"]
9
+ s.email = ["fedoronchuk@gmail.com"]
10
+ s.homepage = "https://github.com/Fivell/activeresource-response"
11
+ s.summary = %q{activeresoure extension}
12
+ s.description = %q{create method for ActiveResource::Base object to access to response }
13
+
14
+
15
+ s.add_dependency('activeresource', '>= 3.1')
16
+
17
+ s.rubyforge_project = "activeresource-response"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ end
@@ -0,0 +1,35 @@
1
+ require "activeresource-response/version"
2
+ module ActiveresourceResponse
3
+ module AddResponseMethod
4
+ def self.included(base)
5
+ base.extend ClassMethods
6
+ end
7
+ module ClassMethods
8
+ def add_response_method(method_name = 'response')
9
+
10
+ connection.class_eval <<-EOS
11
+ alias_method :origin_handle_response, :handle_response
12
+ attr_reader :#{method_name}
13
+ def handle_response(response)
14
+ @#{method_name}= response
15
+ origin_handle_response(response)
16
+ end
17
+ EOS
18
+
19
+ class_eval <<-EOS
20
+ class << self
21
+ alias_method :origin_find, :find
22
+ def find(*arguments)
23
+ result = origin_find(*arguments)
24
+ result.class_eval("attr_reader :#{method_name}")
25
+ result.instance_variable_set(:"@#{method_name}", connection.#{method_name})
26
+ result
27
+ end
28
+ end
29
+ EOS
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ ActiveResource::Base.send :include, ActiveresourceResponse::AddResponseMethod
@@ -0,0 +1,3 @@
1
+ module ActiveresourceResponse
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeresource-response
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Igor Fedoronchuk
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-02-15 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: activeresource
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "3.1"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description: "create method for ActiveResource::Base object to access to response "
27
+ email:
28
+ - fedoronchuk@gmail.com
29
+ executables: []
30
+
31
+ extensions: []
32
+
33
+ extra_rdoc_files: []
34
+
35
+ files:
36
+ - .gitignore
37
+ - Gemfile
38
+ - README
39
+ - Rakefile
40
+ - activeresource-response.gemspec
41
+ - lib/activeresource-response.rb
42
+ - lib/activeresource-response/version.rb
43
+ homepage: https://github.com/Fivell/activeresource-response
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options: []
48
+
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: "0"
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ requirements: []
64
+
65
+ rubyforge_project: activeresource-response
66
+ rubygems_version: 1.8.13
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: activeresoure extension
70
+ test_files: []
71
+