mycashflow 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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +34 -0
- data/Rakefile +6 -0
- data/lib/mycashflow.rb +6 -0
- data/lib/mycashflow/client.rb +55 -0
- data/lib/mycashflow/version.rb +3 -0
- data/mycashflow.gemspec +27 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 37a594715f661a5d6e4d620df4ee1a5206927330
|
4
|
+
data.tar.gz: 1a89f3b2c2ae9e85fed09373c78f16a91619801d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 008fbc178124632cf74f256b331e00ec4c926a749f99f04dca601fb482f7c570b04d19aa8e343e5afe0e771f6babac955b6894b041b97b1de389887ff559852c
|
7
|
+
data.tar.gz: 330099f3beaf3e4a824364d26c8293a18804a8e9c725196ffd3f3121a85f94c9d08ba386eb9ae6ac5584a07ea88fe212fae3ae74328a74155783b8088e71d10a
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Jukka Koskinen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# MyCashflow API
|
2
|
+
|
3
|
+
A work-in-progress Ruby client for the MyCashflow API.
|
4
|
+
|
5
|
+
Client API inspired by: [https://github.com/amro/gibbon]
|
6
|
+
|
7
|
+
# Usage
|
8
|
+
```
|
9
|
+
gem install mycashflow
|
10
|
+
```
|
11
|
+
```
|
12
|
+
require 'mycashflow'
|
13
|
+
|
14
|
+
# Initialize the client
|
15
|
+
client = MyCashflow::Client.new({
|
16
|
+
base_url: 'https://myshop.com/api/v1',
|
17
|
+
username: 'username',
|
18
|
+
password: 'password'
|
19
|
+
})
|
20
|
+
|
21
|
+
# Get all categories
|
22
|
+
client.categories.get
|
23
|
+
|
24
|
+
# Get category by ID
|
25
|
+
client.categories(1).get
|
26
|
+
|
27
|
+
# Get category's subcategories
|
28
|
+
client.categories(1).subcategories.get
|
29
|
+
```
|
30
|
+
|
31
|
+
**Things to do:**
|
32
|
+
|
33
|
+
1. Add caching
|
34
|
+
2. Write tests
|
data/Rakefile
ADDED
data/lib/mycashflow.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module MyCashflow
|
2
|
+
class Client
|
3
|
+
include HTTParty
|
4
|
+
|
5
|
+
def initialize(config = {})
|
6
|
+
@path_parts = []
|
7
|
+
@username = config[:username] || ENV['MYCASHFLOW_USERNAME']
|
8
|
+
@password = config[:password] || ENV['MYCASHFLOW_PASSWORD']
|
9
|
+
@base_url = config[:base_url] || ENV['MYCASHFLOW_BASE_URL']
|
10
|
+
|
11
|
+
self.class.base_uri(@base_url)
|
12
|
+
self.class.headers({ 'Accept' => 'application/json' })
|
13
|
+
self.class.basic_auth(@username, @password)
|
14
|
+
end
|
15
|
+
|
16
|
+
def method_missing(method, *args)
|
17
|
+
@path_parts << method.to_s.gsub('_', '-').downcase
|
18
|
+
@path_parts << args if args.length > 0
|
19
|
+
@path_parts.flatten!
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
def path
|
24
|
+
"/#{@path_parts.join('/')}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def reset
|
28
|
+
@path_parts = []
|
29
|
+
end
|
30
|
+
|
31
|
+
def get(params = {})
|
32
|
+
self.class.get(path)
|
33
|
+
ensure
|
34
|
+
reset
|
35
|
+
end
|
36
|
+
|
37
|
+
def create(params = {})
|
38
|
+
self.class.create(path, params)
|
39
|
+
ensure
|
40
|
+
reset
|
41
|
+
end
|
42
|
+
|
43
|
+
def update(params = {})
|
44
|
+
self.class.update(path, params)
|
45
|
+
ensure
|
46
|
+
reset
|
47
|
+
end
|
48
|
+
|
49
|
+
def delete(params = {})
|
50
|
+
self.class.delete(path, params)
|
51
|
+
ensure
|
52
|
+
reset
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/mycashflow.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mycashflow/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mycashflow"
|
8
|
+
spec.version = MyCashflow::VERSION
|
9
|
+
spec.authors = ["Jukka Koskinen"]
|
10
|
+
spec.email = ["jukka@koskinen.io"]
|
11
|
+
|
12
|
+
spec.summary = %q{MyCashflow API Client}
|
13
|
+
spec.description = %q{A simple client for the MyCashflow API}
|
14
|
+
spec.homepage = "https://github.com/jukkakoskinen/mycashflow-ruby"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "httparty", "~> 0.13.5"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mycashflow
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jukka Koskinen
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.13.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.13.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A simple client for the MyCashflow API
|
70
|
+
email:
|
71
|
+
- jukka@koskinen.io
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/mycashflow.rb
|
84
|
+
- lib/mycashflow/client.rb
|
85
|
+
- lib/mycashflow/version.rb
|
86
|
+
- mycashflow.gemspec
|
87
|
+
homepage: https://github.com/jukkakoskinen/mycashflow-ruby
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.4.5.1
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: MyCashflow API Client
|
111
|
+
test_files: []
|