sfdc 0.0.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +8 -8
  2. data/lib/sfdc.rb +39 -1
  3. data/lib/sfdc/attachment.rb +23 -0
  4. data/lib/sfdc/chatter/comment.rb +10 -0
  5. data/lib/sfdc/chatter/conversation.rb +100 -0
  6. data/lib/sfdc/chatter/feed.rb +64 -0
  7. data/lib/sfdc/chatter/feed_item.rb +40 -0
  8. data/lib/sfdc/chatter/feeds.rb +5 -0
  9. data/lib/sfdc/chatter/filter_feed.rb +14 -0
  10. data/lib/sfdc/chatter/group.rb +45 -0
  11. data/lib/sfdc/chatter/group_membership.rb +9 -0
  12. data/lib/sfdc/chatter/like.rb +9 -0
  13. data/lib/sfdc/chatter/message.rb +29 -0
  14. data/lib/sfdc/chatter/photo_methods.rb +55 -0
  15. data/lib/sfdc/chatter/record.rb +122 -0
  16. data/lib/sfdc/chatter/subscription.rb +9 -0
  17. data/lib/sfdc/chatter/user.rb +153 -0
  18. data/lib/sfdc/client.rb +98 -0
  19. data/lib/sfdc/client/api.rb +320 -0
  20. data/lib/sfdc/client/authentication.rb +40 -0
  21. data/lib/sfdc/client/caching.rb +26 -0
  22. data/lib/sfdc/client/canvas.rb +12 -0
  23. data/lib/sfdc/client/connection.rb +74 -0
  24. data/lib/sfdc/client/picklists.rb +90 -0
  25. data/lib/sfdc/client/streaming.rb +31 -0
  26. data/lib/sfdc/client/verbs.rb +68 -0
  27. data/lib/sfdc/collection.rb +40 -0
  28. data/lib/sfdc/config.rb +136 -0
  29. data/lib/sfdc/mash.rb +65 -0
  30. data/lib/sfdc/middleware.rb +29 -0
  31. data/lib/sfdc/middleware/authentication.rb +63 -0
  32. data/lib/sfdc/middleware/authentication/password.rb +20 -0
  33. data/lib/sfdc/middleware/authentication/token.rb +15 -0
  34. data/lib/sfdc/middleware/authorization.rb +19 -0
  35. data/lib/sfdc/middleware/caching.rb +24 -0
  36. data/lib/sfdc/middleware/gzip.rb +31 -0
  37. data/lib/sfdc/middleware/instance_url.rb +18 -0
  38. data/lib/sfdc/middleware/logger.rb +40 -0
  39. data/lib/sfdc/middleware/mashify.rb +18 -0
  40. data/lib/sfdc/middleware/multipart.rb +53 -0
  41. data/lib/sfdc/middleware/raise_error.rb +23 -0
  42. data/lib/sfdc/signed_request.rb +48 -0
  43. data/lib/sfdc/sobject.rb +64 -0
  44. data/lib/sfdc/upload_io.rb +20 -0
  45. data/lib/sfdc/version.rb +1 -1
  46. metadata +59 -4
  47. data/lib/sfdc/sfdc.rb +0 -0
@@ -0,0 +1,64 @@
1
+ module Sfdc
2
+ class SObject < Sfdc::Mash
3
+
4
+ def sobject_type
5
+ self.attributes.type
6
+ end
7
+
8
+ # Public: Get the describe for this sobject type
9
+ def describe
10
+ @client.describe(sobject_type)
11
+ end
12
+
13
+ # Public: Persist the attributes to Salesforce.
14
+ #
15
+ # Examples
16
+ #
17
+ # account = client.query('select Id, Name from Account').first
18
+ # account.Name = 'Foobar'
19
+ # account.save
20
+ def save
21
+ ensure_id
22
+ @client.update(sobject_type, attrs)
23
+ end
24
+
25
+ def save!
26
+ ensure_id
27
+ @client.update!(sobject_type, attrs)
28
+ end
29
+
30
+ # Public: Destroy this record.
31
+ #
32
+ # Examples
33
+ #
34
+ # account = client.query('select Id, Name from Account').first
35
+ # account.destroy
36
+ def destroy
37
+ ensure_id
38
+ @client.destroy(sobject_type, self.Id)
39
+ end
40
+
41
+ def destroy!
42
+ ensure_id
43
+ @client.destroy!(sobject_type, self.Id)
44
+ end
45
+
46
+ # Public: Returns a hash representation of this object with the attributes
47
+ # key and parent/child relationships removed.
48
+ def attrs
49
+ self.to_hash.reject { |key, _| key =~ /.*__r/ || key =~ /^attributes$/ }
50
+ end
51
+
52
+ def to_sparam
53
+ self.Id
54
+ end
55
+
56
+ private
57
+
58
+ def ensure_id
59
+ return true if self.Id?
60
+ raise 'You need to query the Id for the record first.'
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,20 @@
1
+ require 'faraday/upload_io'
2
+
3
+ module Sfdc
4
+ UploadIO = Faraday::UploadIO
5
+ end
6
+
7
+ module Faraday
8
+ module Parts
9
+ class ParamPart
10
+ def build_part(boundary, name, value)
11
+ part = ''
12
+ part << "--#{boundary}\r\n"
13
+ part << "Content-Disposition: form-data; name=\"#{name.to_s}\";\r\n"
14
+ part << "Content-Type: application/json\r\n"
15
+ part << "\r\n"
16
+ part << "#{value}\r\n"
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/sfdc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sfdc
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfdc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruce Yue
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir:
10
10
  - bin
