landslider 0.5.16 → 0.5.17

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ gem "jeweler"
4
4
  gem "handsoap", ">= 1.1.8"
5
5
 
6
6
  group :development do
7
+ gem "yard"
7
8
  gem "shoulda"
8
9
  gem "rcov"
9
10
  end
data/README.md CHANGED
@@ -88,6 +88,7 @@ API methods
88
88
  * getAccountNotes
89
89
  * getAccountOpportunities
90
90
  * getAccountTypes
91
+ * getContactById
91
92
  * getContacts
92
93
  * getContactCustomFields
93
94
  * getContactNotes
@@ -107,6 +108,6 @@ TODO
107
108
 
108
109
  * Modify configuration to be rails 3 friendly. The configuation was needed before the environment finished loading. See landslide-rails
109
110
  * add more API calls
110
- * use HTTP cookies to maintain session state. maybe something like http_request.headers.merge!({'cookie' => ["JSESSIONID=#{self.session_id}"]})
111
+ * use HTTP cookies to maintain session state
111
112
  * eliminate slow inefficient XPath queries
112
113
  * eliminate test data dependency on the jaytest instance
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ begin
16
16
  end
17
17
  Jeweler::GemcutterTasks.new
18
18
  rescue LoadError
19
- puts "Jeweler not available. Please install the jeweler gem"
19
+ puts 'Jeweler not available. Please install the jeweler gem'
20
20
  end
21
21
 
22
22
  # Load any rake files that exist
@@ -31,3 +31,9 @@ Rake::TestTask.new(:test) do |test|
31
31
  test.verbose = false
32
32
  end
33
33
 
34
+ begin
35
+ require 'yard'
36
+ YARD::Rake::YardocTask.new
37
+ rescue LoadError
38
+ puts 'Yard not available. Please install the yard gem'
39
+ end
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 5
4
- :patch: 16
4
+ :patch: 17
5
5
  :build:
data/landslider.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{landslider}
8
- s.version = "0.5.16"
8
+ s.version = "0.5.17"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jay Prall"]
12
- s.date = %q{2011-05-23}
12
+ s.date = %q{2011-05-25}
13
13
  s.description = %q{Landslider is a ruby interface to the Landslide SOAP-based API}
14
14
  s.email = %q{jay@j4y.net}
