fastspring-saasy 0.5.2 → 0.5.3
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 +35 -8
- data/VERSION +1 -1
- data/fastspring-saasy.gemspec +3 -3
- data/lib/fastspring-saasy.rb +5 -0
- data/lib/fastspring-saasy/order.rb +0 -1
- data/lib/fastspring-saasy/private_api_base.rb +2 -2
- data/lib/fastspring-saasy/public_api_base.rb +1 -1
- data/lib/fastspring-saasy/subscription.rb +4 -1
- data/spec/subscription_spec.rb +6 -0
- metadata +46 -16
data/README.rdoc
CHANGED
@@ -8,7 +8,7 @@ Ruby library to access the FastSpring Saasy API.
|
|
8
8
|
|
9
9
|
== Usage
|
10
10
|
|
11
|
-
|
11
|
+
Setup account credentials
|
12
12
|
|
13
13
|
FastSpring::Account.setup do |config|
|
14
14
|
config[:username] = 'user'
|
@@ -16,14 +16,41 @@ Ruby library to access the FastSpring Saasy API.
|
|
16
16
|
config[:company] = 'company'
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
FastSpring::Subscription.find('reference')
|
19
|
+
Get subscription
|
20
|
+
sub = FastSpring::Subscription.find('reference')
|
21
21
|
|
22
|
-
|
23
|
-
|
22
|
+
Renew subscription
|
23
|
+
sub.renew
|
24
24
|
|
25
|
-
|
25
|
+
Cancel subscription
|
26
|
+
sub.cancel!
|
27
|
+
|
28
|
+
Create subscriptions url
|
29
|
+
FastSpring::Subscription.create_subscription_url('test_product', 'new_co')
|
30
|
+
=> http://sites.fastspring.com/acme/product/test_product?referrer=new_co
|
31
|
+
|
32
|
+
Orders
|
33
|
+
order = FastSpring::Order.find('reference')
|
34
|
+
order.items.each do |item|
|
35
|
+
# item.inspect
|
36
|
+
end
|
37
|
+
|
38
|
+
order.payments.each do |payment|
|
39
|
+
# payment.inspect
|
40
|
+
end
|
26
41
|
|
27
|
-
|
28
|
-
|
42
|
+
#customer details
|
43
|
+
order.purchaser.inspect
|
44
|
+
|
45
|
+
Localized Store Pricing
|
46
|
+
store_pricing = FastSpring::LocalizedStorePricing.find(['/standard'], http_request)
|
47
|
+
|
48
|
+
puts store_pricing.inspect
|
49
|
+
|
50
|
+
|
51
|
+
== FastSpring
|
52
|
+
FastSpring have their own gem at https://github.com/fastspring/fastspring-ruby
|
53
|
+
|
54
|
+
== Copyright
|
29
55
|
|
56
|
+
Copyright (c) 2012 Richard Patching. See LICENSE.txt for further details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/fastspring-saasy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "fastspring-saasy"
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Richard Patching"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-07-13"
|
13
13
|
s.description = "Ruby lib for using the FastSpring (Saas) subscription management API"
|
14
14
|
s.email = "richard@justaddpixels.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -54,7 +54,7 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.homepage = "http://github.com/patchfx/fastspring"
|
55
55
|
s.licenses = ["MIT"]
|
56
56
|
s.require_paths = ["lib"]
|
57
|
-
s.rubygems_version = "1.8.
|
57
|
+
s.rubygems_version = "1.8.24"
|
58
58
|
s.summary = "Ruby lib for using the FastSpring (Saasy) API"
|
59
59
|
|
60
60
|
if s.respond_to? :specification_version then
|
data/lib/fastspring-saasy.rb
CHANGED
@@ -15,3 +15,8 @@ require_relative 'fastspring-saasy/public_api_base'
|
|
15
15
|
require_relative 'fastspring-saasy/localized_store_pricing'
|
16
16
|
|
17
17
|
require_relative 'fastspring-saasy/error'
|
18
|
+
|
19
|
+
module FastSpring
|
20
|
+
SITE_URL = 'http://sites.fastspring.com'
|
21
|
+
API_URL = 'https://api.fastspring.com'
|
22
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module FastSpring
|
2
2
|
class PrivateApiBase
|
3
3
|
include HTTParty
|
4
|
-
base_uri
|
4
|
+
base_uri "https://api.fastspring.com"
|
5
5
|
format :xml
|
6
6
|
#debug_output
|
7
7
|
|
@@ -18,7 +18,7 @@ module FastSpring
|
|
18
18
|
def self.find(reference)
|
19
19
|
self.new(reference).find
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def reference
|
23
23
|
@reference
|
24
24
|
end
|
@@ -2,7 +2,9 @@ require 'date'
|
|
2
2
|
|
3
3
|
module FastSpring
|
4
4
|
class Subscription < PrivateApiBase
|
5
|
-
|
5
|
+
def self.create_subscription_url(reference, referrer)
|
6
|
+
"#{SITE_URL}/#{FastSpring::Account.fetch(:company)}/product/#{reference}?referrer=#{referrer}"
|
7
|
+
end
|
6
8
|
# Get the subscription from Saasy
|
7
9
|
def find
|
8
10
|
@response = self.class.get(base_subscription_path, :basic_auth => @auth, :ssl_ca_file => @ssl_ca_file)
|
@@ -47,6 +49,7 @@ module FastSpring
|
|
47
49
|
def destroy
|
48
50
|
self.class.delete(base_subscription_path, :basic_auth => @auth)
|
49
51
|
end
|
52
|
+
alias :cancel! :destroy
|
50
53
|
|
51
54
|
def renew_path
|
52
55
|
"#{base_subscription_path}/renew"
|
data/spec/subscription_spec.rb
CHANGED
@@ -87,6 +87,12 @@ describe FastSpring::Subscription do
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
context 'create subscriptions path' do
|
91
|
+
it 'returns the path for creating a new subscription' do
|
92
|
+
FastSpring::Subscription.create_subscription_url('tnt','acme_co').should == "http://sites.fastspring.com/acme/product/tnt?referrer=acme_co"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
90
96
|
context 'renew' do
|
91
97
|
subject { FastSpring::Subscription.find('test_ref') }
|
92
98
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastspring-saasy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: httparty
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rake
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: bundler
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: '0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: jeweler
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '0'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: ruby-debug19
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: httparty
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ~>
|
@@ -76,7 +101,12 @@ dependencies:
|
|
76
101
|
version: 0.8.1
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.8.1
|
80
110
|
description: Ruby lib for using the FastSpring (Saas) subscription management API
|
81
111
|
email: richard@justaddpixels.com
|
82
112
|
executables: []
|
@@ -133,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
163
|
version: '0'
|
134
164
|
segments:
|
135
165
|
- 0
|
136
|
-
hash:
|
166
|
+
hash: 3023975439088520452
|
137
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
168
|
none: false
|
139
169
|
requirements:
|
@@ -142,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
172
|
version: '0'
|
143
173
|
requirements: []
|
144
174
|
rubyforge_project:
|
145
|
-
rubygems_version: 1.8.
|
175
|
+
rubygems_version: 1.8.24
|
146
176
|
signing_key:
|
147
177
|
specification_version: 3
|
148
178
|
summary: Ruby lib for using the FastSpring (Saasy) API
|