api-moip-assinaturas 0.0.5 → 0.0.6
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 +8 -8
- data/api_moip_assinaturas.gemspec +1 -1
- data/lib/moip.rb +2 -1
- data/lib/moip/model.rb +14 -0
- data/lib/moip/models/plan.rb +17 -8
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yzg2NDc5NDk0MzhkNGVlZTlhZmMxZTdmMmJkYmI4MmI4ZTU4ZDZiMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGNlZTgwYTY1ZDIwYzgyMDEwZjlhYWRmN2JjYjA1N2QxMzEyYzI1Nw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTg3NTU3OWU4M2Y3YTc3ZGM5YjYyYWQ1M2U4NGQ0ZGIyMzI4NjRlNTFjODNm
|
10
|
+
ZTUxZTZhZDY2ZTI3MmM4Njg4ZDc2YjFhNjk1MWZkOGIyNzBhYzBiNzJjOTRj
|
11
|
+
Y2VhZmIxNzJkYTRjMWE0MWZjYWZkODI0NDYyNzcxNjRmNmI3YmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGQ1NDNhNjM1MDBkMGM4NGM4NjQ3NzNiYTBkN2NiZWExZTNkZmI0MWM0NGRj
|
14
|
+
ZDUyZTQzMDI5NDUzOTRhYzUyYTM1NjZhYzlmMDc0MzViZjYyMTQyN2Y4MzMw
|
15
|
+
ODJkYTg3MmZlMGEyZDQ3YzhmNDBhNzVhYTQ1NGIwYzhjMmRjNTY=
|
data/lib/moip.rb
CHANGED
data/lib/moip/model.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Moip
|
2
|
+
module Model
|
3
|
+
include ActiveModel::Validations
|
4
|
+
include ActiveModel::Serialization
|
5
|
+
include ActiveModel::Serializers
|
6
|
+
|
7
|
+
def build_with_hash params
|
8
|
+
self.params.each do |attr, value|
|
9
|
+
self.send("#{attr}=".to_sym, value) if self.respond_to? attr
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
data/lib/moip/models/plan.rb
CHANGED
@@ -2,18 +2,31 @@
|
|
2
2
|
class Plan
|
3
3
|
include HTTParty
|
4
4
|
include Moip::Header
|
5
|
-
|
6
|
-
include ActiveModel::Serialization
|
7
|
-
|
5
|
+
|
8
6
|
# see http://moiplabs.github.io/assinaturas-docs/api.html#criar_plano
|
9
7
|
attr_accessor :code, :name, :description, :amount,
|
10
8
|
:setup_fee, :interval, :billing_cycles,
|
11
9
|
:status, :max_qty
|
12
10
|
|
13
|
-
validates :code, :name, :
|
11
|
+
# validates :code, :name, :amount, :presence => true
|
12
|
+
|
13
|
+
def attributes
|
14
|
+
{
|
15
|
+
"code" => code,
|
16
|
+
"name" => name,
|
17
|
+
"description" => description,
|
18
|
+
"amount" => amount,
|
19
|
+
"setup_fee" => setup_fee,
|
20
|
+
"interval" => interval,
|
21
|
+
"billing_cycles" => billing_cycles,
|
22
|
+
"status" => status,
|
23
|
+
"max_qty" => max_qty
|
24
|
+
}
|
25
|
+
end
|
14
26
|
|
15
27
|
# metodo que cria o objeto plano
|
16
28
|
def self.build_new params
|
29
|
+
plan = Plan.new params
|
17
30
|
end
|
18
31
|
|
19
32
|
# see http://moiplabs.github.io/assinaturas-docs/api.html#listar_plano
|
@@ -40,9 +53,5 @@ class Plan
|
|
40
53
|
@interval.merge! :length => options[:length]
|
41
54
|
@interval.merge! :unit => options[:unit]
|
42
55
|
end
|
43
|
-
|
44
|
-
def to_json
|
45
|
-
|
46
|
-
end
|
47
56
|
|
48
57
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-moip-assinaturas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Rossignolli
|
@@ -78,6 +78,7 @@ extra_rdoc_files: []
|
|
78
78
|
files:
|
79
79
|
- lib/moip/configuration.rb
|
80
80
|
- lib/moip/header.rb
|
81
|
+
- lib/moip/model.rb
|
81
82
|
- lib/moip/models/costumer.rb
|
82
83
|
- lib/moip/models/invoice.rb
|
83
84
|
- lib/moip/models/payment.rb
|