paypal-sdk-rest 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,93 @@
1
+ require 'spec_helper'
2
+
3
+ describe "WebProfiles" do
4
+
5
+ WebProfileAttributes = {
6
+ "name" => "YeowZa! T-Shirt Shop",
7
+ "presentation" => {
8
+ "brand_name" => "YeowZa! Paypal",
9
+ "logo_image" => "http://www.yeowza.com",
10
+ "locale_code" => "US"
11
+ },
12
+ "input_fields" => {
13
+ "allow_note" => true,
14
+ "no_shipping" => 0,
15
+ "address_override" => 1
16
+ },
17
+ "flow_config" => {
18
+ "landing_page_type" => "billing",
19
+ "bank_txn_pending_url" => "http://www.yeowza.com"
20
+ }
21
+ }
22
+
23
+ describe "Examples" do
24
+ describe "WebProfile", :integration => true do
25
+ it "Create" do
26
+ api = API.new
27
+ $webprofile = WebProfile.new(WebProfileAttributes.merge( :token => api.token ))
28
+ $webprofile.create
29
+ expect($webprofile.name.to_s).to eq("YeowZa! T-Shirt Shop")
30
+ end
31
+
32
+ it "List" do
33
+ list = WebProfile.get_list
34
+ expect(list.size).to be > 1
35
+ end
36
+
37
+ it "Retrieve" do
38
+ webprofile = WebProfile.find("XP-A4UX-5GLG-DAA8-26FL")
39
+ expect(webprofile.name.to_s).to eq("YeowZa! T-Shirt Shop-8871170336226187544")
40
+ end
41
+
42
+ it "Update" do
43
+ # append "-test" to web profile name
44
+ webprofile = WebProfile.find("XP-A4UX-5GLG-DAA8-26FL")
45
+ webprofile.name += "-test"
46
+ webprofile.update
47
+
48
+ # check whether the name was updated
49
+ webprofile = WebProfile.find("XP-A4UX-5GLG-DAA8-26FL")
50
+ expect(webprofile.name).to eq("YeowZa! T-Shirt Shop-8871170336226187544-test")
51
+ webprofile.name = "YeowZa! T-Shirt Shop-8871170336226187544"
52
+ webprofile.update
53
+
54
+ # revert updated profile name for next test run
55
+ webprofile = WebProfile.find("XP-A4UX-5GLG-DAA8-26FL")
56
+ expect(webprofile.name).to eq("YeowZa! T-Shirt Shop-8871170336226187544")
57
+ end
58
+
59
+ it "Partial update" do
60
+ # retrieve web profile to perform partial update on
61
+ webprofile = WebProfile.find("XP-A4UX-5GLG-DAA8-26FL")
62
+
63
+ # set up partial update
64
+ h = {"op" => "replace",
65
+ "path" => "/presentation/brand_name",
66
+ "value" => "new_brand_name"}
67
+
68
+ # do partial update by sending a patch request
69
+ expect(webprofile.partial_update( [h] )).to be_truthy
70
+ webprofile = WebProfile.find("XP-A4UX-5GLG-DAA8-26FL")
71
+ expect(webprofile.presentation.brand_name).to eq("new_brand_name")
72
+
73
+ # restore original value for the next test run
74
+ h = {"op" => "replace",
75
+ "path" => "/presentation/brand_name",
76
+ "value" => "brand_name"}
77
+ expect(webprofile.partial_update( [h] )).to be_truthy
78
+ expect(WebProfile.find("XP-A4UX-5GLG-DAA8-26FL").presentation.brand_name).to eq("brand_name")
79
+ end
80
+
81
+ it "Delete" do
82
+ puts $webprofile.inspect
83
+ # delete newly created web profile from above create test
84
+ expect($webprofile.delete).to be_truthy
85
+
86
+ # make sure it is not retrieved from the system
87
+ webprofile = WebProfile.find($webprofile.id)
88
+ puts webprofile
89
+ expect(webprofile).to be_nil
90
+ end
91
+ end
92
+ end
93
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal-sdk-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - PayPal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-11 00:00:00.000000000 Z
11
+ date: 2014-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paypal-sdk-core
@@ -66,6 +66,7 @@ files:
66
66
  - spec/log/http.log
67
67
  - spec/payments_examples_spec.rb
68
68
  - spec/spec_helper.rb
69
+ - spec/web_profile_examples_spec.rb
69
70
  homepage: https://developer.paypal.com
70
71
  licenses:
71
72
  - PayPal SDK License
@@ -99,3 +100,4 @@ test_files:
99
100
  - spec/log/http.log
100
101
  - spec/payments_examples_spec.rb
101
102
  - spec/spec_helper.rb
103
+ - spec/web_profile_examples_spec.rb