active_force 0.0.2.alfa → 0.0.3.alfa

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 436d4d36cd6ed95f5bc8bfd199555f02c74c2cf3
4
+ data.tar.gz: 9cc92d84483139c59703b190303e229f49af8a63
5
+ SHA512:
6
+ metadata.gz: 3f7e75fd82854c5121fd2c73a1871a279dbfb885fc30c26f078b0a09cc8501cb1da70fa3440544fdcae864665a4474d59480f53fa9015508b20311e648fbb3a1
7
+ data.tar.gz: 8e7c42d5eeb0f5bc9516636d597798d509ce8a0b4487db094489e3ee3e5d4a083e8865be1fba1136207b7f510e221006095c19da9712a82d544e6bd24e9e64e9
data/active_force.gemspec CHANGED
@@ -22,4 +22,5 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'bundler', '~> 1.3'
23
23
  spec.add_development_dependency 'rake'
24
24
  spec.add_development_dependency 'rspec'
25
+ spec.add_development_dependency 'pry'
25
26
  end
data/lib/active_force.rb CHANGED
@@ -1,5 +1,5 @@
1
- require "active_force/version"
1
+ require 'active_force/version'
2
+ require 'active_force/sobject'
2
3
 
3
4
  module ActiveForce
4
- # Your code goes here...
5
5
  end
@@ -1,3 +1,5 @@
1
+ require 'active_model'
2
+ require 'active_attr'
1
3
  require 'active_attr/dirty'
2
4
 
3
5
  module ActiveForce
@@ -1,3 +1,3 @@
1
1
  module ActiveForce
2
- VERSION = "0.0.2.alfa"
2
+ VERSION = "0.0.3.alfa"
3
3
  end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe ActiveForce::SObject do
4
+ describe ".new" do
5
+ it "create with valid values" do
6
+ @SObject = Whizbang.new
7
+ expect(@SObject).to be_an_instance_of Whizbang
8
+ end
9
+ end
10
+
11
+ describe ".build" do
12
+ let(:sobject_hash) { YAML.load(fixture('sobject/single_sobject_hash')) }
13
+
14
+ it "build a valid sobject from a JSON" do
15
+ expect(Whizbang.build sobject_hash).to be_an_instance_of Whizbang
16
+ end
17
+ end
18
+ end
@@ -4,8 +4,4 @@ describe ActiveForce do
4
4
  it 'should have a version number' do
5
5
  ActiveForce::VERSION.should_not be_nil
6
6
  end
7
-
8
- it 'should do something useful' do
9
- false.should be_true
10
- end
11
7
  end
