citygrid_api 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.26
1
+ 0.0.27
data/citygrid_api.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "citygrid_api"
8
- s.version = "0.0.26"
8
+ s.version = "0.0.27"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Elpizo Choi"]
12
- s.date = "2013-02-26"
12
+ s.date = "2013-07-18"
13
13
  s.description = "Ruby wrapper for CityGrid APIs"
14
14
  s.email = "fu7iin@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -79,6 +79,7 @@ Gem::Specification.new do |s|
79
79
  "lib/citygrid/api/accounts.rb",
80
80
  "lib/citygrid/api/accounts/account.rb",
81
81
  "lib/citygrid/api/accounts/authentication.rb",
82
+ "lib/citygrid/api/accounts/login.rb",
82
83
  "lib/citygrid/api/accounts/method_of_payment.rb",
83
84
  "lib/citygrid/api/accounts/temp_impersonation.rb",
84
85
  "lib/citygrid/api/accounts/user.rb",
data/lib/citygrid.rb CHANGED
@@ -70,7 +70,7 @@ class CityGrid
70
70
  end
71
71
 
72
72
  def authenticate params
73
- API::Accounts::User.login params
73
+ API::Accounts::Login.login params
74
74
  end
75
75
  alias_method :login, :authenticate
76
76
 
@@ -96,6 +96,7 @@ class CityGrid
96
96
  # if value is a plain String, that's the endpoint
97
97
  endpoint = v.start_with?("/") ? v : "/#{v}"
98
98
  klass.endpoint endpoint
99
+ klass.newendpoint endpoint
99
100
  klass.base_uri default_hostname
100
101
  elsif v.is_a? Hash
101
102
  # if value is a Hash, fetch endpoint
@@ -103,9 +104,13 @@ class CityGrid
103
104
  # otherwise if ssl is set then use ssl_hostname. fallback to default_hostname
104
105
  hostname = v["hostname"] || (v["ssl"] ? ssl_hostname : default_hostname)
105
106
  throw ParseConfigurationError.new file_path, "No endpoint defined for #{k}" unless v["endpoint"]
107
+ newendpoint = v["newendpoint"] ? v["newendpoint"] : v["endpoint"]
106
108
  endpoint = v["endpoint"].start_with?("/") ? v["endpoint"] : "/#{v["endpoint"]}"
109
+
110
+ newendpoint = newendpoint.start_with?("/") ? newendpoint : "/#{newendpoint}"
107
111
  klass.endpoint endpoint
108
112
  klass.base_uri hostname
113
+ klass.newendpoint newendpoint
109
114
  else
110
115
  # should not get here. value should be String or Hash
111
116
  throw ParseConfigurationError.new file_path, "Invalid value type for #{k}"
@@ -160,4 +165,4 @@ require "citygrid/api/advertising"
160
165
  require "citygrid/api/ads"
161
166
  require "citygrid/api/content"
162
167
 
163
- require "request_ext"
168
+ require "request_ext"
data/lib/citygrid/api.rb CHANGED
@@ -62,6 +62,11 @@ class CityGrid
62
62
  @endpoint = val
63
63
  end
64
64
 
65
+ def newendpoint val = nil
66
+ return @newendpoint unless val
67
+ @newendpoint = val
68
+ end
69
+
65
70
  def request options = {}
66
71
  method = (options.delete(:method) || :get).to_sym
67
72
  query = options.merge :format => :json
@@ -0,0 +1,14 @@
1
+ class CityGrid
2
+ class API
3
+ class Accounts
4
+ class Login < Accounts
5
+ def self.login options = {}
6
+ request_and_handle :post,
7
+ "#{endpoint}/login",
8
+ :query => options,
9
+ :headers => merge_headers()
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -5,12 +5,12 @@ class CityGrid
5
5
  include CityGrid::API::Mutable
6
6
  include CityGrid::API::Searchable
7
7
 
8
- def self.login options = {}
9
- request_and_handle :post,
10
- "#{endpoint}/login",
11
- :query => options,
12
- :headers => merge_headers()
13
- end
8
+ # def self.login options = {}
9
+ # request_and_handle :post,
10
+ # "#{endpoint}/login",
11
+ # :query => options,
12
+ # :headers => merge_headers()
13
+ # end
14
14
 
15
15
  # login behaves weird right now - expects string as body, not json encoded.
16
16
  # define_action :login, :post, "login", :auth_token => false, :format => false
@@ -19,4 +19,4 @@ class CityGrid
19
19
  end
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -26,7 +26,7 @@ class CityGrid
26
26
  end
27
27
 
28
28
  def login username, password
29
- res = CityGrid::API::Accounts::User.login :username => username, :password => password
29
+ res = CityGrid::API::Accounts::Login.login :username => username, :password => password
30
30
  self.username = username
31
31
 
32
32
 
@@ -58,4 +58,4 @@ class CityGrid
58
58
  end
59
59
  end
60
60
  end
