cloverly 0.1.1 → 0.2.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77e3cfe8cfc63d432709a9da5ae79e71c6da1e904f6d517bf500b424cd82d093
4
- data.tar.gz: dc946a83c6d8becd82a32115ce4e63164e9888e98c6723219ea861b67568133e
3
+ metadata.gz: 57bc13b5f60b560246cdf80e70dcc46b445f25e323610026959b65cceac57029
4
+ data.tar.gz: 22b3024715bb0638584a9e4a7c68154ae346001e8ffd988e3e81ced33302f8b9
5
5
  SHA512:
6
- metadata.gz: db6ba1a25995ce8ca0ebdd4d1634d85917fa0b38c0f6ff2314ba48bd297dc3d97c1760ac790bef2c147d1348a774aeb337c4e590344f7901c3f4b8b262289f63
7
- data.tar.gz: de9f598305739dc83b840d714c128bc4f336039c1f0b17c977d07a207c223201653066eefc42a2d652f3fcba009ec4e6cfe6edcf9687899875699738b47d2180
6
+ metadata.gz: 6cd3818cf0608fe099a766a334f0b29649cfdd0a9db326f4fee6f8b7ab07915f246295d991ded1baa818604fba42485034b692cf7d4861ff78df7bebf1d55e9a
7
+ data.tar.gz: 459d4c6121c9a98e83f918c9a5d02a314df496febd683c7dd49c51aec59d3259b93c00f02d1410e39565444aee85eb1896c6907d08c8cd0ae51e75f47d7d38bd
data/lib/cloverly.rb CHANGED
@@ -93,7 +93,7 @@ class Cloverly
93
93
 
94
94
  private
95
95
  def conn
96
- @conn ||= Faraday.new(:url => 'https://api.cloverly.app')
96
+ @conn ||= Faraday.new(:url => ENV['CLOVERLY_API_URL'] || 'https://api.cloverly.com')
97
97
  end
98
98
  end
99
99
 
data/lib/cloverly/base.rb CHANGED
@@ -10,6 +10,14 @@ module Cloverly::Base
10
10
  end
11
11
  end
12
12
 
13
+ def to_json
14
+ @json
15
+ end
16
+
17
+ def json=(json)
18
+ @json = json
19
+ end
20
+
13
21
  def self.included(base)
14
22
  base.extend ClassMethods
15
23
  base.class_eval do
@@ -18,13 +26,14 @@ module Cloverly::Base
18
26
 
19
27
  module ClassMethods
20
28
  def parse(cloverly_instance, json_response)
21
-
22
29
  if json_response.is_a?(Array)
23
30
  json_response.map do |item_json|
24
31
  self.parse(cloverly_instance, item_json)
25
32
  end
26
33
  else
27
34
  instance = self.new(cloverly_instance)
35
+
36
+ instance.json = json_response
28
37
  instance.attributes = json_response
29
38
 
30
39
  instance
@@ -12,11 +12,13 @@ class Cloverly::Estimate
12
12
  class << self
13
13
 
14
14
  def retrieve(cloverly_instance = nil, slug)
15
- Cloverly::Estimate.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/estimates/#{slug}"))
15
+ c = cloverly_instance || Cloverly.default
16
+ Cloverly::Estimate.parse(c, c.get("/2019-03-beta/estimates/#{slug}"))
16
17
  end
17
18
 
18
- def list
19
- Cloverly::Estimate.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/estimates/#{slug}"))
19
+ def list(cloverly_instance = nil)
20
+ c = cloverly_instance || Cloverly.default
21
+ Cloverly::Estimate.parse(c, c.get("/2019-03-beta/estimates"))
20
22
  end
21
23
 
22
24
  def shipping(args)
@@ -11,12 +11,14 @@ class Cloverly::Purchase
11
11
 
12
12
  class << self
13
13
 
14
- def retrieve(slug)
15
- Cloverly::Purchase.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/purchases/#{slug}"))
14
+ def retrieve(cloverly_instance = nil, slug)
15
+ c = cloverly_instance || Cloverly.default
16
+ Cloverly::Purchase.parse(c, c.get("/2019-03-beta/purchases/#{slug}"))
16
17
  end
17
18
 
18
- def list
19
- Cloverly::Purchase.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/purchases/#{slug}"))
19
+ def list(cloverly_instance = nil)
20
+ c = cloverly_instance || Cloverly.default
21
+ Cloverly::Purchase.parse(c, c.get("/2019-03-beta/purchases"))
20
22
  end
21
23
 
22
24
  def shipping(args)
@@ -3,11 +3,11 @@ class Cloverly::Source
3
3
 
4
4
  class << self
5
5
  def retrieve(slug)
6
- Cloverly::Source.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/recs/#{slug}"))
6
+ Cloverly::Source.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/offsets/#{slug}"))
7
7
  end
8
8
 
9
9
  def list
10
- Cloverly::Source.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/recs"))
10
+ Cloverly::Source.parse(Cloverly.default, Cloverly.default.get("/2019-03-beta/offsets"))
11
11
  end
12
12
  end
13
13
 
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Cloverly
4
+ VERSION = '0.2.0'
5
+ end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloverly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Winslett
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-09 00:00:00.000000000 Z
11
+ date: 2021-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rspec
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -107,13 +113,14 @@ files:
107
113
  - lib/cloverly/estimate.rb
108
114
  - lib/cloverly/purchase.rb
109
115
  - lib/cloverly/source.rb
116
+ - lib/cloverly/version.rb
110
117
  homepage: https://cloverly.com
111
118
  licenses:
112
119
  - MIT
113
120
  metadata:
114
121
  source_code_uri: https://github.com/cloverly/cloverly-ruby-gem
115
122
  bug_tracker_uri: https://github.com/cloverly/cloverly-ruby-gem/issues
116
- post_install_message:
123
+ post_install_message:
117
124
  rdoc_options: []
118
125
  require_paths:
119
126
  - lib
@@ -128,9 +135,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
135
  - !ruby/object:Gem::Version
129
136
  version: 1.8.11
130
137
  requirements: []
131
- rubyforge_project:
132
- rubygems_version: 2.7.6.2
133
- signing_key:
138
+ rubygems_version: 3.2.14
139
+ signing_key:
134
140
  specification_version: 4
135
141
  summary: Ruby library for interaction with Cloverly API
136
142
  test_files: []