@@ -0,0 +1,24 @@
1
+ attributes:
2
+ type: 'Whizbang'
3
+ url: '/services/data/v20.0/sobjects/Whizbang/foo'
4
+ Checkbox_Label: false
5
+ Text_Label: 'Hi there!'
6
+ Date_Label: '2010-01-01'
7
+ DateTime_Label: '2011-07-07T00:37:00.000+0000'
8
+ Picklist_Multiselect_Label: 'four;six'
9
+
10
+ ParentWhizbang__r:
11
+ Name: 'Parent Whizbang'
12
+ Text_Label: 'Hello'
13
+ attributes:
14
+ type: 'Whizbang'
15
+ url: '/services/data/v20.0/sobjects/Whizbang/bar'
16
+
17
+ Whizbangs__r:
18
+ totalSize: 1
19
+ done: true
20
+ records:
21
+ - attributes:
22
+ type: 'Whizbang__c'
23
+ url: '/services/data/v24.0/sobjects/Whizbang__c/a00E0000004D5lsIAC'
24
+ Name: 'Child Whizbang'
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,4 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  require 'active_force'
3
+ Dir["./spec/support/**/*"].sort.each { |f| require f }
4
+ require 'pry'
@@ -0,0 +1,45 @@
1
+ module FixtureHelpers
2
+ module InstanceMethods
3
+
4
+ def stub_api_request(endpoint, options={})
5
+ options = {
6
+ :method => :get,
7
+ :status => 200,
8
+ :api_version => Restforce.configuration.api_version
9
+ }.merge(options)
10
+
11
+ stub = stub_request(options[:method], %r{/services/data/v#{options[:api_version]}/#{endpoint}})
12
+ stub = stub.with(:body => options[:with_body]) if options[:with_body] && !RUBY_VERSION.match(/^1.8/)
13
+ stub = stub.to_return(:status => options[:status], :body => fixture(options[:fixture]), :headers => { 'Content-Type' => 'application/json'}) if options[:fixture]
14
+ stub
15
+ end
16
+
17
+ def stub_login_request(options={})
18
+ stub = stub_request(:post, "https://login.salesforce.com/services/oauth2/token")
19
+ stub = stub.with(:body => options[:with_body]) if options[:with_body] && !RUBY_VERSION.match(/^1.8/)
20
+ stub
21
+ end
22
+
23
+ def fixture(f)
24
+ File.read(File.expand_path("../../fixtures/#{f}.yml", __FILE__))
25
+ end
26
+
27
+ end
28
+
29
+ module ClassMethods
30
+ def requests(endpoint, options={})
31
+ before do
32
+ (@requests ||= []) << stub_api_request(endpoint, options)
33
+ end
34
+
35
+ after do
36
+ @requests.each { |request| expect(request).to have_been_requested }
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ RSpec.configure do |config|
43
+ config.include FixtureHelpers::InstanceMethods
44
+ config.extend FixtureHelpers::ClassMethods
45
+ end
@@ -0,0 +1,49 @@
1
+ class Whizbang < ActiveForce::SObject
2
+
3
+ self.mappings = {
4
+ id: 'Id',
5
+ salutation: 'Salutation',
6
+ first_name: 'FirstName',
7
+ last_name: 'LastName',
8
+ gender: 'Gender__c',
9
+ date_of_birth: 'PersonBirthdate',
10
+ status: 'Patient_Status__c',
11
+ username: 'User_Name__c',
12
+ contact_phone: 'Phone',
13
+ email: 'Patient_Email__c',
14
+ referral_source: 'Referral_Source__c',
15
+ address: 'HomeStreet__c',
16
+ city: 'HomeCity__c',
17
+ state: 'HomeState__c',
18
+ zip_code: 'HomePostalCode__c',
19
+ occupation: 'Ocupation__c',
20
+ assigned_by: 'Assigned_By__c',
21
+ primary_care_physician: 'Primary_Care_Physician__c',
22
+ referring_physician: 'Referring_Physician__c',
23
+ emergency_contact: 'Emergency_Contact__c',
24
+ questionnaire_completed?: 'HHQ_Questionnaire_Complete__c',
25
+ employer: 'Employer__c'
26
+ }
27
+
28
+ attribute :salutation
29
+ attribute :first_name
30
+ attribute :last_name
31
+ attribute :gender
32
+ attribute :date_of_birth
33
+ attribute :status
34
+ attribute :username
35
+ attribute :contact_phone
36
+ attribute :email
37
+ attribute :referral_source
38
+ attribute :address
39
+ attribute :city
40
+ attribute :state
41
+ attribute :zip_code
42
+ attribute :occupation
43
+ attribute :assigned_by
44
+ attribute :primary_care_physician
45
+ attribute :referring_physician
46
+ attribute :emergency_contact
47
+ attribute :questionnaire_completed?
48
+ attribute :employer
49
+ end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_force
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.alfa
5
- prerelease: 6
4
+ version: 0.0.3.alfa
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eloy Espinaco
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-19 00:00:00.000000000 Z
11
+ date: 2013-07-05 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: active_attr
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,33 +41,43 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
76
81
  - !ruby/object:Gem::Version
77
82
  version: '0'
78
83
  description: Use SalesForce as an ActiveModel
@@ -97,34 +102,40 @@ files:
97
102
  - lib/generators/active_force/active_force_model/USAGE
98
103
  - lib/generators/active_force/active_force_model/active_force_model_generator.rb
99
104
  - lib/generators/active_force/active_force_model/templates/model.rb.erb
105
+ - spec/active_force/sobject_spec.rb
100
106
  - spec/active_force_spec.rb
107
+ - spec/fixtures/sobject/single_sobject_hash.yml
101
108
  - spec/spec_helper.rb
109
+ - spec/support/fixture_helpers.rb
110
+ - spec/support/whizbang.rb
102
111
  homepage: ''
103
112
  licenses:
104
113
  - MIT
114
+ metadata: {}
105
115
  post_install_message:
106
116
  rdoc_options: []
107
117
  require_paths:
108
118
  - lib
109
119
  required_ruby_version: !ruby/object:Gem::Requirement
110
- none: false
111
120
  requirements:
112
- - - ! '>='
121
+ - - '>='
113
122
  - !ruby/object:Gem::Version
114
123
  version: '0'
115
124
  required_rubygems_version: !ruby/object:Gem::Requirement
116
- none: false
117
125
  requirements:
118
- - - ! '>'
126
+ - - '>'
119
127
  - !ruby/object:Gem::Version
120
128
  version: 1.3.1
121
129
  requirements: []
122
130
  rubyforge_project:
123
- rubygems_version: 1.8.24
131
+ rubygems_version: 2.0.3
124
132
  signing_key:
125
- specification_version: 3
133
+ specification_version: 4
126
134
  summary: Help you implement models persisting on Sales Force within Rails using RESTForce
127
135
  test_files:
136
+ - spec/active_force/sobject_spec.rb
128
137
  - spec/active_force_spec.rb
138
+ - spec/fixtures/sobject/single_sobject_hash.yml
129
139
  - spec/spec_helper.rb
130
- has_rdoc:
140
+ - spec/support/fixture_helpers.rb
141
+ - spec/support/whizbang.rb