webceo 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2afe7cb5ced6fb5efa4b94628c9553372f512bd6
4
- data.tar.gz: 77c587b23e92819c63feb35f4ad36752feffe890
3
+ metadata.gz: 271714cff7c51be222dda592a803eb43e5a1b94f
4
+ data.tar.gz: a0b597a38c8c4f73ced9009f3fb5532dc6fa1a23
5
5
  SHA512:
6
- metadata.gz: 4a22917d19ca12c9c6e4e44e8ab418f3760143e1a9cf55759913eaa2bd04a8e1eba8a5e8f02e26757a527438a52b16edacb59ddaf1447cdd30d55595a19eb220
7
- data.tar.gz: 7380d52ff2de4efb60c88fba54dac127c92c1338cf8ff73635ae669850b908bbaac681610cb5c9f55e738a91bf724c1191b59400f70e01cbdecabcdde671e17e
6
+ metadata.gz: 5deeba8cadd4933f85756ca281033acc10283359878740fc6fde359a7d7a41379099239becaac45f21fca8e3f5e3be18240d5bbe97a1fbf748af7663cf7d075b
7
+ data.tar.gz: a25f20e18a168c7ae7cde920c3725e67b3b39ab7b0015d095effcaf8e19ebd9d073d6f7ec2cbdfbfef1ec638ae7172c6a6818c58e783b93f6a3ee06d2815c00e
data/README.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Webceo
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/webceo.svg)][gem_version]
4
+ [![Gem](https://img.shields.io/gem/dv/webceo/stable.svg)][gem_downloads]
5
+ ![GitHub tag](https://img.shields.io/github/tag/agnel/webceo.svg)
6
+ [![Liberapay receiving](https://img.shields.io/liberapay/receives/agnelwaghela.svg)][liberapay_donate_link]
7
+
8
+ [gem_version]: https://badge.fury.io/rb/webceo
9
+ [gem_downloads]: https://rubygems.org/gems/webceo
10
+ [liberapay_donate_link]: https://liberapay.com/agnelwaghela/donate
11
+
3
12
  Integrate your ruby application with this `webceo` gem to perform the api action using your webceo account. Take a look at the [Webceo API Reference](https://www.webceo.com/api-documentation.htm).
4
13
 
5
14
  ## Getting Started
@@ -21,9 +30,18 @@ Or install it yourself as:
21
30
  ## Usage
22
31
 
23
32
  ```ruby
24
- # initialize an instance of the Client with your API key or
25
- # set an Environment Variable WEBCEO_API_KEY and initialize client without passing it to the client
26
- client = Webceo::Api::Client.new('your_api_key')
33
+
34
+ # Configure the gem
35
+ Webceo.configure do |config|
36
+ # set the api_key option as per your convenience, for example using environment variables
37
+ config.api_key = ENV['WEBCEO_API_KEY']
38
+ end
39
+
40
+ # initialize an instance of the Client
41
+ client = Webceo::Api::Client.new
42
+
43
+ # get the list of all methods
44
+ client.list_methods # => ['get_projects', 'get_project', ...]
27
45
 
28
46
  # get list of all the projects, see api reference
29
47
  client.get_projects({ :id => 'my_request_id' })
@@ -37,7 +55,10 @@ client.get_project({ :project => '8ady5y7e36' })
37
55
 
38
56
  ## Contributing
39
57
 
40
- [![Open Source Helpers](https://www.codetriage.com/agnel/webceo/badges/users.svg)](https://www.codetriage.com/agnel/webceo)
58
+ [![Open Source Helpers](https://www.codetriage.com/agnel/webceo/badges/users.svg)][open_source_helpers]
59
+ ![Maintenance](https://img.shields.io/maintenance/yes/2018.svg)
60
+
61
+ [open_source_helpers]: https://www.codetriage.com/agnel/webceo
41
62
 
42
63
  Bug reports and pull requests are welcome on GitHub at https://github.com/agnel/webceo. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
43
64
 
@@ -46,9 +67,15 @@ Check out the [Webceo Ruby Gem Google Group](https://groups.google.com/forum/#!f
46
67
 
47
68
  ## License
48
69
 
70
+ [![license](https://img.shields.io/github/license/agnel/webceo.svg)][mit_license]
71
+
72
+ [mit_license]: http://opensource.org/licenses/MIT
73
+
49
74
  Webceo is released under the [MIT License](http://opensource.org/licenses/MIT).
50
75
 
51
76
  ## Todo
52
77
 
78
+ - [ ] Configuration Support
79
+ - [ ] Generator for initializer with configuration boilerplate
53
80
  - [ ] Batch Operations Support
54
81
  - [ ] Specs
@@ -4,9 +4,21 @@ require 'httparty'
4
4
  require 'multi_json'
5
5
  require 'active_support/core_ext/hash/indifferent_access'
6
6
  require 'webceo/api'
7
- require 'webceo/api/request'
8
- require 'webceo/api/response'
9
- require 'webceo/api/error'
10
- require 'webceo/api/client'
7
+ require 'webceo/configuration'
11
8
 
12
- module Webceo; end # end of module Webceo
9
+ module Webceo
10
+
11
+ class << self
12
+ attr_accessor :configuration
13
+ end
14
+
15
+ def self.configure
16
+ self.configuration ||= Webceo::Configuration.new
17
+ yield(configuration)
18
+ end
19
+
20
+ def self.reset
21
+ self.configuration = Webceo::Configuration.new
22
+ end
23
+
24
+ end # end of module Webceo
@@ -1,3 +1,8 @@
1
+ require 'webceo/api/request'
2
+ require 'webceo/api/response'
3
+ require 'webceo/api/error'
4
+ require 'webceo/api/client'
5
+
1
6
  module Webceo
2
7
 
3
8
  API_METHODS = YAML.load_file('./lib/webceo/api_methods.yml')
@@ -14,13 +14,7 @@ module Webceo
14
14
  #
15
15
  # Intializes an instance of Client to make api calls
16
16
  #
17
- # It accepts an api_key or uses the one set in the environment variable WEBCEO_API_KEY
18
- #
19
- # @param [String] api_key Webceo API Key
20
- #
21
- def initialize(api_key = nil)
22
- self.class.default_options.merge!({ api_key: (api_key || ENV['WEBCEO_API_KEY']) })
23
- end
17
+ def initialize; end
24
18
 
25
19
  #
26
20
  # It lists names of all the available API methods on the Webceo API Reference
@@ -33,7 +33,7 @@ module Webceo
33
33
  def to_json
34
34
  MultiJson.dump({
35
35
  method: @method_name.to_s,
36
- key: Webceo::Api::Client.default_options[:api_key],
36
+ key: Webceo.configuration.api_key,
37
37
  id: @data[:id],
38
38
  data: @data
39
39
  })
@@ -0,0 +1,22 @@
1
+ module Webceo
2
+ #
3
+ # Class Configuration provides ability to set webceo specific configurations
4
+ #
5
+ # @author Agnel Waghela <agnelwaghela@gmail.com>
6
+ #
7
+ class Configuration
8
+
9
+ #
10
+ # @!attribute [rw] api_key
11
+ # @return [String] API Key required to be present along with the api request
12
+ attr_accessor :api_key
13
+
14
+ #
15
+ # Initialize default attribute values
16
+ #
17
+ #
18
+ def initialize
19
+ @api_key = nil
20
+ end
21
+ end # end of class Configuration
22
+ end # end of module Webceo
@@ -1,17 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Webceo
4
- # Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt>
4
+ #
5
+ # Returns the version of the currently loaded Webceo as a <tt>Gem::Version</tt>
6
+ #
5
7
  def self.gem_version
6
8
  Gem::Version.new VERSION::STRING
7
9
  end
8
10
 
11
+ #
12
+ # Module VERSION provides constants as per the semantic versioning specification
13
+ #
14
+ # @see https://semver.org/
15
+ #
16
+ # @author Agnel Waghela <agnelwaghela@gmail.com>
17
+ #
9
18
  module VERSION
10
- MAJOR = 0
11
- MINOR = 1
12
- TINY = 0
19
+ MAJOR = 1
20
+ MINOR = 0
21
+ PATCH = 0
13
22
  PRE = nil # 'alpha', 'beta', 'rc1', 'rc2', nil
14
23
 
15
- STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
24
+ STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
16
25
  end
17
26
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webceo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agnel Waghela
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-30 00:00:00.000000000 Z
11
+ date: 2018-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -150,6 +150,7 @@ files:
150
150
  - lib/webceo/api/request.rb
151
151
  - lib/webceo/api/response.rb
152
152
  - lib/webceo/api_methods.yml
153
+ - lib/webceo/configuration.rb
153
154
  - lib/webceo/version.rb
154
155
  - webceo.gemspec
155
156
  homepage: http://agnelwaghela.in/project/webceo-api-client