11
11
  cert_chain: []
12
- date: 2013-03-30 00:00:00.000000000 Z
12
+ date: 2013-04-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: 2.0.3
70
+ - !ruby/object:Gem::Dependency
71
+ name: activesupport
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :runtime
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: bundler
72
86
  requirement: !ruby/object:Gem::Requirement
@@ -103,7 +117,48 @@ executables:
103
117
  extensions: []
104
118
  extra_rdoc_files: []
105
119
  files:
106
- - lib/sfdc/sfdc.rb
120
+ - lib/sfdc/attachment.rb
121
+ - lib/sfdc/chatter/comment.rb
122
+ - lib/sfdc/chatter/conversation.rb
123
+ - lib/sfdc/chatter/feed.rb
124
+ - lib/sfdc/chatter/feed_item.rb
125
+ - lib/sfdc/chatter/feeds.rb
126
+ - lib/sfdc/chatter/filter_feed.rb
127
+ - lib/sfdc/chatter/group.rb
128
+ - lib/sfdc/chatter/group_membership.rb
129
+ - lib/sfdc/chatter/like.rb
130
+ - lib/sfdc/chatter/message.rb
131
+ - lib/sfdc/chatter/photo_methods.rb
132
+ - lib/sfdc/chatter/record.rb
133
+ - lib/sfdc/chatter/subscription.rb
134
+ - lib/sfdc/chatter/user.rb
135
+ - lib/sfdc/client/api.rb
136
+ - lib/sfdc/client/authentication.rb
137
+ - lib/sfdc/client/caching.rb
138
+ - lib/sfdc/client/canvas.rb
139
+ - lib/sfdc/client/connection.rb
140
+ - lib/sfdc/client/picklists.rb
141
+ - lib/sfdc/client/streaming.rb
142
+ - lib/sfdc/client/verbs.rb
143
+ - lib/sfdc/client.rb
144
+ - lib/sfdc/collection.rb
145
+ - lib/sfdc/config.rb
146
+ - lib/sfdc/mash.rb
147
+ - lib/sfdc/middleware/authentication/password.rb
148
+ - lib/sfdc/middleware/authentication/token.rb
149
+ - lib/sfdc/middleware/authentication.rb
150
+ - lib/sfdc/middleware/authorization.rb
151
+ - lib/sfdc/middleware/caching.rb
152
+ - lib/sfdc/middleware/gzip.rb
153
+ - lib/sfdc/middleware/instance_url.rb
154
+ - lib/sfdc/middleware/logger.rb
155
+ - lib/sfdc/middleware/mashify.rb
156
+ - lib/sfdc/middleware/multipart.rb
157
+ - lib/sfdc/middleware/raise_error.rb
158
+ - lib/sfdc/middleware.rb
159
+ - lib/sfdc/signed_request.rb
160
+ - lib/sfdc/sobject.rb
161
+ - lib/sfdc/upload_io.rb
107
162
  - lib/sfdc/version.rb
108
163
  - lib/sfdc.rb
109
164
  - README.md
@@ -127,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
182
  - !ruby/object:Gem::Version
128
183
  version: '0'
129
184
  requirements: []
130
- rubyforge_project:
185
+ rubyforge_project: sfdc
131
186
  rubygems_version: 2.0.3
132
187
  signing_key:
133
188
  specification_version: 4
data/lib/sfdc/sfdc.rb DELETED
File without changes