salesforceapi-rest 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  module SalesforceApi
2
2
  module Errors
3
3
 
4
- class ApiError < RuntimeError
4
+ class ApiError < StandardError
5
5
 
6
6
  attr_accessor :http_code
7
7
 
@@ -1,5 +1,5 @@
1
1
  module Salesforceapi
2
2
  module Rest
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -108,7 +108,7 @@ module Salesforceapi
108
108
  end
109
109
 
110
110
 
111
- def add_custom_field(attributes)
111
+ def add_custom_field(attributes, update = false)
112
112
  config_authorization!
113
113
  auth_header = {
114
114
  "Authorization" => "OAuth " + @access_token,
@@ -120,8 +120,11 @@ module Salesforceapi
120
120
  self.class.base_uri @metadata_uri
121
121
 
122
122
  data = (Envelope % [@access_token, custom_fields_xml(attributes)])
123
- resp = SalesforceApi::Request.do_request("POST", @metadata_uri, auth_header, data.lstrip)
124
-
123
+ if update
124
+ resp = SalesforceApi::Request.do_request("POST", @metadata_uri, auth_header, data.lstrip)
125
+ else
126
+ resp = SalesforceApi::Request.do_request("PUT", @metadata_uri, auth_header, data.lstrip)
127
+ end
125
128
  xml_response = Crack::XML.parse(resp.body)
126
129
 
127
130
  if resp.code != 200
metadata CHANGED
@@ -1,161 +1,166 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: salesforceapi-rest
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.3
3
+ version: !ruby/object:Gem::Version
4
+ hash: 23
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 4
10
+ version: 0.0.4
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Lucas Allan Amorim
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-05-29 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-07-23 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rspec
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rforce
32
- requirement: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
33
24
  none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
38
32
  type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: rforce
39
36
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
37
+ requirement: &id002 !ruby/object:Gem::Requirement
41
38
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: omniauth
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
54
46
  type: :development
47
+ version_requirements: *id002
48
+ - !ruby/object:Gem::Dependency
49
+ name: omniauth
55
50
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
51
+ requirement: &id003 !ruby/object:Gem::Requirement
57
52
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: httparty
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
68
- - !ruby/object:Gem::Version
69
- version: '0'
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
70
60
  type: :development
61
+ version_requirements: *id003
62
+ - !ruby/object:Gem::Dependency
63
+ name: httparty
71
64
  prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
65
+ requirement: &id004 !ruby/object:Gem::Requirement
73
66
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
78
- - !ruby/object:Gem::Dependency
79
- name: activeresource
80
- requirement: !ruby/object:Gem::Requirement
81
- none: false
82
- requirements:
83
- - - ! '>='
84
- - !ruby/object:Gem::Version
85
- version: '0'
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
86
74
  type: :development
75
+ version_requirements: *id004
76
+ - !ruby/object:Gem::Dependency
77
+ name: activeresource
87
78
  prerelease: false
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: crack
96
- requirement: !ruby/object:Gem::Requirement
79
+ requirement: &id005 !ruby/object:Gem::Requirement
97
80
  none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ hash: 3
85
+ segments:
86
+ - 0
87
+ version: "0"
102
88
  type: :development
89
+ version_requirements: *id005
90
+ - !ruby/object:Gem::Dependency
91
+ name: crack
103
92
  prerelease: false
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: builder
112
- requirement: !ruby/object:Gem::Requirement
93
+ requirement: &id006 !ruby/object:Gem::Requirement
113
94
  none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ hash: 3
99
+ segments:
100
+ - 0
101
+ version: "0"
118
102
  type: :development
103
+ version_requirements: *id006
104
+ - !ruby/object:Gem::Dependency
105
+ name: builder
119
106
  prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
107
+ requirement: &id007 !ruby/object:Gem::Requirement
121
108
  none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ type: :development
117
+ version_requirements: *id007
126
118
  description: Ruby wrapper to access salesforce rest api
127
- email:
119
+ email:
128
120
  - lucas.allan@gmail.com
129
121
  executables: []
122
+
130
123
  extensions: []
124
+
131
125
  extra_rdoc_files: []
132
- files:
126
+
127
+ files:
133
128
  - lib/salesforceapi-rest/errors.rb
134
129
  - lib/salesforceapi-rest/request.rb
135
130
  - lib/salesforceapi-rest/version.rb
136
131
  - lib/salesforceapi-rest.rb
137
- homepage: ''
132
+ homepage: ""
138
133
  licenses: []
134
+
139
135
  post_install_message:
140
136
  rdoc_options: []
141
- require_paths:
137
+
138
+ require_paths:
142
139
  - lib
143
- required_ruby_version: !ruby/object:Gem::Requirement
140
+ required_ruby_version: !ruby/object:Gem::Requirement
144
141
  none: false
145
- requirements:
146
- - - ! '>='
147
- - !ruby/object:Gem::Version
148
- version: '0'
149
- required_rubygems_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ hash: 3
146
+ segments:
147
+ - 0
148
+ version: "0"
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
150
  none: false
151
- requirements:
152
- - - ! '>='
153
- - !ruby/object:Gem::Version
154
- version: '0'
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ hash: 3
155
+ segments:
156
+ - 0
157
+ version: "0"
155
158
  requirements: []
159
+
156
160
  rubyforge_project:
157
- rubygems_version: 1.8.22
161
+ rubygems_version: 1.8.24
158
162
  signing_key:
159
163
  specification_version: 3
160
164
  summary: Ruby wrapper to access salesforce rest api
161
165
  test_files: []
166
+