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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWI1MWFlODcwMTlmZTRkZjEzYzJhMTJlNDcxY2Q2ZThhN2Y5MDU3YQ==
4
+ Yzg2NDc5NDk0MzhkNGVlZTlhZmMxZTdmMmJkYmI4MmI4ZTU4ZDZiMA==
5
5
  data.tar.gz: !binary |-
6
- NzA4MzcxMjU4ZjRkZjVjZTliYTVkMWFhYjFjN2M5ZTkzMzRjZjViYQ==
6
+ MGNlZTgwYTY1ZDIwYzgyMDEwZjlhYWRmN2JjYjA1N2QxMzEyYzI1Nw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTJlMmUyNTQ1NGY0NjZlM2MzNTMwYzJhMGU4ZWI1NDlkNzEzMjY1MTM4NGRl
10
- Y2M1NDhjNzJjOWMxNDEwZmJkZmQzMWI3OTgzY2I1MWM0ZjhkNjRlMWMxMWYx
11
- MzMyNWYxM2ZmNTFlOGY3MjIxYTI0ZGYwNTk3NDNlNzM3MzVjMDY=
9
+ ZTg3NTU3OWU4M2Y3YTc3ZGM5YjYyYWQ1M2U4NGQ0ZGIyMzI4NjRlNTFjODNm
10
+ ZTUxZTZhZDY2ZTI3MmM4Njg4ZDc2YjFhNjk1MWZkOGIyNzBhYzBiNzJjOTRj
11
+ Y2VhZmIxNzJkYTRjMWE0MWZjYWZkODI0NDYyNzcxNjRmNmI3YmQ=
12
12
  data.tar.gz: !binary |-
13
- NjYyMGVhYzMyYWY4MzkzZDM5ODY1ZjdjZmU2NWMwZjJlYzQ3Y2FmYzQyNTcw
14
- NGVjZTE4NjE4ZGFmM2QzMTg0NDllMmJmZmRkOTAzNzU3ZGYwMTdkOTFlZGIz
15
- ZTZhYjhlZDY4ZTA2YjdkYzkwYTA2NDczODYwNjBmNmIxMTg2NmQ=
13
+ ZGQ1NDNhNjM1MDBkMGM4NGM4NjQ3NzNiYTBkN2NiZWExZTNkZmI0MWM0NGRj
14
+ ZDUyZTQzMDI5NDUzOTRhYzUyYTM1NjZhYzlmMDc0MzViZjYyMTQyN2Y4MzMw
15
+ ODJkYTg3MmZlMGEyZDQ3YzhmNDBhNzVhYTQ1NGIwYzhjMmRjNTY=
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'api-moip-assinaturas'
3
- s.version = '0.0.5'
3
+ s.version = '0.0.6'
4
4
  s.date = '2013-06-05'
5
5
  s.summary = "Moip Assinaturas by Pixxel"
6
6
  s.description = "Gem desenvolvida para atender aos requisitos do moip api de assinaturas"
data/lib/moip.rb CHANGED
@@ -4,9 +4,10 @@ end
4
4
  # imports para o statup
5
5
  require "httparty"
6
6
  require "json"
7
- require "activemodel"
7
+ require "active_model"
8
8
  require "moip/configuration"
9
9
  require "moip/header"
10
+ require "moip/model"
10
11
  require "moip/webhooks"
11
12
 
12
13
  # require all models
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
@@ -2,18 +2,31 @@
2
2
  class Plan
3
3
  include HTTParty
4
4
  include Moip::Header
5
- include ActiveModel::Validations
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, :description, :amount, :presence => true
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.5
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