acts_as_our_cities 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 514f2f0103d77d62ace9159d7234edbefff36a79
4
+ data.tar.gz: 02a17fc722f89a36bc0fe91a1ff15bd57046bafb
5
+ SHA512:
6
+ metadata.gz: 23d87f8896ba16aec72d2f744bd6490bc66e6e6cf45e03fbced80c662f11e4984cc3ca12faa2dd3e9ff4ddb809ce2285fa85a27d5d7fc556af34a80cfa95ea08
7
+ data.tar.gz: 92566974dc62b06d7372855dcd5c528756051db1398b4fe08cc15b0bb4cde7d1782a6efb77767ed4811aadb887fb9b6ec27df0e938f9e6a540e26262852a0a4f
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'ActsAsOurCities'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,4 @@
1
+ require 'active_resource'
2
+ require 'acts_as_our_cities/configuration'
3
+ require 'acts_as_our_cities/acts_as_our_cities_user'
4
+ require 'acts_as_our_cities/api/user'
@@ -0,0 +1,35 @@
1
+ module ActsAsOurCities
2
+ module ActsAsOurCitiesUser
3
+ extend ActiveSupport::Concern
4
+
5
+ module ClassMethods
6
+ def acts_as_our_cities_user
7
+ def self.create args={}
8
+ if ActsAsOurCities.api_mode
9
+ ActsAsOurCities::API::User.create args
10
+ else
11
+ super args
12
+ end
13
+ end
14
+
15
+ include ActsAsOurCities::ActsAsOurCitiesUser::LocalInstanceMethods
16
+ end
17
+ end
18
+
19
+ module LocalInstanceMethods
20
+ def name
21
+ "#{self.first_name} #{self.last_name}"
22
+ end
23
+
24
+ def avatar_url
25
+ if self.avatar
26
+ "https://#{ENV['ACCOUNTS_BUCKET']}.s3.amazonaws.com/uploads/user/avatar/#{self.id}/square_#{self.avatar}"
27
+ else
28
+ ActsAsOurCities.default_avatar_url
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ ActiveRecord::Base.send :include, ActsAsOurCities::ActsAsOurCitiesUser
@@ -0,0 +1,16 @@
1
+ module ActsAsOurCities
2
+ module API
3
+ class User < ActiveResource::Base
4
+ self.include_root_in_json = true
5
+
6
+ def self.headers
7
+ { 'Authorization' => "Token token=\"#{ActsAsOurCities.api_token}\"" }
8
+ end
9
+
10
+ def self.site
11
+ self.site = ActsAsOurCities.api_site
12
+ super
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ module ActsAsOurCities
2
+ mattr_accessor :default_avatar_url, :api_mode, :api_site, :api_token
3
+
4
+ def self.config(&block)
5
+ yield(self)
6
+ end
7
+
8
+ def self.api_mode
9
+ @@api_mode || false
10
+ end
11
+
12
+ def self.default_avatar_url
13
+ @@default_avatar_url || "http://i.imgur.com/7XqAySb.png"
14
+ end
15
+ end
@@ -0,0 +1,3 @@
1
+ module ActsAsOurCities
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :acts_as_our_cities do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: acts_as_our_cities
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Nícolas Iensen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 4.1.5
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '4.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 4.1.5
33
+ - !ruby/object:Gem::Dependency
34
+ name: activeresource
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 4.0.0
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '4.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 4.0.0
53
+ - !ruby/object:Gem::Dependency
54
+ name: sqlite3
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.3'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.3.9
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.3.9
73
+ - !ruby/object:Gem::Dependency
74
+ name: rspec-rails
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '3.1'
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 3.1.0
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.1'
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: 3.1.0
93
+ - !ruby/object:Gem::Dependency
94
+ name: coveralls
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '0.7'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: 0.7.1
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '0.7'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: 0.7.1
113
+ description: DRYing Our Cities projects by wrapping common behaviours
114
+ email:
115
+ - nicolas@nossascidades.org
116
+ executables: []
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - MIT-LICENSE
121
+ - Rakefile
122
+ - lib/acts_as_our_cities.rb
123
+ - lib/acts_as_our_cities/acts_as_our_cities_user.rb
124
+ - lib/acts_as_our_cities/api/user.rb
125
+ - lib/acts_as_our_cities/configuration.rb
126
+ - lib/acts_as_our_cities/version.rb
127
+ - lib/tasks/acts_as_our_cities_tasks.rake
128
+ homepage: https://github.com/meurio/acts_as_our_cities
129
+ licenses:
130
+ - MIT
131
+ metadata: {}
132
+ post_install_message:
133
+ rdoc_options: []
134
+ require_paths:
135
+ - lib
136
+ required_ruby_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 2.2.2
149
+ signing_key:
150
+ specification_version: 4
151
+ summary: ActsAsOurCities is a wrapper for Our Cities models
152
+ test_files: []