61
- end
61
+ end
metadata CHANGED
@@ -1,127 +1,168 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: citygrid_api
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.27
4
5
  prerelease:
5
- version: 0.0.26
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Elpizo Choi
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-02-26 00:00:00 +05:30
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2013-07-18 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: httparty
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
24
21
  version: 0.8.1
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: json
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.8.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: json
32
+ requirement: !ruby/object:Gem::Requirement
31
33
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
35
37
  version: 1.5.3
36
38
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: riot
40
39
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.5.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: riot
48
+ requirement: !ruby/object:Gem::Requirement
42
49
  none: false
43
- requirements:
50
+ requirements:
44
51
  - - ~>
45
- - !ruby/object:Gem::Version
52
+ - !ruby/object:Gem::Version
46
53
  version: 0.12.4
47
54
  type: :runtime
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: jeweler
51
55
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.12.4
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ requirement: !ruby/object:Gem::Requirement
53
65
  none: false
54
- requirements:
66
+ requirements:
55
67
  - - ~>
56
- - !ruby/object:Gem::Version
68
+ - !ruby/object:Gem::Version
57
69
  version: 1.6.2
58
70
  type: :development
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: rcov
62
71
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
64
73
  none: false
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.6.2
78
+ - !ruby/object:Gem::Dependency
79
+ name: rcov
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
69
86
  type: :development
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: vcr
73
87
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: vcr
96
+ requirement: !ruby/object:Gem::Requirement
75
97
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: "0"
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
80
102
  type: :development
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
83
- name: webmock
84
103
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: webmock
112
+ requirement: !ruby/object:Gem::Requirement
86
113
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: "0"
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
91
118
  type: :development
92
- version_requirements: *id007
93
- - !ruby/object:Gem::Dependency
94
- name: rdoc
95
119
  prerelease: false
96
- requirement: &id008 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: rdoc
128
+ requirement: !ruby/object:Gem::Requirement
97
129
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: "0"
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
102
134
  type: :development
103
- version_requirements: *id008
104
- - !ruby/object:Gem::Dependency
105
- name: rspec
106
135
  prerelease: false
107
- requirement: &id009 !ruby/object:Gem::Requirement
136
+ version_requirements: !ruby/object:Gem::Requirement
108
137
  none: false
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: "0"
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rspec
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
113
150
  type: :development
114
- version_requirements: *id009
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
115
158
  description: Ruby wrapper for CityGrid APIs
116
159
  email: fu7iin@gmail.com
117
160
  executables: []
118
-
119
161
  extensions: []
120
-
121
- extra_rdoc_files:
162
+ extra_rdoc_files:
122
163
  - LICENSE.txt
123
164
  - README.rdoc
124
- files:
165
+ files:
125
166
  - .document
126
167
  - .sass-cache/7a5a675d951455410512a59af5ab2d160bd1735c/test.scssc
127
168
  - .sass-cache/c6f2c767b164f077e5b9fb1f18a7886d7c755211/test.scssc
@@ -184,6 +225,7 @@ files:
184
225
  - lib/citygrid/api/accounts.rb
185
226
  - lib/citygrid/api/accounts/account.rb
186
227
  - lib/citygrid/api/accounts/authentication.rb
228
+ - lib/citygrid/api/accounts/login.rb
187
229
  - lib/citygrid/api/accounts/method_of_payment.rb
188
230
  - lib/citygrid/api/accounts/temp_impersonation.rb
189
231
  - lib/citygrid/api/accounts/user.rb
@@ -274,33 +316,29 @@ files:
274
316
  - views/_test_result.haml
275
317
  - views/stylesheets/test.scss
276
318
  - views/test.haml
277
- has_rdoc: true
278
319
  homepage:
279
- licenses:
320
+ licenses:
280
321
  - MIT
281
322
  post_install_message:
282
323
  rdoc_options: []
283
-
284
- require_paths:
324
+ require_paths:
285
325
  - lib
286
- required_ruby_version: !ruby/object:Gem::Requirement
326
+ required_ruby_version: !ruby/object:Gem::Requirement
287
327
  none: false
288
- requirements:
289
- - - ">="
290
- - !ruby/object:Gem::Version
291
- version: "0"
292
- required_rubygems_version: !ruby/object:Gem::Requirement
328
+ requirements:
329
+ - - ! '>='
330
+ - !ruby/object:Gem::Version
331
+ version: '0'
332
+ required_rubygems_version: !ruby/object:Gem::Requirement
293
333
  none: false
294
- requirements:
295
- - - ">="
296
- - !ruby/object:Gem::Version
297
- version: "0"
334
+ requirements:
335
+ - - ! '>='
336
+ - !ruby/object:Gem::Version
337
+ version: '0'
298
338
  requirements: []
299
-
300
339
  rubyforge_project:
301
- rubygems_version: 1.6.2
340
+ rubygems_version: 1.8.25
302
341
  signing_key:
303
342
  specification_version: 3
304
343
  summary: Ruby wrapper for CityGrid APIs
305
344
  test_files: []
306
-