fastspring-saasy 0.6.0 → 0.6.2
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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile.lock +3 -0
- data/LICENSE.txt +1 -1
- data/README.md +92 -0
- data/fastspring-saasy.gemspec +7 -8
- data/lib/fastspring-saasy.rb +5 -4
- data/lib/fastspring-saasy/build/localized_store_prices.rb +39 -0
- data/lib/fastspring-saasy/localized_store_price.rb +38 -0
- data/lib/fastspring-saasy/localized_store_pricing.rb +23 -50
- data/spec/localized_store_pricing_spec.rb +24 -24
- data/spec/spec_helper.rb +1 -5
- metadata +60 -34
- data/.document +0 -5
- data/.rspec +0 -1
- data/README.rdoc +0 -77
- data/VERSION +0 -1
- data/fastspring-saasy-0.5.5.gem +0 -0
- data/lib/httparty/txt_parser.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d81462dd519e9b4c7b723bf387fcf6ab6dfe131
|
4
|
+
data.tar.gz: 67d4331d3218b673fcb84c04355b558d3c352fb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce14e45cef89b9865a4a267beec2030bef72f55962a957def6c9fd7413674202908749814baf81e966502a986388ecba7ff61207eacd1d3d4dac5dbdcaba5196
|
7
|
+
data.tar.gz: 9858db198a5e2cd5b0643d12fd062f65b31d6b961dc0d8caf5c91527fbb6beaf65ff81cf3e7c9f1cb4d88f0de6a6c27ed3ee167df114df89dd29067a63248692
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# fastspring-saasy
|
2
|
+
|
3
|
+
Ruby library to access the FastSpring Saasy API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem install fastspring-saasy
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
### Setup account credentials
|
14
|
+
```ruby
|
15
|
+
FastSpring::Account.setup do |config|
|
16
|
+
config[:username] = 'user'
|
17
|
+
config[:password] = 'password'
|
18
|
+
config[:company] = 'company'
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
## Get subscription
|
23
|
+
```ruby
|
24
|
+
sub = FastSpring::Subscription.find('reference')
|
25
|
+
```
|
26
|
+
|
27
|
+
### Renew subscription
|
28
|
+
```ruby
|
29
|
+
sub.renew
|
30
|
+
```
|
31
|
+
|
32
|
+
### Update subscription
|
33
|
+
```ruby
|
34
|
+
attributes = {
|
35
|
+
first_name: 'John',
|
36
|
+
last_name: 'Doe',
|
37
|
+
company: 'Doe Inc.',
|
38
|
+
email: 'john.doe@example.com',
|
39
|
+
phone_number: '+1 123 456 789',
|
40
|
+
product_path: '/product',
|
41
|
+
quantity: 1,
|
42
|
+
tags: 'tag1, tag2, tag3',
|
43
|
+
coupon: 'code',
|
44
|
+
proration: true
|
45
|
+
}
|
46
|
+
sub.update!(attributes)
|
47
|
+
```
|
48
|
+
|
49
|
+
### Cancel subscription
|
50
|
+
```ruby
|
51
|
+
sub.cancel!
|
52
|
+
```
|
53
|
+
|
54
|
+
### Create subscriptions url
|
55
|
+
```ruby
|
56
|
+
FastSpring::Subscription.create_subscription_url('test_product', 'new_co')
|
57
|
+
=> http://sites.fastspring.com/acme/product/test_product?referrer=new_co
|
58
|
+
```
|
59
|
+
|
60
|
+
### Search Orders
|
61
|
+
```ruby
|
62
|
+
orders = FastSpring::Order.search('search-string')
|
63
|
+
orders.each do |order|
|
64
|
+
puts order.inspect
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
### Find Order
|
69
|
+
```ruby
|
70
|
+
order = FastSpring::Order.find('reference')
|
71
|
+
order.items.each do |item|
|
72
|
+
puts item.inspect
|
73
|
+
end
|
74
|
+
|
75
|
+
order.payments.each do |payment|
|
76
|
+
puts payment.inspect
|
77
|
+
end
|
78
|
+
|
79
|
+
#customer details
|
80
|
+
order.purchaser.inspect
|
81
|
+
```
|
82
|
+
|
83
|
+
### Localized Store Pricing
|
84
|
+
```ruby
|
85
|
+
store_pricing = FastSpring::LocalizedStorePricing.find(['/standard'], http_request)
|
86
|
+
|
87
|
+
puts store_pricing.inspect
|
88
|
+
```
|
89
|
+
|
90
|
+
## Copyright
|
91
|
+
|
92
|
+
Copyright (c) 2016 Richard Patching. See LICENSE.txt for further details.
|
data/fastspring-saasy.gemspec
CHANGED
@@ -4,24 +4,23 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "fastspring-saasy"
|
7
|
-
s.version = "0.6.
|
7
|
+
s.version = "0.6.2"
|
8
8
|
|
9
9
|
s.authors = ["Richard Patching"]
|
10
10
|
s.email = "richard@justaddpixels.com"
|
11
11
|
s.description = "Ruby lib for using the FastSpring (SaaSy) subscription management API"
|
12
12
|
s.summary = "Ruby lib for using the FastSpring (Saasy) API"
|
13
|
-
s.homepage = "http://github.com/patchfx/fastspring"
|
13
|
+
s.homepage = "http://github.com/patchfx/fastspring-saasy"
|
14
14
|
|
15
15
|
s.files = `git ls-files`.split($/)
|
16
16
|
s.licenses = ["MIT"]
|
17
17
|
s.require_paths = ["lib"]
|
18
18
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
19
19
|
|
20
|
-
s.add_dependency "httparty"
|
21
|
-
s.add_dependency "gyoku"
|
20
|
+
s.add_dependency "httparty", "~> 0.10.0", ">= 0.10.0"
|
21
|
+
s.add_dependency "gyoku", "~> 1.0.0", ">= 1.0.0"
|
22
22
|
|
23
|
-
s.add_development_dependency "rake"
|
24
|
-
s.add_development_dependency "rspec"
|
25
|
-
s.add_development_dependency "webmock"
|
23
|
+
s.add_development_dependency "rake", "~> 10.0.3", ">= 10.0.3"
|
24
|
+
s.add_development_dependency "rspec", "~> 2.12.0", ">= 2.12.0"
|
25
|
+
s.add_development_dependency "webmock", "~> 1.9.0", ">= 1.9.0"
|
26
26
|
end
|
27
|
-
|
data/lib/fastspring-saasy.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
|
3
|
-
require_relative 'httparty/txt_parser'
|
4
|
-
|
5
3
|
require_relative 'fastspring-saasy/private_api_base'
|
4
|
+
require_relative 'fastspring-saasy/public_api_base'
|
5
|
+
|
6
6
|
require_relative 'fastspring-saasy/account'
|
7
7
|
require_relative 'fastspring-saasy/subscription'
|
8
8
|
require_relative 'fastspring-saasy/customer'
|
@@ -11,7 +11,8 @@ require_relative 'fastspring-saasy/item'
|
|
11
11
|
require_relative 'fastspring-saasy/payment'
|
12
12
|
require_relative 'fastspring-saasy/address'
|
13
13
|
|
14
|
-
require_relative 'fastspring-saasy/
|
14
|
+
require_relative 'fastspring-saasy/build/localized_store_prices'
|
15
|
+
require_relative 'fastspring-saasy/localized_store_price'
|
15
16
|
require_relative 'fastspring-saasy/localized_store_pricing'
|
16
17
|
|
17
18
|
require_relative 'fastspring-saasy/error'
|
@@ -19,5 +20,5 @@ require_relative 'fastspring-saasy/error'
|
|
19
20
|
module FastSpring
|
20
21
|
SITE_URL = 'http://sites.fastspring.com'
|
21
22
|
API_URL = 'https://api.fastspring.com'
|
22
|
-
VERSION = "0.6"
|
23
|
+
VERSION = "0.6.2"
|
23
24
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module FastSpring
|
2
|
+
module Build
|
3
|
+
class LocalizedStorePrices
|
4
|
+
attr_reader :localized_pricing, :products
|
5
|
+
|
6
|
+
def initialize(pricing)
|
7
|
+
@pricing = pricing || []
|
8
|
+
@products = []
|
9
|
+
@localized_pricing = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def build
|
13
|
+
return if @pricing.empty?
|
14
|
+
parsed = @pricing.split("\n").map { |f| f.split("=") }
|
15
|
+
@localized_pricing = Hash[parsed]
|
16
|
+
build_products
|
17
|
+
self
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def build_products
|
23
|
+
product_names = []
|
24
|
+
@localized_pricing.keys.each do |key|
|
25
|
+
product = /product_[0-9]/.match(key)
|
26
|
+
product_names << product.to_s unless product.nil?
|
27
|
+
end
|
28
|
+
create_localized_products_for(product_names.uniq)
|
29
|
+
end
|
30
|
+
|
31
|
+
def create_localized_products_for(product_names)
|
32
|
+
product_names.each do |product|
|
33
|
+
keys = @localized_pricing.select { |key, value| key.to_s.match(/#{product}/) }
|
34
|
+
@products << LocalizedStorePrice.new(product, keys)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module FastSpring
|
2
|
+
class LocalizedStorePrice
|
3
|
+
attr_reader :product
|
4
|
+
|
5
|
+
def initialize(product, params)
|
6
|
+
@product = product
|
7
|
+
@params = params
|
8
|
+
end
|
9
|
+
|
10
|
+
def path
|
11
|
+
fetch('path')
|
12
|
+
end
|
13
|
+
|
14
|
+
def quantity
|
15
|
+
fetch('quantity')
|
16
|
+
end
|
17
|
+
|
18
|
+
def unit_value
|
19
|
+
fetch('unit_value')
|
20
|
+
end
|
21
|
+
|
22
|
+
def unit_currency
|
23
|
+
fetch('unit_currency')
|
24
|
+
end
|
25
|
+
|
26
|
+
def unit_display
|
27
|
+
fetch('unit_display')
|
28
|
+
end
|
29
|
+
|
30
|
+
def unit_html
|
31
|
+
fetch('unit_html')
|
32
|
+
end
|
33
|
+
|
34
|
+
def fetch(key)
|
35
|
+
@params["#{product}_#{key}"]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -4,86 +4,59 @@ module FastSpring
|
|
4
4
|
def find
|
5
5
|
# For some reason the implicit determination of the Txt parser does not work.
|
6
6
|
# So we'll just blatently pass it in right now.
|
7
|
-
@response = self.class.get(base_localized_store_pricing_path, :query => query
|
7
|
+
@response = self.class.get(base_localized_store_pricing_path, :query => query)
|
8
|
+
@builder = Build::LocalizedStorePrices.new(@response.parsed_response).build
|
8
9
|
self
|
9
10
|
end
|
10
|
-
|
11
|
+
|
11
12
|
def base_localized_store_pricing_path
|
12
13
|
"/#{@company}/api/price"
|
13
14
|
end
|
14
|
-
|
15
|
+
|
15
16
|
def query
|
16
17
|
query_hash = Hash.new
|
17
18
|
@product_paths.each_index{ |index| query_hash["product_#{(index + 1)}_path".to_sym] = @product_paths[index] }
|
18
|
-
query_hash.merge({
|
19
|
+
query_hash.merge({
|
19
20
|
:user_remote_addr => @remote_ip,
|
20
21
|
:user_accept_language => @http_accept_language,
|
21
22
|
:user_x_forwarded_for => @http_x_forwarded_for
|
22
23
|
})
|
23
24
|
end
|
24
|
-
|
25
|
+
|
25
26
|
def user_country
|
26
|
-
|
27
|
+
@builder.localized_pricing['user_country']
|
27
28
|
end
|
28
|
-
|
29
|
+
|
29
30
|
def user_language
|
30
|
-
|
31
|
+
@builder.localized_pricing['user_language']
|
31
32
|
end
|
32
|
-
|
33
|
+
|
33
34
|
def user_currency
|
34
|
-
|
35
|
+
@builder.localized_pricing['user_currency']
|
35
36
|
end
|
36
|
-
|
37
|
+
|
37
38
|
def product_quantity(product_path)
|
38
|
-
|
39
|
+
product(product_path).quantity
|
39
40
|
end
|
40
|
-
|
41
|
+
|
41
42
|
def product_unit_value(product_path)
|
42
|
-
|
43
|
+
product(product_path).unit_value
|
43
44
|
end
|
44
|
-
|
45
|
+
|
45
46
|
def product_unit_currency(product_path)
|
46
|
-
|
47
|
+
product(product_path).unit_currency
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def product_unit_display(product_path)
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
def product_unit_html(product_path)
|
54
|
-
parsed_response[product_path]["unit_html"]
|
51
|
+
product(product_path).unit_display
|
55
52
|
end
|
56
53
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
def parsed_response
|
61
|
-
@parsed_response ||= parse_response
|
54
|
+
def product_unit_html(product_path)
|
55
|
+
product(product_path).unit_html
|
62
56
|
end
|
63
|
-
|
64
|
-
def parse_response
|
65
|
-
response = Hash.new
|
66
|
-
|
67
|
-
index = 1
|
68
|
-
more_products = true
|
69
|
-
while more_products
|
70
|
-
product_path = @response.parsed_response["product_#{index}_path"]
|
71
|
-
if product_path
|
72
|
-
@response.parsed_response.each do |key, value|
|
73
|
-
if key.match("product_#{index}") && key != "product_#{index}_path" then
|
74
|
-
response[product_path] ||= Hash.new
|
75
|
-
response[product_path][key.match(/\d+_(.*)/)[1]] = value
|
76
|
-
end
|
77
|
-
end
|
78
|
-
index += 1
|
79
|
-
else
|
80
|
-
more_products = false
|
81
|
-
end
|
82
|
-
end
|
83
57
|
|
84
|
-
|
85
|
-
|
86
|
-
)
|
58
|
+
def product(product_path)
|
59
|
+
@builder.products.select { |product| product.path == product_path }.first
|
87
60
|
end
|
88
61
|
end
|
89
62
|
end
|
@@ -25,7 +25,7 @@ describe FastSpring::LocalizedStorePricing do
|
|
25
25
|
config[:username] = 'admin'
|
26
26
|
config[:password] = 'test'
|
27
27
|
config[:company] = 'acme'
|
28
|
-
end
|
28
|
+
end
|
29
29
|
end
|
30
30
|
|
31
31
|
context 'url for localized store pricing' do
|
@@ -35,24 +35,24 @@ describe FastSpring::LocalizedStorePricing do
|
|
35
35
|
stub_request(:get, "http://sites.fastspring.com/acme/api/price?product_1_path=/standard&user_accept_language=nl&user_remote_addr=192.168.1.1&user_x_forwarded_for=192.168.1.2").
|
36
36
|
to_return(:status => 200, :body => "", :headers => {})
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it 'returns the path for the company' do
|
40
40
|
subject.base_localized_store_pricing_path.should == "/acme/api/price"
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
context "with invalid http request" do
|
45
45
|
subject { FastSpring::LocalizedStorePricing.find(['/standard'], invalid_http_request) }
|
46
46
|
before do
|
47
47
|
stub_request(:get, "http://sites.fastspring.com/acme/api/price?product_1_path=/standard&user_accept_language=en&user_remote_addr=127.0.0.1&user_x_forwarded_for=").
|
48
48
|
to_return(:status => 200, :body => "", :headers => {})
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
it 'returns the path for the company' do
|
52
52
|
subject.base_localized_store_pricing_path.should == "/acme/api/price"
|
53
53
|
end
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
context "with partial http request" do
|
57
57
|
subject { FastSpring::LocalizedStorePricing.find(['/standard'], partial_http_request) }
|
58
58
|
before do
|
@@ -65,86 +65,86 @@ describe FastSpring::LocalizedStorePricing do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
context "parsed response for 1 product" do
|
70
70
|
subject { FastSpring::LocalizedStorePricing.find(['/standard'], valid_http_request) }
|
71
71
|
before do
|
72
72
|
stub_request(:get, "https://api.fastspring.com/bizplay/api/price?product_1_path=/standard&user_accept_language=nl&user_remote_addr=192.168.1.1&user_x_forwarded_for=192.168.1.2").
|
73
73
|
to_return(stub_http_response_with('basic_localized_store_pricing.txt'))
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
76
|
it 'returns "US" as the user country' do
|
77
77
|
subject.user_country.should == "US"
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
it 'returns "en" as the user language' do
|
81
81
|
subject.user_language.should == "en"
|
82
82
|
end
|
83
|
-
|
83
|
+
|
84
84
|
it 'returns "USD" as the user currency' do
|
85
85
|
subject.user_currency.should == "USD"
|
86
86
|
end
|
87
|
-
|
87
|
+
|
88
88
|
it 'returns "1" as the quantity of product 1' do
|
89
89
|
subject.product_quantity("/standard").should == "1"
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
it 'returns "35.00" as unit value of product 1' do
|
93
93
|
subject.product_unit_value("/standard").should == "35.00"
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
96
|
it 'returns "USD" as the unit currency of product 1' do
|
97
97
|
subject.product_unit_currency("/standard").should == "USD"
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
it 'returns "$35.00" as the unit display of product 1' do
|
101
101
|
subject.product_unit_display("/standard").should == "$35.00"
|
102
102
|
end
|
103
|
-
|
103
|
+
|
104
104
|
it 'returns "$35.00" as the unit html of product 1' do
|
105
105
|
subject.product_unit_html("/standard").should == "$35.00"
|
106
106
|
end
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
context "localized pricing details specifically for 3 product" do
|
110
110
|
subject { FastSpring::LocalizedStorePricing.find(['/basic','/standard','/plus'], valid_http_request) }
|
111
111
|
before do
|
112
112
|
stub_request(:get, "http://sites.fastspring.com/acme/api/price?product_1_path=/basic&product_2_path=/standard&product_3_path=/plus&user_accept_language=nl&user_remote_addr=192.168.1.1&user_x_forwarded_for=192.168.1.2").
|
113
113
|
to_return(stub_http_response_with('basic_localized_store_pricing_with_3_products.txt'))
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
it 'it sends "/basic" as the product_1_path' do
|
117
117
|
subject.query[:product_1_path].should == "/basic"
|
118
118
|
end
|
119
|
-
|
119
|
+
|
120
120
|
it 'it sends "/standard" as the product_2_path' do
|
121
121
|
subject.query[:product_2_path].should == "/standard"
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
124
|
it 'it sends "/plus" as the product_3_path' do
|
125
125
|
subject.query[:product_3_path].should == "/plus"
|
126
126
|
end
|
127
|
-
|
127
|
+
|
128
128
|
it 'returns "US" as the user country' do
|
129
129
|
subject.user_country.should == "US"
|
130
130
|
end
|
131
|
-
|
131
|
+
|
132
132
|
it 'returns "en" as the user language' do
|
133
133
|
subject.user_language.should == "en"
|
134
134
|
end
|
135
|
-
|
135
|
+
|
136
136
|
it 'returns "USD" as the user currency' do
|
137
137
|
subject.user_currency.should == "USD"
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
140
|
it 'returns "$19.00" as the unit display of product 1' do
|
141
141
|
subject.product_unit_display("/basic").should == "$19.00"
|
142
142
|
end
|
143
|
-
|
143
|
+
|
144
144
|
it 'returns "$35.00" as the unit display of product 2' do
|
145
145
|
subject.product_unit_display("/standard").should == "$35.00"
|
146
146
|
end
|
147
|
-
|
147
|
+
|
148
148
|
it 'returns "$59.00" as the unit display of product 3' do
|
149
149
|
subject.product_unit_display("/plus").should == "$59.00"
|
150
150
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -17,11 +17,7 @@ def stub_http_response_with(filename, type=:get)
|
|
17
17
|
request_type = Net::HTTP::Get if type == :get
|
18
18
|
request_type = Net::HTTP::Put if type == :put
|
19
19
|
|
20
|
-
|
21
|
-
http_request = HTTParty::Request.new(request_type, 'http://localhost', :format => format, :parser => HTTParty::Parser::Txt)
|
22
|
-
else
|
23
|
-
http_request = HTTParty::Request.new(request_type, 'http://localhost', :format => format)
|
24
|
-
end
|
20
|
+
http_request = HTTParty::Request.new(request_type, 'http://localhost', :format => format)
|
25
21
|
http_request.stub_chain(:http, :request).and_return(response)
|
26
22
|
|
27
23
|
HTTParty::Request.should_receive(:new).at_most(2).times.and_return(http_request)
|
metadata
CHANGED
@@ -1,116 +1,143 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastspring-saasy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Patching
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.10.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.10.0
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.10.0
|
30
|
+
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 0.10.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: gyoku
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- -
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.0.0
|
40
|
+
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
42
|
+
version: 1.0.0
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- -
|
47
|
+
- - "~>"
|
39
48
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
49
|
+
version: 1.0.0
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 1.0.0
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: rake
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
45
|
-
- -
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 10.0.3
|
60
|
+
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
62
|
+
version: 10.0.3
|
48
63
|
type: :development
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
52
|
-
- -
|
67
|
+
- - "~>"
|
53
68
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
69
|
+
version: 10.0.3
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: 10.0.3
|
55
73
|
- !ruby/object:Gem::Dependency
|
56
74
|
name: rspec
|
57
75
|
requirement: !ruby/object:Gem::Requirement
|
58
76
|
requirements:
|
59
|
-
- -
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.12.0
|
80
|
+
- - ">="
|
60
81
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
82
|
+
version: 2.12.0
|
62
83
|
type: :development
|
63
84
|
prerelease: false
|
64
85
|
version_requirements: !ruby/object:Gem::Requirement
|
65
86
|
requirements:
|
66
|
-
- -
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.12.0
|
90
|
+
- - ">="
|
67
91
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
92
|
+
version: 2.12.0
|
69
93
|
- !ruby/object:Gem::Dependency
|
70
94
|
name: webmock
|
71
95
|
requirement: !ruby/object:Gem::Requirement
|
72
96
|
requirements:
|
73
|
-
- -
|
97
|
+
- - "~>"
|
74
98
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
99
|
+
version: 1.9.0
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.9.0
|
76
103
|
type: :development
|
77
104
|
prerelease: false
|
78
105
|
version_requirements: !ruby/object:Gem::Requirement
|
79
106
|
requirements:
|
80
|
-
- -
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.9.0
|
110
|
+
- - ">="
|
81
111
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
112
|
+
version: 1.9.0
|
83
113
|
description: Ruby lib for using the FastSpring (SaaSy) subscription management API
|
84
114
|
email: richard@justaddpixels.com
|
85
115
|
executables: []
|
86
116
|
extensions: []
|
87
117
|
extra_rdoc_files: []
|
88
118
|
files:
|
89
|
-
- .
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
119
|
+
- ".gitignore"
|
92
120
|
- Gemfile
|
93
121
|
- Gemfile.lock
|
94
122
|
- LICENSE.txt
|
95
|
-
- README.
|
123
|
+
- README.md
|
96
124
|
- Rakefile
|
97
|
-
- VERSION
|
98
|
-
- fastspring-saasy-0.5.5.gem
|
99
125
|
- fastspring-saasy.gemspec
|
100
126
|
- lib/fastspring-saasy.rb
|
101
127
|
- lib/fastspring-saasy/account.rb
|
102
128
|
- lib/fastspring-saasy/address.rb
|
129
|
+
- lib/fastspring-saasy/build/localized_store_prices.rb
|
103
130
|
- lib/fastspring-saasy/customer.rb
|
104
131
|
- lib/fastspring-saasy/error.rb
|
105
132
|
- lib/fastspring-saasy/fastspring.crt
|
106
133
|
- lib/fastspring-saasy/item.rb
|
134
|
+
- lib/fastspring-saasy/localized_store_price.rb
|
107
135
|
- lib/fastspring-saasy/localized_store_pricing.rb
|
108
136
|
- lib/fastspring-saasy/order.rb
|
109
137
|
- lib/fastspring-saasy/payment.rb
|
110
138
|
- lib/fastspring-saasy/private_api_base.rb
|
111
139
|
- lib/fastspring-saasy/public_api_base.rb
|
112
140
|
- lib/fastspring-saasy/subscription.rb
|
113
|
-
- lib/httparty/txt_parser.rb
|
114
141
|
- spec/account_spec.rb
|
115
142
|
- spec/customer_spec.rb
|
116
143
|
- spec/fixtures/basic_localized_store_pricing.txt
|
@@ -123,7 +150,7 @@ files:
|
|
123
150
|
- spec/order_spec.rb
|
124
151
|
- spec/spec_helper.rb
|
125
152
|
- spec/subscription_spec.rb
|
126
|
-
homepage: http://github.com/patchfx/fastspring
|
153
|
+
homepage: http://github.com/patchfx/fastspring-saasy
|
127
154
|
licenses:
|
128
155
|
- MIT
|
129
156
|
metadata: {}
|
@@ -133,17 +160,17 @@ require_paths:
|
|
133
160
|
- lib
|
134
161
|
required_ruby_version: !ruby/object:Gem::Requirement
|
135
162
|
requirements:
|
136
|
-
- -
|
163
|
+
- - ">="
|
137
164
|
- !ruby/object:Gem::Version
|
138
165
|
version: '0'
|
139
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
167
|
requirements:
|
141
|
-
- -
|
168
|
+
- - ">="
|
142
169
|
- !ruby/object:Gem::Version
|
143
170
|
version: '0'
|
144
171
|
requirements: []
|
145
172
|
rubyforge_project:
|
146
|
-
rubygems_version: 2.
|
173
|
+
rubygems_version: 2.5.1
|
147
174
|
signing_key:
|
148
175
|
specification_version: 4
|
149
176
|
summary: Ruby lib for using the FastSpring (Saasy) API
|
@@ -160,4 +187,3 @@ test_files:
|
|
160
187
|
- spec/order_spec.rb
|
161
188
|
- spec/spec_helper.rb
|
162
189
|
- spec/subscription_spec.rb
|
163
|
-
has_rdoc:
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/README.rdoc
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
= fastspring-saasy
|
2
|
-
|
3
|
-
Ruby library to access the FastSpring Saasy API.
|
4
|
-
|
5
|
-
== Installation
|
6
|
-
|
7
|
-
gem install fastspring-saasy
|
8
|
-
|
9
|
-
== Usage
|
10
|
-
|
11
|
-
Setup account credentials
|
12
|
-
|
13
|
-
FastSpring::Account.setup do |config|
|
14
|
-
config[:username] = 'user'
|
15
|
-
config[:password] = 'password'
|
16
|
-
config[:company] = 'company'
|
17
|
-
end
|
18
|
-
|
19
|
-
Get subscription
|
20
|
-
sub = FastSpring::Subscription.find('reference')
|
21
|
-
|
22
|
-
Renew subscription
|
23
|
-
sub.renew
|
24
|
-
|
25
|
-
Update subscription
|
26
|
-
attributes = {
|
27
|
-
first_name: 'John',
|
28
|
-
last_name: 'Doe',
|
29
|
-
company: 'Doe Inc.',
|
30
|
-
email: 'john.doe@example.com',
|
31
|
-
phone_number: '+1 123 456 789',
|
32
|
-
product_path: '/product',
|
33
|
-
quantity: 1,
|
34
|
-
tags: 'tag1, tag2, tag3',
|
35
|
-
coupon: 'code',
|
36
|
-
proration: true
|
37
|
-
}
|
38
|
-
sub.update!(attributes)
|
39
|
-
|
40
|
-
Cancel subscription
|
41
|
-
sub.cancel!
|
42
|
-
|
43
|
-
Create subscriptions url
|
44
|
-
FastSpring::Subscription.create_subscription_url('test_product', 'new_co')
|
45
|
-
=> http://sites.fastspring.com/acme/product/test_product?referrer=new_co
|
46
|
-
|
47
|
-
Search Orders
|
48
|
-
orders = FastSpring::Order.search('search-string')
|
49
|
-
orders.each do |order|
|
50
|
-
# order.inspect
|
51
|
-
end
|
52
|
-
|
53
|
-
Find Order
|
54
|
-
order = FastSpring::Order.find('reference')
|
55
|
-
order.items.each do |item|
|
56
|
-
# item.inspect
|
57
|
-
end
|
58
|
-
|
59
|
-
order.payments.each do |payment|
|
60
|
-
# payment.inspect
|
61
|
-
end
|
62
|
-
|
63
|
-
#customer details
|
64
|
-
order.purchaser.inspect
|
65
|
-
|
66
|
-
Localized Store Pricing
|
67
|
-
store_pricing = FastSpring::LocalizedStorePricing.find(['/standard'], http_request)
|
68
|
-
|
69
|
-
puts store_pricing.inspect
|
70
|
-
|
71
|
-
|
72
|
-
== FastSpring
|
73
|
-
FastSpring have their own gem at https://github.com/fastspring/fastspring-ruby
|
74
|
-
|
75
|
-
== Copyright
|
76
|
-
|
77
|
-
Copyright (c) 2014 Richard Patching. See LICENSE.txt for further details.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.5.5
|
data/fastspring-saasy-0.5.5.gem
DELETED
Binary file
|
data/lib/httparty/txt_parser.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
class ParseTxt
|
2
|
-
include HTTParty
|
3
|
-
|
4
|
-
# Replace the :plain parser with this text parser
|
5
|
-
class Parser::Txt < HTTParty::Parser
|
6
|
-
SupportedFormats["text/plain"] = :txt
|
7
|
-
|
8
|
-
# perform text parsing on body
|
9
|
-
def txt
|
10
|
-
parsed_response = Hash.new
|
11
|
-
body.each_line do |line|
|
12
|
-
name_value = line.split("=")
|
13
|
-
parsed_response[name_value[0].strip] = name_value[1].strip if name_value.count == 2
|
14
|
-
end
|
15
|
-
parsed_response
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
parser Parser::Txt
|
20
|
-
end
|