wolf_core 0.1.89 → 0.1.91

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: 690f4bc94dfdee6a9f42a74af9ed0432bd5e155f77d4b803c7b5c56f55c7e3a1
4
- data.tar.gz: b5199946dbc987fe9bceb6df744eba393fff351181ac076b539a3b5c57650945
3
+ metadata.gz: a1f413ca280ec6a3b545b09b41aa3c94ac04ca81dd82f1e5247ddabbd7442613
4
+ data.tar.gz: 245bcae482df84beb3e960bab0014c35eb6872622957771ee824ee3712de4953
5
5
  SHA512:
6
- metadata.gz: ab25e0389cae18a747e0146c46797d61ab2f2a73a7d770409dfcc42f4c08e1f3df5b58ff58d5ddf72dc007625c1a4e5d8d1cb41e9e7bca48a2a89e71fafb987e
7
- data.tar.gz: ab6b4a53790070d05181feab31489ba9571811ed7ec0a2db4ce3f1a975f1a53b347ed87f95ecf81e3d03f70747ae8821d0cb0bfa6ce46aa6638e2e5c237f6792
6
+ metadata.gz: e0b8d80dad981e4b21daf08f84987824ca85af03b0d138666fb2a6dd25008bbe9b810cf35b576c85a1ab33dcbfa8ce875157544e7579489727508cbbaf18a71b
7
+ data.tar.gz: ca9b9cf5361617f6a071bcf720b93fdceea0b1ef2d03b19db5af4c67437765d5ec9e8c64b169ac18cbedf142180c501aca99af7c92b194537ce39987e45f3b4f
@@ -40,6 +40,59 @@ module WolfCore
40
40
  'Reject' => 'rejected',
41
41
  }
42
42
 
43
+ STATE_ABBREVIATIONS_MAP = {
44
+ "Alabama"=>"AL",
45
+ "Alaska"=>"AK",
46
+ "Arizona"=>"AZ",
47
+ "Arkansas"=>"AR",
48
+ "California"=>"CA",
49
+ "Colorado"=>"CO",
50
+ "Connecticut"=>"CT",
51
+ "Delaware"=>"DE",
52
+ "Florida"=>"FL",
53
+ "Georgia"=>"GA",
54
+ "Hawaii"=>"HI",
55
+ "Idaho"=>"ID",
56
+ "Illinois"=>"IL",
57
+ "Indiana"=>"IN",
58
+ "Iowa"=>"IA",
59
+ "Kansas"=>"KS",
60
+ "Kentucky"=>"KY",
61
+ "Louisiana"=>"LA",
62
+ "Maine"=>"ME",
63
+ "Maryland"=>"MD",
64
+ "Massachusetts"=>"MA",
65
+ "Michigan"=>"MI",
66
+ "Minnesota"=>"MN",
67
+ "Mississippi"=>"MS",
68
+ "Missouri"=>"MO",
69
+ "Montana"=>"MT",
70
+ "Nebraska"=>"NE",
71
+ "Nevada"=>"NV",
72
+ "New Hampshire"=>"NH",
73
+ "New Jersey"=>"NJ",
74
+ "New Mexico"=>"NM",
75
+ "New York"=>"NY",
76
+ "North Carolina"=>"NC",
77
+ "North Dakota"=>"ND",
78
+ "Ohio"=>"OH",
79
+ "Oklahoma"=>"OK",
80
+ "Oregon"=>"OR",
81
+ "Pennsylvania"=>"PA",
82
+ "Rhode Island"=>"RI",
83
+ "South Carolina"=>"SC",
84
+ "South Dakota"=>"SD",
85
+ "Tennessee"=>"TN",
86
+ "Texas"=>"TX",
87
+ "Utah"=>"UT",
88
+ "Vermont"=>"VT",
89
+ "Virginia"=>"VA",
90
+ "Washington"=>"WA",
91
+ "West Virginia"=>"WV",
92
+ "Wisconsin"=>"WI",
93
+ "Wyoming"=>"WY",
94
+ }
95
+
43
96
  def map_provider_type_to_pricing_id(provider_type)
44
97
  pricing_id = PROVIDER_TYPE_MAPPING[provider_type]
45
98
  pricing_id || provider_type
@@ -75,6 +128,14 @@ module WolfCore
75
128
  def revert_map_submittal_stage_to_order_application_status(value)
76
129
  SUBMITTAL_STAGE_MAP.invert[value] || value
77
130
  end
131
+
132
+ def map_state_to_abbreviation(value)
133
+ STATE_ABBREVIATIONS_MAP[value] || value
134
+ end
135
+
136
+ def revert_map_state_to_abbreviation(value)
137
+ STATE_ABBREVIATIONS_MAP.invert[value] || value
138
+ end
78
139
  end
79
140
  end
80
141
  end
@@ -44,5 +44,30 @@ module WolfCore
44
44
 
45
45
  log_object "File Deleting Process Finished! (#{files_to_delete.size} files deleted)"
46
46
  end
47
+
48
+ def encode_file_to_base64_from_url(url)
49
+ uri = URI.parse(url)
50
+ response = Net::HTTP.get_response(uri)
51
+ raise_service_error({ message: 'Failed to download file', url: url }) unless response.is_a?(Net::HTTPSuccess)
52
+
53
+ encoded_file = Base64.strict_encode64(response.body)
54
+
55
+ content_disposition = response['content-disposition']
56
+
57
+ filename = if content_disposition
58
+ match = content_disposition.match(/filename="?([^"]+)"?/)
59
+ match ? match[1] : File.basename(uri.path)
60
+ else
61
+ File.basename(uri.path)
62
+ end
63
+ log_object filename, title: 'filename is'
64
+ return { filename: filename, encoded_file: encoded_file }
65
+ rescue => e
66
+ raise_service_error({
67
+ message: 'Failed to encode file url',
68
+ encode_file_error: { message: e.message, backtrace: e.backtrace },
69
+ url: url,
70
+ })
71
+ end
47
72
  end
48
- end
73
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.89"
4
+ VERSION = "0.1.91"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.89
4
+ version: 0.1.91
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-19 00:00:00.000000000 Z
11
+ date: 2024-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty