neuron-client 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,8 @@ module Neuron
3
3
  module Connected
4
4
  def initialize(attrs=nil)
5
5
  (attrs || {}).each do |k,v|
6
+ next if k.to_s == 'id' && self.class.remote_id != 'id'
7
+ k = 'id' if k.to_s == self.class.remote_id
6
8
  self.send("#{k}=", v) if self.respond_to?("#{k}=")
7
9
  end
8
10
  end
@@ -28,7 +30,7 @@ module Neuron
28
30
  @errors = catch :errors do
29
31
  if new_record?
30
32
  response = self.class.connection.post("#{self.class.resources_name}", {self.class.resource_name => self.to_hash(:errors, :updated_at, :created_at)})
31
- self.id = response[self.class.resource_name]['id']
33
+ self.id = response[self.class.resource_name][self.class.remote_id]
32
34
  else
33
35
  response = self.class.connection.put("#{self.class.resources_name}/#{id}", {self.class.resource_name => self.to_hash(:errors, :updated_at, :created_at)})
34
36
  end
@@ -102,6 +104,13 @@ module Neuron
102
104
  @resources_name
103
105
  end
104
106
 
107
+ def remote_id(remote_id=nil)
108
+ if remote_id
109
+ @remote_id = remote_id.to_s
110
+ end
111
+ @remote_id || 'id'
112
+ end
113
+
105
114
  def find(id)
106
115
  response = self.connection.get("#{self.resources_name}/#{id}")
107
116
  self.new(response[self.resource_name])
@@ -1,5 +1,5 @@
1
1
  module Neuron
2
2
  module Client
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
@@ -4,6 +4,7 @@ module Neuron
4
4
  include Connected
5
5
  resource_name("zone")
6
6
  resources_name("zones")
7
+ remote_id('uuid')
7
8
 
8
9
  attr_accessor :slug, :response_type, :template_slug, :parameters,
9
10
  :created_at, :updated_at
metadata CHANGED
@@ -1,135 +1,138 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: neuron-client
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.8
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.0.9
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Mark Simoneau
9
9
  - Chris Johnson
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-08-10 00:00:00.000000000 -05:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
13
+
14
+ date: 2011-08-16 00:00:00 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
17
  name: rest-client
18
- requirement: &70201594494800 !ruby/object:Gem::Requirement
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
19
  none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
23
  version: 1.6.3
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70201594494800
27
- - !ruby/object:Gem::Dependency
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
28
  name: yajl-ruby
29
- requirement: &70201594494300 !ruby/object:Gem::Requirement
29
+ requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
- requirements:
32
- - - ! '>='
33
- - !ruby/object:Gem::Version
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
34
  version: 0.8.2
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70201594494300
38
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
39
  name: rspec
40
- requirement: &70201594493840 !ruby/object:Gem::Requirement
40
+ requirement: &id003 !ruby/object:Gem::Requirement
41
41
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
45
  version: 2.6.0
46
46
  type: :development
47
47
  prerelease: false
48
- version_requirements: *70201594493840
49
- - !ruby/object:Gem::Dependency
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
50
  name: simplecov
51
- requirement: &70201594493380 !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
52
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
56
  version: 0.4.2
57
57
  type: :development
58
58
  prerelease: false
59
- version_requirements: *70201594493380
60
- - !ruby/object:Gem::Dependency
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
61
  name: rb-fsevent
62
- requirement: &70201594492880 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
63
  none: false
64
- requirements:
65
- - - ! '>='
66
- - !ruby/object:Gem::Version
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
67
  version: 0.4.1
68
68
  type: :development
69
69
  prerelease: false
70
- version_requirements: *70201594492880
71
- - !ruby/object:Gem::Dependency
70
+ version_requirements: *id005
71
+ - !ruby/object:Gem::Dependency
72
72
  name: guard
73
- requirement: &70201594492420 !ruby/object:Gem::Requirement
73
+ requirement: &id006 !ruby/object:Gem::Requirement
74
74
  none: false
75
- requirements:
76
- - - ! '>='
77
- - !ruby/object:Gem::Version
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
78
  version: 0.5.1
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *70201594492420
82
- - !ruby/object:Gem::Dependency
81
+ version_requirements: *id006
82
+ - !ruby/object:Gem::Dependency
83
83
  name: guard-bundler
84
- requirement: &70201594491960 !ruby/object:Gem::Requirement
84
+ requirement: &id007 !ruby/object:Gem::Requirement
85
85
  none: false
86
- requirements:
87
- - - ! '>='
88
- - !ruby/object:Gem::Version
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
89
  version: 0.1.3
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *70201594491960
93
- - !ruby/object:Gem::Dependency
92
+ version_requirements: *id007
93
+ - !ruby/object:Gem::Dependency
94
94
  name: guard-rspec
95
- requirement: &70201594491500 !ruby/object:Gem::Requirement
95
+ requirement: &id008 !ruby/object:Gem::Requirement
96
96
  none: false
97
- requirements:
98
- - - ! '>='
99
- - !ruby/object:Gem::Version
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
100
  version: 0.4.0
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *70201594491500
104
- - !ruby/object:Gem::Dependency
103
+ version_requirements: *id008
104
+ - !ruby/object:Gem::Dependency
105
105
  name: fakeweb
106
- requirement: &70201594491040 !ruby/object:Gem::Requirement
106
+ requirement: &id009 !ruby/object:Gem::Requirement
107
107
  none: false
108
- requirements:
109
- - - ! '>='
110
- - !ruby/object:Gem::Version
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
111
  version: 1.3.0
112
112
  type: :development
113
113
  prerelease: false
114
- version_requirements: *70201594491040
115
- - !ruby/object:Gem::Dependency
114
+ version_requirements: *id009
115
+ - !ruby/object:Gem::Dependency
116
116
  name: vcr
117
- requirement: &70201594490580 !ruby/object:Gem::Requirement
117
+ requirement: &id010 !ruby/object:Gem::Requirement
118
118
  none: false
119
- requirements:
120
- - - ! '>='
121
- - !ruby/object:Gem::Version
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
122
  version: 1.10.2
123
123
  type: :development
124
124
  prerelease: false
125
- version_requirements: *70201594490580
125
+ version_requirements: *id010
126
126
  description: Neuron Admin Client Gem
127
- email:
127
+ email:
128
128
  - devteam@rmmonline.com
129
129
  executables: []
130
+
130
131
  extensions: []
132
+
131
133
  extra_rdoc_files: []
132
- files:
134
+
135
+ files:
133
136
  - .gitignore
134
137
  - .rvmrc
135
138
  - Gemfile
@@ -155,32 +158,40 @@ files:
155
158
  - spec/lib/old_spec.rb
156
159
  - spec/lib/s3_file_spec.rb
157
160
  - spec/spec_helper.rb
158
- has_rdoc: true
159
161
  homepage: http://github.com/rmm/neuron-client
160
162
  licenses: []
163
+
161
164
  post_install_message:
162
165
  rdoc_options: []
163
- require_paths:
166
+
167
+ require_paths:
164
168
  - lib
165
- required_ruby_version: !ruby/object:Gem::Requirement
169
+ required_ruby_version: !ruby/object:Gem::Requirement
166
170
  none: false
167
- requirements:
168
- - - ! '>='
169
- - !ruby/object:Gem::Version
170
- version: '0'
171
- required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ hash: 3270311461890491223
175
+ segments:
176
+ - 0
177
+ version: "0"
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
172
179
  none: false
173
- requirements:
174
- - - ! '>='
175
- - !ruby/object:Gem::Version
176
- version: '0'
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ hash: 3270311461890491223
184
+ segments:
185
+ - 0
186
+ version: "0"
177
187
  requirements: []
188
+
178
189
  rubyforge_project: neuron-client
179
- rubygems_version: 1.6.2
190
+ rubygems_version: 1.8.4
180
191
  signing_key:
181
192
  specification_version: 3
182
193
  summary: Neuron Admin Client Gem
183
- test_files:
194
+ test_files:
184
195
  - spec/fixtures/vcr_cassettes/s3_file.yml
185
196
  - spec/lib/old_spec.rb
186
197
  - spec/lib/s3_file_spec.rb