fnz_client 0.0.1

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDA0ZjlkNTk1NDdiZjRjMmMwYjZiMWZkYzUwYzQ1Y2ZjYWQwNmY3ZA==
5
+ data.tar.gz: !binary |-
6
+ ZmRjYzY1ODhiN2Y5MmJlMDM1OTFmYjJmNzA2YjUzY2I0YzczNGMzNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OTFkYzhlMmViZTEwMjhlMzI4ZjBmNGFjN2U3OTM3MjMyMDM5N2E0YjFjMDJj
10
+ NTEzZmM5NzU0YjljZTJlNDVjMmY5ZTAwODczYzZkZTIzMWRlOTBjMjA0MTQ3
11
+ NjA3ZWQ1NDQ2YWQxZjBlZjk3MmFmNWQyMmEwNjk0NTc5NjZjOTE=
12
+ data.tar.gz: !binary |-
13
+ OTgzNDZmMjk0YzhhOTAxZTdiNmRmMmIzYWQzY2NjNzE1ZGI0MTMwYjkzYTU3
14
+ YjZmMThiNWRhZmIzYmQ3Y2UyZGQwNTdiZWRmZmE2OTYwNDlmMThhZjI3MTU2
15
+ YzY0ZWYzNWFjMzkxMWRkNDFmYjc1YTE1NDM2ZmRiNjUwNzg0YTI=
@@ -0,0 +1,8 @@
1
+ module Fnz
2
+ # Wraps around Hydra for readibility
3
+ module ParallelRequests
4
+ def self.run
5
+ HYDRA.run
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,10 @@
1
+ require 'fnz_client/service_configuration'
2
+ class Installment < LogicalModel
3
+ include FnzClient::ServiceConfiguration
4
+
5
+ belongs_to :membership
6
+
7
+ attribute :due_on # The due date
8
+ attribute :value # The value
9
+ attribute :status # The status
10
+ end
@@ -0,0 +1,17 @@
1
+ require 'fnz_client/service_configuration'
2
+ class Membership < LogicalModel
3
+ include FnzClient::ServiceConfiguration
4
+ set_api_key "app_key", Fnz::API_KEY
5
+
6
+ attribute :payment_type # The payment type name
7
+ attribute :begins_on # The starting date
8
+ attribute :ends_on # The finishing date
9
+ attribute :value # The value
10
+
11
+ has_many :installments, class: 'Installment'
12
+
13
+ def self.find_current_membership(account, contact_id)
14
+ self.set_resource_path "/api/v0/businesses/#{account}/contacts/#{contact_id}/current_membership"
15
+ return self.find("")
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ module Fnz
2
+ unless defined? HYDRA
3
+ HYDRA = Typhoeus::Hydra.new
4
+ end
5
+
6
+ HOST = case Rails.env
7
+ when "production"
8
+ "fnz.herokuapp.com"
9
+ when "development"
10
+ "localhost:3008"
11
+ when "staging"
12
+ "fnz-staging.herokuapp.com"
13
+ when "test"
14
+ "localhost:3008"
15
+ end
16
+ end
data/lib/fnz_client.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'logical_model'
2
+ if defined?(Rails)
3
+ require 'fnz_client/railties'
4
+ end
@@ -0,0 +1,4 @@
1
+ module FnzClient
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ module FnzClient
2
+ module ServiceConfiguration
3
+ def self.included(base)
4
+ base.send('use_hydra', Fnz::HYDRA)
5
+ #base.send('force_ssl')
6
+ base.send('set_resource_host', Fnz::HOST)
7
+ base.send('configure_index_response', {collection: 'collection', total: 'total'})
8
+ end
9
+ end
10
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fnz_client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Luis Perichon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '3.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: logical_model
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.5.12
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.5.12
41
+ description: This is client library for Padma-FNZ API.
42
+ email:
43
+ - luisperichon@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - app/helpers/fnz/parallel_requests.rb
49
+ - app/models/installment.rb
50
+ - app/models/membership.rb
51
+ - config/initializers/fnz_client.rb
52
+ - lib/fnz_client.rb
53
+ - lib/fnz_client/railties.rb
54
+ - lib/fnz_client/service_configuration.rb
55
+ homepage: ''
56
+ licenses: []
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubyforge_project:
74
+ rubygems_version: 2.2.1
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Client library Padma-fnz API
78
+ test_files: []