the-city-admin 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/index.rb +37 -23
- data/lib/common.rb +3 -0
- data/lib/the_city_admin.rb +3 -28
- data/thecity_admin_api.gemspec +1 -1
- metadata +1 -1
data/index.rb
CHANGED
|
@@ -8,8 +8,13 @@
|
|
|
8
8
|
require 'ruby-debug'
|
|
9
9
|
require File.dirname(__FILE__) + '/lib/the_city_admin.rb'
|
|
10
10
|
|
|
11
|
-
key = 'cf2903151e3213e66fd8080c7d8b65b1d6ccdd31'
|
|
12
|
-
token = '5c88b32edda7653c'
|
|
11
|
+
# key = 'cf2903151e3213e66fd8080c7d8b65b1d6ccdd31'
|
|
12
|
+
# token = '5c88b32edda7653c'
|
|
13
|
+
|
|
14
|
+
TCA_ENV = 'production'
|
|
15
|
+
|
|
16
|
+
key = '2bcee1fdccd31f1ef35a7c6708daf5a446a61ee3'
|
|
17
|
+
token = 'e37ae7fb2042a17b'
|
|
13
18
|
|
|
14
19
|
TheCity::AdminApi.connect(key, token)
|
|
15
20
|
|
|
@@ -71,28 +76,28 @@ TheCity::AdminApi.connect(key, token)
|
|
|
71
76
|
# end
|
|
72
77
|
|
|
73
78
|
|
|
74
|
-
puts "-----------------------------"
|
|
79
|
+
# puts "-----------------------------"
|
|
75
80
|
|
|
76
|
-
user_list = TheCity::UserList.new
|
|
81
|
+
# user_list = TheCity::UserList.new
|
|
77
82
|
|
|
78
|
-
user = user_list[0]
|
|
79
|
-
puts user.full_name
|
|
80
|
-
user.first = 'Wes'
|
|
81
|
-
puts user.full_name
|
|
82
|
-
user.save
|
|
83
|
-
puts user.id
|
|
83
|
+
# user = user_list[0]
|
|
84
|
+
# puts user.full_name
|
|
85
|
+
# user.first = 'Wes'
|
|
86
|
+
# puts user.full_name
|
|
87
|
+
# user.save
|
|
88
|
+
# puts user.id
|
|
84
89
|
|
|
85
|
-
user2 = TheCity::User.load_by_id(user.id)
|
|
86
|
-
puts user2.full_name
|
|
90
|
+
# user2 = TheCity::User.load_by_id(user.id)
|
|
91
|
+
# puts user2.full_name
|
|
87
92
|
|
|
88
|
-
puts "User has #{user.addresses.size} addresses"
|
|
89
|
-
puts "User has #{user.family.size} family members"
|
|
90
|
-
puts "User has #{user.notes.size} notes"
|
|
91
|
-
puts "User has #{user.roles.size} roles"
|
|
92
|
-
puts "User has #{user.skills.size} skills"
|
|
93
|
-
#puts "User has #{user.processes.size} processes"
|
|
94
|
-
puts "User has #{user.invitations.size} invitations"
|
|
95
|
-
#puts "User has #{user.admin_privileges.size} admin_privileges"
|
|
93
|
+
# puts "User has #{user.addresses.size} addresses"
|
|
94
|
+
# puts "User has #{user.family.size} family members"
|
|
95
|
+
# puts "User has #{user.notes.size} notes"
|
|
96
|
+
# puts "User has #{user.roles.size} roles"
|
|
97
|
+
# puts "User has #{user.skills.size} skills"
|
|
98
|
+
# #puts "User has #{user.processes.size} processes"
|
|
99
|
+
# puts "User has #{user.invitations.size} invitations"
|
|
100
|
+
# #puts "User has #{user.admin_privileges.size} admin_privileges"
|
|
96
101
|
|
|
97
102
|
|
|
98
103
|
# This is currenly returning a 404 if no family members are found
|
|
@@ -112,9 +117,9 @@ puts "User has #{user.invitations.size} invitations"
|
|
|
112
117
|
# puts group2.name
|
|
113
118
|
|
|
114
119
|
|
|
115
|
-
#
|
|
116
|
-
#
|
|
117
|
-
#
|
|
120
|
+
# puts "-----------------------------"
|
|
121
|
+
# puts "##### GROUPS #######"
|
|
122
|
+
# puts "-----------------------------"
|
|
118
123
|
|
|
119
124
|
# group_list = TheCity::GroupList.new
|
|
120
125
|
|
|
@@ -140,4 +145,13 @@ puts "User has #{user.invitations.size} invitations"
|
|
|
140
145
|
# end
|
|
141
146
|
|
|
142
147
|
|
|
148
|
+
puts "-----------------------------"
|
|
149
|
+
puts "##### SKILLS #######"
|
|
150
|
+
puts "-----------------------------"
|
|
151
|
+
|
|
152
|
+
skill_list = TheCity::SkillList.new
|
|
153
|
+
|
|
154
|
+
skill_list.each do |skill|
|
|
155
|
+
puts skill.name
|
|
156
|
+
end
|
|
143
157
|
|
data/lib/common.rb
CHANGED
data/lib/the_city_admin.rb
CHANGED
|
@@ -9,8 +9,9 @@ require 'typhoeus'
|
|
|
9
9
|
require 'json'
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
TCA_ENV = '
|
|
13
|
-
|
|
12
|
+
TCA_ENV = 'production' unless defined?(TCA_ENV)
|
|
13
|
+
THE_CITY_ADMIN_PATH = 'https://api.onthecity.org' unless defined?(THE_CITY_ADMIN_PATH)
|
|
14
|
+
THE_CITY_ADMIN_API_VERSION = 'application/vnd.thecity.admin.v1+json' unless defined?(THE_CITY_ADMIN_API_VERSION)
|
|
14
15
|
|
|
15
16
|
# The path to the lib directory.
|
|
16
17
|
THECITY_LIB_DIR = File.dirname(__FILE__)
|
|
@@ -18,32 +19,6 @@ THECITY_LIB_DIR = File.dirname(__FILE__)
|
|
|
18
19
|
# The path to the storage directory that will be used for caching data to disk.
|
|
19
20
|
THECITY_STORAGE_DIR = File.dirname(__FILE__) + '/../storage/'
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# TODO: This needs to be moved into a config file.
|
|
24
|
-
######################################################
|
|
25
|
-
if TCA_ENV == 'production'
|
|
26
|
-
raise 'Admin API path not set for production' # Delete this exception when set
|
|
27
|
-
THE_CITY_ADMIN_PATH = ''
|
|
28
|
-
THE_CITY_ADMIN_API_VERSION = 'application/vnd.thecity.admin.v1+json'
|
|
29
|
-
|
|
30
|
-
elsif TCA_ENV == 'development'
|
|
31
|
-
THE_CITY_ADMIN_PATH = 'http://0.0.0.0:9292'
|
|
32
|
-
THE_CITY_ADMIN_API_VERSION = 'application/vnd.thecity.admin.v1+json'
|
|
33
|
-
|
|
34
|
-
elsif TCA_ENV == 'staging'
|
|
35
|
-
THE_CITY_ADMIN_PATH = 'https://api.stagethecity.org'
|
|
36
|
-
THE_CITY_ADMIN_API_VERSION = 'application/vnd.thecity.admin.v1+json'
|
|
37
|
-
|
|
38
|
-
elsif TCA_ENV == 'test'
|
|
39
|
-
raise 'Admin API path not set for testing' # Delete this exception when set
|
|
40
|
-
THE_CITY_ADMIN_PATH = ''
|
|
41
|
-
THE_CITY_ADMIN_API_VERSION = 'application/vnd.thecity.admin.v1+json'
|
|
42
|
-
end
|
|
43
|
-
######################################################
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
22
|
require File.dirname(__FILE__) + '/auto_load.rb'
|
|
48
23
|
|
|
49
24
|
require File.dirname(__FILE__) + '/common.rb'
|
data/thecity_admin_api.gemspec
CHANGED