faturando_api 0.1.1 → 0.1.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.
- data/README.md +7 -7
- data/lib/faturando/version.rb +1 -1
- data/lib/faturando_api.rb +22 -4
- data/spec/customer_spec.rb +7 -0
- data/spec/factories.rb +9 -0
- data/spec/feature_spec.rb +7 -0
- data/spec/feature_value_spec.rb +7 -0
- data/spec/project_spec.rb +12 -0
- data/spec/subscription_spec.rb +7 -0
- metadata +22 -12
data/README.md
CHANGED
@@ -18,7 +18,7 @@ $ gem install faturando_api
|
|
18
18
|
|
19
19
|
### Requisitos
|
20
20
|
|
21
|
-
Esta biblioteca depende do ActiveResource com versão 2.3.4 ou
|
21
|
+
Esta biblioteca depende do ActiveResource com versão 2.3.4 ou superior.
|
22
22
|
|
23
23
|
$ gem install activeresource
|
24
24
|
|
@@ -27,7 +27,7 @@ $ gem install activeresource
|
|
27
27
|
|
28
28
|
Para utilizar a biblioteca basta importá-la utilizando:
|
29
29
|
|
30
|
-
|
30
|
+
require 'faturando_api'
|
31
31
|
|
32
32
|
|
33
33
|
Se você está usando Rails 3 basta adicionar a seguinte linha no Gemfile:
|
@@ -43,9 +43,9 @@ por exemplo, no `environment.rb`
|
|
43
43
|
|
44
44
|
Para poder se comunicar com o Faturando você precisa configurar a chave da API e o código do produto a ser utilizado.
|
45
45
|
|
46
|
-
Faturando.configure do |c|
|
47
|
-
|
48
|
-
|
49
|
-
end
|
46
|
+
Faturando.configure do |c|
|
47
|
+
c.project_key = '1234'
|
48
|
+
c.api_key = 'XYZ'
|
49
|
+
end
|
50
50
|
|
51
|
-
Se você estiver utilizando Rails deve
|
51
|
+
Se você estiver utilizando Rails deve preferencialmente criar um initializer.
|
data/lib/faturando/version.rb
CHANGED
data/lib/faturando_api.rb
CHANGED
@@ -55,11 +55,17 @@ module Faturando
|
|
55
55
|
Base.password = 'X'
|
56
56
|
Base.timeout = timeout unless (timeout.blank?)
|
57
57
|
|
58
|
-
self.site ||= "https://faturan.do
|
58
|
+
self.site ||= "https://faturan.do"
|
59
|
+
project_base_path = site + "/projects/#{project_key}"
|
59
60
|
|
60
|
-
|
61
|
-
|
62
|
-
|
61
|
+
Base.site = site
|
62
|
+
|
63
|
+
Plan.site = project_base_path
|
64
|
+
Feature.site = project_base_path
|
65
|
+
Customer.site = project_base_path
|
66
|
+
Subscription.site = project_base_path
|
67
|
+
|
68
|
+
FeatureValue.site = project_base_path + "/plans/:plan_id"
|
63
69
|
end
|
64
70
|
end
|
65
71
|
|
@@ -76,6 +82,18 @@ module Faturando
|
|
76
82
|
end
|
77
83
|
end
|
78
84
|
|
85
|
+
class Project < Base
|
86
|
+
def self.current
|
87
|
+
self.find(Faturando.project_key)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
class Subscription < Base
|
92
|
+
end
|
93
|
+
|
94
|
+
class Customer < Base
|
95
|
+
end
|
96
|
+
|
79
97
|
class Feature < Base
|
80
98
|
end
|
81
99
|
|
data/spec/factories.rb
CHANGED
@@ -3,6 +3,15 @@ FactoryGirl.define do
|
|
3
3
|
"Plan #{n}"
|
4
4
|
end
|
5
5
|
|
6
|
+
sequence :project_name do |n|
|
7
|
+
"Project #{n}"
|
8
|
+
end
|
9
|
+
|
10
|
+
factory :project, :class => Faturando::Project do |p|
|
11
|
+
p.name { FactoryGirl.generate(:project_name) }
|
12
|
+
p.description { Faker::Lorem.sentence }
|
13
|
+
end
|
14
|
+
|
6
15
|
factory :plan, :class => Faturando::Plan do |p|
|
7
16
|
p.name { FactoryGirl.generate(:plan_name) }
|
8
17
|
p.value { 19.99 }
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe Faturando::Project do
|
4
|
+
it 'has a default site config' do
|
5
|
+
Faturando::Project.site.to_s.should == 'https://faturan.do'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'returns current project details' do
|
9
|
+
project = Factory(:project, :id => "1234")
|
10
|
+
Faturando::Project.current.should == project
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faturando_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
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: 2011-
|
12
|
+
date: 2011-11-17 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &80642510 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *80642510
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: factory_girl
|
27
|
-
requirement: &
|
27
|
+
requirement: &80642300 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *80642300
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: fakeweb
|
38
|
-
requirement: &
|
38
|
+
requirement: &80642090 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *80642090
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: faker
|
49
|
-
requirement: &
|
49
|
+
requirement: &80641880 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *80641880
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: activeresource
|
60
|
-
requirement: &
|
60
|
+
requirement: &80641670 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *80641670
|
69
69
|
description: A Faturando API wrapper for Ruby using ActiveResource
|
70
70
|
email:
|
71
71
|
- andersondaraujo@gmail.com
|
@@ -79,10 +79,15 @@ files:
|
|
79
79
|
- README.md
|
80
80
|
- spec/mocks/fake_resource.rb
|
81
81
|
- spec/spec_helper.rb
|
82
|
+
- spec/customer_spec.rb
|
83
|
+
- spec/project_spec.rb
|
82
84
|
- spec/plan_spec.rb
|
83
85
|
- spec/factories.rb
|
84
86
|
- spec/spec.opts
|
85
87
|
- spec/base_spec.rb
|
88
|
+
- spec/feature_value_spec.rb
|
89
|
+
- spec/subscription_spec.rb
|
90
|
+
- spec/feature_spec.rb
|
86
91
|
homepage: http://github.com/tink/faturando_api
|
87
92
|
licenses: []
|
88
93
|
post_install_message:
|
@@ -110,7 +115,12 @@ summary: A Faturando API wrapper for Ruby using ActiveResource
|
|
110
115
|
test_files:
|
111
116
|
- spec/mocks/fake_resource.rb
|
112
117
|
- spec/spec_helper.rb
|
118
|
+
- spec/customer_spec.rb
|
119
|
+
- spec/project_spec.rb
|
113
120
|
- spec/plan_spec.rb
|
114
121
|
- spec/factories.rb
|
115
122
|
- spec/spec.opts
|
116
123
|
- spec/base_spec.rb
|
124
|
+
- spec/feature_value_spec.rb
|
125
|
+
- spec/subscription_spec.rb
|
126
|
+
- spec/feature_spec.rb
|