landslider 0.4.8 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -26,19 +26,17 @@ This gem requires the following gems:
26
26
  Configuration:
27
27
 
28
28
  # constants to be set by rails environment config files
29
+
29
30
  LS_INSTANCE_NAME = 'jaytest'
30
- LS_API_USERNAME = 'XXXXXXXX@landslide.com'
31
- LS_API_PASSWORD = 'XXXXXXXX'
32
- LS_API_KEY = Digest::MD5.hexdigest(LS_API_PASSWORD + LS_INSTANCE_NAME)
33
- LS_API_ENDPOINT = {
34
- :uri => "https://#{LS_INSTANCE_NAME}.api.landslide.com/webservices/SoapService",
35
- :version => 1
36
- }
31
+ LS_API_USERNAME = 'jayp@landslide.com'
37
32
 
38
- response = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
33
+ # The api key is a md5 hash of the password + instance name
34
+ # see bin/generate_api_key.rb for an example
35
+ LS_API_KEY = '53308ccbdcb7f23fbd81a0b2ebcf12a4'
39
36
 
37
+ require 'landslider'
38
+ response = Landslider.login('LOGINTOKEN=' + LS_INSTANCE_NAME)
40
39
  response = Landslider.get_accounts(response[:session_id])
41
-
42
40
  response[:accounts].each do |account|
43
41
  puts "id: #{account[:account_id]} name: #{account[:account_name]}"
44
42
  end
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
- :minor: 4
4
- :patch: 8
3
+ :minor: 5
4
+ :patch: 0
5
5
  :build:
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ require 'digest/md5'
3
+
4
+ LS_INSTANCE_NAME = 'jaytest'
5
+ LS_API_PASSWORD = 'Applogin1'
6
+
7
+ # the api key is an md5 hash of the user password + instance name
8
+ puts "LS_API_KEY = '#{Digest::MD5.hexdigest(LS_API_PASSWORD + LS_INSTANCE_NAME)}'"
data/landslider.gemspec CHANGED
@@ -5,13 +5,15 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{landslider}
8
- s.version = "0.4.8"
8
+ s.version = "0.5.0"
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-04-29}
12
+ s.date = %q{2011-05-02}
13
+ s.default_executable = %q{generate_api_key.rb}
13
14
  s.description = %q{Landslider is a ruby interface to the Landslide SOAP-based API}
14
15
  s.email = %q{jay@j4y.net}
16
+ s.executables = ["generate_api_key.rb"]
15
17
  s.extra_rdoc_files = [
16
18
  "LICENSE",
17
19
  "README.rdoc"
@@ -23,6 +25,7 @@ Gem::Specification.new do |s|
23
25
  "README.rdoc",
24
26
  "Rakefile",
25
27
  "VERSION.yml",
28
+ "bin/generate_api_key.rb",
26
29
  "init.rb",
27
30
  "landslider.gemspec",
28
31
  "lib/landslider.rb",
data/lib/landslider.rb CHANGED
@@ -4,8 +4,11 @@ require 'handsoap'
4
4
  class Landslider < Handsoap::Service
5
5
 
6
6
  LS_API_NAMESPACE='http://www.landslide.com/webservices/SoapService'
7
-
8
- endpoint ::LS_API_ENDPOINT
7
+ LS_API_ENDPOINT = {
8
+ :uri => "https://#{LS_INSTANCE_NAME}.api.landslide.com/webservices/SoapService",
9
+ :version => 1
10
+ }
11
+ endpoint LS_API_ENDPOINT
9
12
 
10
13
  attr_accessor :session_id
11
14
 
@@ -81,12 +84,13 @@ class Landslider < Handsoap::Service
81
84
  parse_get_account_by_id_result(node)
82
85
  end
83
86
 
84
- def get_account_contacts(session_id, account_id)
87
+ def get_account_contacts(session_id, account_id, is_primary=false)
85
88
  self.session_id = session_id
86
89
  response = invoke("getAccountContacts", :soap_action => :none) do |message|
87
90
  message.add 'accountId', account_id
91
+ message.add 'isPrimary', is_primary
88
92
  end
89
-
93
+
90
94
  node = response.document.xpath('//ns:getAccountContactsResponse', ns)
91
95
  parse_get_account_contacts_result(node)
92
96
  end
@@ -66,15 +66,25 @@ class LandsliderTest < Test::Unit::TestCase
66
66
  end
67
67
 
68
68
  def test_landslider_get_account_contacts
69
- # exists on jaytest
70
- result = Landslider.get_account_contacts($sid, 51857822)
71
-
69
+ result = Landslider.get_account_contacts($sid, 55647822)
70
+
71
+ assert_equal 3, result[:results_returned]
72
72
  validate_standard_api_result result
73
73
  assert_equal Array, result[:contacts].class
74
74
  assert_not_nil result[:contacts].first[:contact_id]
75
75
  assert result[:contacts].all? { |con| !con[:last_name].nil? }, "last name required"
76
76
  end
77
77
 
78
+ def test_landslider_get_account_contacts_primary
79
+ result = Landslider.get_account_contacts($sid, 55647822, true)
80
+
81
+ assert_equal 1, result[:results_returned]
82
+ assert_equal 'Primary', result[:contacts].first[:first_name]
83
+ assert_equal 'Contact', result[:contacts].first[:last_name]
84
+
85
+ end
86
+
87
+
78
88
  def test_landslider_get_account_custom_fields
79
89
  result = Landslider.get_account_custom_fields($sid)
80
90
  assert_not_nil result[:custom_fields]
data/test/test_helper.rb CHANGED
@@ -1,14 +1,8 @@
1
- require 'digest/md5'
2
1
 
3
2
  # constants to be set by rails environment config files
4
3
  LS_INSTANCE_NAME = 'jaytest'
5
4
  LS_API_USERNAME = 'jayp@landslide.com'
6
- LS_API_PASSWORD = 'Applogin1'
7
- LS_API_KEY = Digest::MD5.hexdigest(LS_API_PASSWORD + LS_INSTANCE_NAME)
8
- LS_API_ENDPOINT = {
9
- :uri => "https://#{LS_INSTANCE_NAME}.api.landslide.com/webservices/SoapService",
10
- :version => 1
11
- }
5
+ LS_API_KEY = '53308ccbdcb7f23fbd81a0b2ebcf12a4'
12
6
 
13
7
  require 'test/unit'
14
8
  require 'landslider'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: landslider
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.8
5
+ version: 0.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jay Prall
@@ -10,8 +10,8 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-29 00:00:00 -04:00
14
- default_executable:
13
+ date: 2011-05-02 00:00:00 -04:00
14
+ default_executable: generate_api_key.rb
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: jeweler
@@ -59,8 +59,8 @@ dependencies:
59
59
  version_requirements: *id004
60
60
  description: Landslider is a ruby interface to the Landslide SOAP-based API
61
61
  email: jay@j4y.net
62
- executables: []
63
-
62
+ executables:
63
+ - generate_api_key.rb
64
64
  extensions: []
65
65
 
66
66
  extra_rdoc_files:
@@ -73,6 +73,7 @@ files:
73
73
  - README.rdoc
74
74
  - Rakefile
75
75
  - VERSION.yml
76
+ - bin/generate_api_key.rb
76
77
  - init.rb
77
78
  - landslider.gemspec
78
79
  - lib/landslider.rb