15
15
  s.extra_rdoc_files = [
@@ -68,6 +68,7 @@ Gem::Specification.new do |s|
68
68
  "tasks/landslider.rake",
69
69
  "test/get_account_types_test.rb",
70
70
  "test/get_accounts_test.rb",
71
+ "test/get_contact_test.rb",
71
72
  "test/landslider_test.rb",
72
73
  "test/run_mylist_by_id_test.rb",
73
74
  "test/test_helper.rb",
@@ -85,6 +86,7 @@ Gem::Specification.new do |s|
85
86
  s.test_files = [
86
87
  "test/get_account_types_test.rb",
87
88
  "test/get_accounts_test.rb",
89
+ "test/get_contact_test.rb",
88
90
  "test/landslider_test.rb",
89
91
  "test/run_mylist_by_id_test.rb",
90
92
  "test/test_helper.rb",
@@ -101,17 +103,20 @@ Gem::Specification.new do |s|
101
103
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
102
104
  s.add_runtime_dependency(%q<jeweler>, [">= 0"])
103
105
  s.add_runtime_dependency(%q<handsoap>, [">= 1.1.8"])
106
+ s.add_development_dependency(%q<yard>, [">= 0"])
104
107
  s.add_development_dependency(%q<shoulda>, [">= 0"])
105
108
  s.add_development_dependency(%q<rcov>, [">= 0"])
106
109
  else
107
110
  s.add_dependency(%q<jeweler>, [">= 0"])
108
111
  s.add_dependency(%q<handsoap>, [">= 1.1.8"])
112
+ s.add_dependency(%q<yard>, [">= 0"])
109
113
  s.add_dependency(%q<shoulda>, [">= 0"])
110
114
  s.add_dependency(%q<rcov>, [">= 0"])
111
115
  end
112
116
  else
113
117
  s.add_dependency(%q<jeweler>, [">= 0"])
114
118
  s.add_dependency(%q<handsoap>, [">= 1.1.8"])
119
+ s.add_dependency(%q<yard>, [">= 0"])
115
120
  s.add_dependency(%q<shoulda>, [">= 0"])
116
121
  s.add_dependency(%q<rcov>, [">= 0"])
117
122
  end
@@ -1,11 +1,13 @@
1
1
  class Landslider
2
+
3
+ # represents a contact
2
4
  class WsContact < WsEntity
3
5
 
4
6
  # @return [Integer]
5
7
  attr_reader :contact_id, :owner_id, :create_by, :update_by, :archived_by
6
8
 
7
9
  # @return [String]
8
- attr_reader :namae, :account_name, :description, :source_system_id
10
+ attr_reader :name, :account_name, :description, :source_system_id
9
11
 
10
12
  # @return [Date]
11
13
  attr_reader :archived_on, :created_on, :updated_on
@@ -25,6 +25,7 @@ class Landslider
25
25
 
26
26
  # @param [Handsoap::XmlMason::Node] msg
27
27
  # @return [Handsoap::XmlMason::Node]
28
+ # @todo implementation
28
29
  def soapify_for(msg)
29
30
  end
30
31
 
data/lib/landslider.rb CHANGED
@@ -1,21 +1,12 @@
1
-
2
1
  require 'handsoap'
3
2
 
4
- # Landslider is a soap client to the Landslide CRM SOAP-based API
5
- # Example:
6
- #
7
- # require 'landslider'
8
- # response = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
9
- # response = Landslider.get_accounts(response[:session_id])
10
- # response[:accounts].each do |account|
11
- # puts "id: #{account[:account_id]} name: #{account[:account_name]}"
12
- # end
3
+ # landslider gem main class
13
4
  class Landslider < Handsoap::Service
14
5
 
15
6
  require 'landslider/entities'
16
7
 
17
8
  LS_API_NAMESPACE='http://www.landslide.com/webservices/SoapService'
18
- LS_API_ENDPOINT = {
9
+ LS_API_ENDPOINT ||= {
19
10
  :uri => "https://#{LS_INSTANCE_NAME}.api.landslide.com/webservices/SoapService",
20
11
  :version => 1
21
12
  }
@@ -41,6 +32,7 @@ class Landslider < Handsoap::Service
41
32
  http_request.headers.merge!({'user-agent' => ['landslider-ruby-gem-version-0.4.6']})
42
33
  end
43
34
 
35
+ # @param [Object] response
44
36
  def on_http_error(response)
45
37
  puts response.inspect
46
38
  end
@@ -76,6 +68,7 @@ class Landslider < Handsoap::Service
76
68
  end
77
69
 
78
70
  # @param [String] session_id
71
+ # @param [Integer] account_id
79
72
  # @return [Hash]
80
73
  def get_account_by_id(session_id, account_id)
81
74
  self.session_id = session_id
@@ -89,7 +82,7 @@ class Landslider < Handsoap::Service
89
82
  end
90
83
 
91
84
  # @param [String] session_id
92
- # @param [String] account_id
85
+ # @param [Integer] account_id
93
86
  # @param [Boolean] is_primary
94
87
  # @return [Hash]
95
88
  def get_account_contacts(session_id, account_id, is_primary=false)
@@ -157,6 +150,19 @@ class Landslider < Handsoap::Service
157
150
  parse_api_version_result(node)
158
151
  end
159
152
 
153
+ # @param [String] session_id
154
+ # @param [Integer] contact_id
155
+ # @return [Hash]
156
+ def get_contact_by_id(session_id, contact_id)
157
+ self.session_id = session_id
158
+
159
+ response = invoke('getContactById', :soap_action => :none) do |message|
160
+ message.add 'contactId', contact_id
161
+ end
162
+
163
+ node = response.document.xpath('//ns:getContactByIdResponse', ns)
164
+ parse_get_contact_by_id_result(node)
165
+ end
160
166
 
161
167
  # @param [String] session_id
162
168
  # @param [WsContactSearch] search
@@ -408,8 +414,15 @@ class Landslider < Handsoap::Service
408
414
 
409
415
  def parse_get_account_types_result(node)
410
416
  {
411
- :account_types => node.xpath('AccountTypes/accountTypes', ns).map { |child| parse_account_type(child) },
412
- :error => xml_to_bool(node, 'AccountTypes/error/text()')
417
+ :account_types => node.xpath('AccountTypes/accountTypes', ns).map { |child| parse_account_type(child) },
418
+ :error => xml_to_bool(node, 'AccountTypes/error/text()')
419
+ }
420
+ end
421
+
422
+ def parse_get_contact_by_id_result(node)
423
+ {
424
+ :contact => parse_contact(node.xpath('Contact/contact')),
425
+ :error => xml_to_bool(node, 'Contact/error/text()')
413
426
  }
414
427
  end
415
428
 
@@ -0,0 +1,15 @@
1
+
2
+ require 'test_helper'
3
+
4
+ class GetContactTest < Test::Unit::TestCase
5
+
6
+ def setup
7
+ $ss ||= Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)[:session_id]
8
+ end
9
+
10
+ def test_get_contact_by_id
11
+ result = Landslider.get_contact_by_id($ss, 62813411)
12
+ assert_equal false, result[:error]
13
+ end
14
+
15
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: landslider
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.5.16
5
+ version: 0.5.17
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jay Prall
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-23 00:00:00 -04:00
13
+ date: 2011-05-25 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -36,7 +36,7 @@ dependencies:
36
36
  prerelease: false
37
37
  version_requirements: *id002
38
38
  - !ruby/object:Gem::Dependency
39
- name: shoulda
39
+ name: yard
40
40
  requirement: &id003 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
@@ -47,7 +47,7 @@ dependencies:
47
47
  prerelease: false
48
48
  version_requirements: *id003
49
49
  - !ruby/object:Gem::Dependency
50
- name: rcov
50
+ name: shoulda
51
51
  requirement: &id004 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
@@ -57,6 +57,17 @@ dependencies:
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: rcov
62
+ requirement: &id005 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: "0"
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: *id005
60
71
  description: Landslider is a ruby interface to the Landslide SOAP-based API
61
72
  email: jay@j4y.net
62
73
  executables: []
@@ -118,6 +129,7 @@ files:
118
129
  - tasks/landslider.rake
119
130
  - test/get_account_types_test.rb
120
131
  - test/get_accounts_test.rb
132
+ - test/get_contact_test.rb
121
133
  - test/landslider_test.rb
122
134
  - test/run_mylist_by_id_test.rb
123
135
  - test/test_helper.rb
@@ -157,6 +169,7 @@ summary: Landslide Ruby
157
169
  test_files:
158
170
  - test/get_account_types_test.rb
159
171
  - test/get_accounts_test.rb
172
+ - test/get_contact_test.rb
160
173
  - test/landslider_test.rb
161
174
  - test/run_mylist_by_id_test.rb
162
175
  - test/test_helper.rb